C# ASP.NET AJAX CascadingDropDown 选定值属性问题
问候, 我在使用 CascadingDropDown 的选定值属性时遇到问题。
我有 3 个 asp 下拉控件,每个控件都带有 ajax CascadingDropDown 。
我将数据绑定到 3 CascadingDropDown 没有问题,但我的问题是重新绑定 CascadingDropDown。
我想要做的就是从 Gridview 中选择一条记录,其中包含我想要传递的 CascadingDropDown 的选定值,然后将 CascadingDropDown 与选定值重新绑定。
我将我的代码发布下来,其中包括:
1-ASP.NET 代码。
2-代码隐藏来处理网格视图中选定的记录。
3- 处理绑定数据到 3 CascadingDropDown 的 Web 服务。
请建议如何使用选定的值将数据重新绑定到 CascadingDropDown 。
顺便说一下,我使用了代码中所示的选定值属性,但它不起作用并且没有错误。
谢谢你,
........................ ASP.NET 代码 ........................
<%@ Page Title="" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="IMAM_APPLICATION.WebForm1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="idcontact_info" DataSourceID="ObjectDataSource1"
onselectedindexchanged="GridView1_SelectedIndexChanged">
<Columns>
<asp:CommandField ShowSelectButton="True" />
<asp:BoundField DataField="idcontact_info" HeaderText="idcontact_info"
InsertVisible="False" ReadOnly="True" SortExpression="idcontact_info" />
<asp:BoundField DataField="Work_Field" HeaderText="Work_Field"
SortExpression="Work_Field" />
<asp:BoundField DataField="Occupation" HeaderText="Occupation"
SortExpression="Occupation" />
<asp:BoundField DataField="sub_Occupation" HeaderText="sub_Occupation"
SortExpression="sub_Occupation" />
</Columns>
</asp:GridView>
<asp:Label ID="lbl" runat="server" Text="Label"></asp:Label>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
DeleteMethod="Delete" InsertMethod="Insert"
OldValuesParameterFormatString="original_{0}" SelectMethod="GetData"
TypeName="IMAM_APPLICATION.DSContactTableAdapters.contact_infoTableAdapter"
UpdateMethod="Update">
<DeleteParameters>
<asp:Parameter Name="Original_idcontact_info" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="Work_Field" Type="String" />
<asp:Parameter Name="Occupation" Type="String" />
<asp:Parameter Name="sub_Occupation" Type="String" />
<asp:Parameter Name="Original_idcontact_info" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="Work_Field" Type="String" />
<asp:Parameter Name="Occupation" Type="String" />
<asp:Parameter Name="sub_Occupation" Type="String" />
</InsertParameters>
</asp:ObjectDataSource>
<asp:DropDownList ID="cmbWorkField" runat="server" Style="top: 715px; left: 180px;
position: absolute; height: 22px; width: 126px">
</asp:DropDownList>
<asp:DropDownList runat="server" ID="cmbOccupation" Style="top: 745px; left: 180px;
position: absolute; height: 22px; width: 77px">
</asp:DropDownList>
<asp:DropDownList ID="cmbSubOccup" runat="server"
style="position:absolute; top: 775px; left: 180px;">
</asp:DropDownList>
<cc1:CascadingDropDown ID="cmbWorkField_CascadingDropDown" runat="server"
TargetControlID="cmbWorkField"
Category="WorkField"
LoadingText="Please Wait ..."
PromptText="Select Wor kField ..."
ServiceMethod="GetWorkField"
ServicePath="ServiceTags.asmx">
</cc1:CascadingDropDown>
<cc1:CascadingDropDown ID="cmbOccupation_CascadingDropDown" runat="server"
TargetControlID="cmbOccupation"
Category="Occup"
LoadingText="Please wait..."
PromptText="Select Occup ..."
ServiceMethod="GetOccup"
ServicePath="ServiceTags.asmx"
ParentControlID="cmbWorkField">
</cc1:CascadingDropDown>
<cc1:CascadingDropDown ID="cmbSubOccup_CascadingDropDown" runat="server"
Category="SubOccup"
Enabled="True"
LoadingText="Please Wait..."
ParentControlID="cmbOccupation"
PromptText="Select Sub Occup"
ServiceMethod="GetSubOccup"
ServicePath="ServiceTags.asmx"
TargetControlID="cmbSubOccup">
</cc1:CascadingDropDown>
</asp:Content>
......................................................
C# code behind
......................................................
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
string strg = GridView1.SelectedDataKey["idcontact_info"].ToString();
int index = Convert.ToInt32(GridView1.SelectedDataKey["idcontact_info"].ToString());
//txtSearch.Text = GridView1.SelectedIndex.ToString();
// txtSearch.Text = GridView1.SelectedDataKey["idcontact_info"].ToString();
DSContactTableAdapters.contact_infoTableAdapter GetByIDAdapter = new DSContactTableAdapters.contact_infoTableAdapter();
DSContact.contact_infoDataTable ByID = GetByIDAdapter.GetDataByID(index);
//DSSearch.contact_infoDataTable FirstName = FirstNameAdapter.GetDataByFirstNameList(prefixText);
foreach (DataRow dr in ByID.Rows)
{
lbl.Text = dr["Work_Field"].ToString() + "....." + dr["Occupation"].ToString() + "....." + dr["sub_Occupation"].ToString();
cmbWorkField_CascadingDropDown.SelectedValue = dr["Work_Field"].ToString();
cmbOccupation_CascadingDropDown.SelectedValue = dr["Occupation"].ToString();
cmbSubOccup_CascadingDropDown.SelectedValue = dr["sub_Occupation"].ToString();
}
}
.......................................................
web Service
.......................................................
[WebMethod]
public CascadingDropDownNameValue[] GetWorkField(string knownCategoryValues, string category)
{
//dsCarsTableAdapters.CarsTableAdapter makeAdapter = new dsCarsTableAdapters.CarsTableAdapter();
//dsCars.CarsDataTable makes = makeAdapter.GetAllCars();
DSContactTableAdapters.tag_work_fieldTableAdapter GetWorkFieldAdapter = new DSContactTableAdapters.tag_work_fieldTableAdapter();
DSContact.tag_work_fieldDataTable WorkFields = GetWorkFieldAdapter.GetDataByGetWorkField();
List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
foreach (DataRow dr in WorkFields)
{
string Work_Field = (string)dr["work_Field_name"];
int idtag_work_field = (int)dr["idtag_work_field"];
values.Add(new CascadingDropDownNameValue(Work_Field, idtag_work_field.ToString()));
}
return values.ToArray();
}
[WebMethod]
public CascadingDropDownNameValue[] GetOccup(string knownCategoryValues, string category)
{
StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
int idtag_work_field;
if (!kv.ContainsKey("WorkField") || !Int32.TryParse(kv["WorkField"], out idtag_work_field))
{
return null;
}
//dsCarModelsTableAdapters.CarModelsTableAdapter modelAdapter = new dsCarModelsTableAdapters.CarModelsTableAdapter();
//dsCarModels.CarModelsDataTable models = modelAdapter.GetModelsByCarId(makeId);
DSContactTableAdapters.tag_OccupTableAdapter GetOccupAdapter = new DSContactTableAdapters.tag_OccupTableAdapter();
DSContact.tag_OccupDataTable Occups = GetOccupAdapter.GetByOccup_ID(idtag_work_field);
//
List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
foreach (DataRow dr in Occups)
{
values.Add(new CascadingDropDownNameValue((string)dr["Occup_Name"], dr["idtag_Occup"].ToString()));
}
return values.ToArray();
}
[WebMethod]
public CascadingDropDownNameValue[] GetSubOccup(string knownCategoryValues, string category)
{
StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
int idtag_Occup;
if (!kv.ContainsKey("Occup") || !Int32.TryParse(kv["Occup"], out idtag_Occup))
{
return null;
}
//dsModelColorsTableAdapters.ModelColorsTableAdapter adapter = new dsModelColorsTableAdapters.ModelColorsTableAdapter();
//dsModelColors.ModelColorsDataTable colors = adapter.GetColorsByModelId(colorId);
DSContactTableAdapters.tag_Sub_OccupTableAdapter GetSubOccupAdapter = new DSContactTableAdapters.tag_Sub_OccupTableAdapter();
DSContact.tag_Sub_OccupDataTable SubOccups = GetSubOccupAdapter.GetDataBy_Sub_Occup_ID(idtag_Occup);
List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
foreach (DataRow dr in SubOccups)
{
values.Add(new CascadingDropDownNameValue((string)dr["Sub_Occup_Name"], dr["idtag_Sub_Occup"].ToString()));
}
return values.ToArray();
}
更新:
my master page
...................................
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Master.master.cs" Inherits="IMAM_APPLICATION.Master" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<%--<asp:ScriptManager ID="ScriptManager1" runat="server" />--%>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
</div>
<div>
<table class="style1" frame="vSides">
<tr>
<td class="style17" bgcolor="#FFFF99">
</td>
<td class="style18" style="">
<img alt="" src="Images/banner1.gif"
style="width: 950px; height: 89px; margin-bottom: 0px;" /></td>
<td class="style17" bgcolor="#FFFF99">
</td>
</tr>
<tr>
<td class="style15">
</td>
<td class="style16" bgcolor="#FFFF99">
<asp:Menu ID="Menu1" runat="server" Width="44px" Orientation="Horizontal"
DataSourceID="SiteMapDataSource1" BackColor="#FFFBD6"
DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="0.8em"
ForeColor="#990000" StaticDisplayLevels="2" StaticSubMenuIndent="10px">
<StaticMenuStyle BorderStyle="Dotted" />
<StaticSelectedStyle BackColor="#FFCC66" />
<StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
<DynamicHoverStyle BackColor="#990000" ForeColor="White" />
<DynamicMenuStyle BackColor="#FFFBD6" />
<DynamicItemTemplate>
<%# Eval("Text") %>
</DynamicItemTemplate>
<DynamicSelectedStyle BackColor="#FFCC66" />
<DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
<StaticHoverStyle BackColor="#990000" ForeColor="White" />
<StaticItemTemplate>
<%# Eval("Text") %>
</StaticItemTemplate>
</asp:Menu>
</td>
<td class="style15">
</td>
</tr>
<tr>
<td class="style19" bgcolor="#FFFF99">
</td>
<td class="style20">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</td>
<td class="style19" bgcolor="#FFFF99">
</td>
</tr>
<tr>
<td class="style7">
</td>
<td class="style8" style="" bgcolor="#FFFF99">
Copyright Imam Mahdi Association of Marjeya</td>
<td class="style7">
</td>
</tr>
</table>
</div>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
</form>
</body>
</html>
Greetings,
I have a problem to use selected value propriety of CascadingDropDown.
I have 3 asp dropdown controls with ajax CascadingDropDown for each one of them.
I have no problem to bind data to the 3 CascadingDropDown but my problem is to rebind CascadingDropDown.
simply what I want to do is to select a record from Gridview which has the selected values for the CascadingDropDown that I want to pass then rebind the CascadingDropDown with selected value.
I'm posting my code down which include:
1-ASP.NET code.
2-Code behind to handle selected record from grid view.
3- web servisice that handle binding data to the 3 CascadingDropDown.
please advice how to rebind data to CascadingDropDown with selected value.
by the way I used selected value proprety as showning in my code but it is not working and there is no error.
Thank you,
........................
ASP.NET code
........................
<%@ Page Title="" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="IMAM_APPLICATION.WebForm1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="idcontact_info" DataSourceID="ObjectDataSource1"
onselectedindexchanged="GridView1_SelectedIndexChanged">
<Columns>
<asp:CommandField ShowSelectButton="True" />
<asp:BoundField DataField="idcontact_info" HeaderText="idcontact_info"
InsertVisible="False" ReadOnly="True" SortExpression="idcontact_info" />
<asp:BoundField DataField="Work_Field" HeaderText="Work_Field"
SortExpression="Work_Field" />
<asp:BoundField DataField="Occupation" HeaderText="Occupation"
SortExpression="Occupation" />
<asp:BoundField DataField="sub_Occupation" HeaderText="sub_Occupation"
SortExpression="sub_Occupation" />
</Columns>
</asp:GridView>
<asp:Label ID="lbl" runat="server" Text="Label"></asp:Label>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
DeleteMethod="Delete" InsertMethod="Insert"
OldValuesParameterFormatString="original_{0}" SelectMethod="GetData"
TypeName="IMAM_APPLICATION.DSContactTableAdapters.contact_infoTableAdapter"
UpdateMethod="Update">
<DeleteParameters>
<asp:Parameter Name="Original_idcontact_info" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="Work_Field" Type="String" />
<asp:Parameter Name="Occupation" Type="String" />
<asp:Parameter Name="sub_Occupation" Type="String" />
<asp:Parameter Name="Original_idcontact_info" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="Work_Field" Type="String" />
<asp:Parameter Name="Occupation" Type="String" />
<asp:Parameter Name="sub_Occupation" Type="String" />
</InsertParameters>
</asp:ObjectDataSource>
<asp:DropDownList ID="cmbWorkField" runat="server" Style="top: 715px; left: 180px;
position: absolute; height: 22px; width: 126px">
</asp:DropDownList>
<asp:DropDownList runat="server" ID="cmbOccupation" Style="top: 745px; left: 180px;
position: absolute; height: 22px; width: 77px">
</asp:DropDownList>
<asp:DropDownList ID="cmbSubOccup" runat="server"
style="position:absolute; top: 775px; left: 180px;">
</asp:DropDownList>
<cc1:CascadingDropDown ID="cmbWorkField_CascadingDropDown" runat="server"
TargetControlID="cmbWorkField"
Category="WorkField"
LoadingText="Please Wait ..."
PromptText="Select Wor kField ..."
ServiceMethod="GetWorkField"
ServicePath="ServiceTags.asmx">
</cc1:CascadingDropDown>
<cc1:CascadingDropDown ID="cmbOccupation_CascadingDropDown" runat="server"
TargetControlID="cmbOccupation"
Category="Occup"
LoadingText="Please wait..."
PromptText="Select Occup ..."
ServiceMethod="GetOccup"
ServicePath="ServiceTags.asmx"
ParentControlID="cmbWorkField">
</cc1:CascadingDropDown>
<cc1:CascadingDropDown ID="cmbSubOccup_CascadingDropDown" runat="server"
Category="SubOccup"
Enabled="True"
LoadingText="Please Wait..."
ParentControlID="cmbOccupation"
PromptText="Select Sub Occup"
ServiceMethod="GetSubOccup"
ServicePath="ServiceTags.asmx"
TargetControlID="cmbSubOccup">
</cc1:CascadingDropDown>
</asp:Content>
......................................................
C# code behind
......................................................
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
string strg = GridView1.SelectedDataKey["idcontact_info"].ToString();
int index = Convert.ToInt32(GridView1.SelectedDataKey["idcontact_info"].ToString());
//txtSearch.Text = GridView1.SelectedIndex.ToString();
// txtSearch.Text = GridView1.SelectedDataKey["idcontact_info"].ToString();
DSContactTableAdapters.contact_infoTableAdapter GetByIDAdapter = new DSContactTableAdapters.contact_infoTableAdapter();
DSContact.contact_infoDataTable ByID = GetByIDAdapter.GetDataByID(index);
//DSSearch.contact_infoDataTable FirstName = FirstNameAdapter.GetDataByFirstNameList(prefixText);
foreach (DataRow dr in ByID.Rows)
{
lbl.Text = dr["Work_Field"].ToString() + "....." + dr["Occupation"].ToString() + "....." + dr["sub_Occupation"].ToString();
cmbWorkField_CascadingDropDown.SelectedValue = dr["Work_Field"].ToString();
cmbOccupation_CascadingDropDown.SelectedValue = dr["Occupation"].ToString();
cmbSubOccup_CascadingDropDown.SelectedValue = dr["sub_Occupation"].ToString();
}
}
.......................................................
web Service
.......................................................
[WebMethod]
public CascadingDropDownNameValue[] GetWorkField(string knownCategoryValues, string category)
{
//dsCarsTableAdapters.CarsTableAdapter makeAdapter = new dsCarsTableAdapters.CarsTableAdapter();
//dsCars.CarsDataTable makes = makeAdapter.GetAllCars();
DSContactTableAdapters.tag_work_fieldTableAdapter GetWorkFieldAdapter = new DSContactTableAdapters.tag_work_fieldTableAdapter();
DSContact.tag_work_fieldDataTable WorkFields = GetWorkFieldAdapter.GetDataByGetWorkField();
List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
foreach (DataRow dr in WorkFields)
{
string Work_Field = (string)dr["work_Field_name"];
int idtag_work_field = (int)dr["idtag_work_field"];
values.Add(new CascadingDropDownNameValue(Work_Field, idtag_work_field.ToString()));
}
return values.ToArray();
}
[WebMethod]
public CascadingDropDownNameValue[] GetOccup(string knownCategoryValues, string category)
{
StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
int idtag_work_field;
if (!kv.ContainsKey("WorkField") || !Int32.TryParse(kv["WorkField"], out idtag_work_field))
{
return null;
}
//dsCarModelsTableAdapters.CarModelsTableAdapter modelAdapter = new dsCarModelsTableAdapters.CarModelsTableAdapter();
//dsCarModels.CarModelsDataTable models = modelAdapter.GetModelsByCarId(makeId);
DSContactTableAdapters.tag_OccupTableAdapter GetOccupAdapter = new DSContactTableAdapters.tag_OccupTableAdapter();
DSContact.tag_OccupDataTable Occups = GetOccupAdapter.GetByOccup_ID(idtag_work_field);
//
List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
foreach (DataRow dr in Occups)
{
values.Add(new CascadingDropDownNameValue((string)dr["Occup_Name"], dr["idtag_Occup"].ToString()));
}
return values.ToArray();
}
[WebMethod]
public CascadingDropDownNameValue[] GetSubOccup(string knownCategoryValues, string category)
{
StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
int idtag_Occup;
if (!kv.ContainsKey("Occup") || !Int32.TryParse(kv["Occup"], out idtag_Occup))
{
return null;
}
//dsModelColorsTableAdapters.ModelColorsTableAdapter adapter = new dsModelColorsTableAdapters.ModelColorsTableAdapter();
//dsModelColors.ModelColorsDataTable colors = adapter.GetColorsByModelId(colorId);
DSContactTableAdapters.tag_Sub_OccupTableAdapter GetSubOccupAdapter = new DSContactTableAdapters.tag_Sub_OccupTableAdapter();
DSContact.tag_Sub_OccupDataTable SubOccups = GetSubOccupAdapter.GetDataBy_Sub_Occup_ID(idtag_Occup);
List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
foreach (DataRow dr in SubOccups)
{
values.Add(new CascadingDropDownNameValue((string)dr["Sub_Occup_Name"], dr["idtag_Sub_Occup"].ToString()));
}
return values.ToArray();
}
UPDATE:
my master page
...................................
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Master.master.cs" Inherits="IMAM_APPLICATION.Master" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<%--<asp:ScriptManager ID="ScriptManager1" runat="server" />--%>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
</div>
<div>
<table class="style1" frame="vSides">
<tr>
<td class="style17" bgcolor="#FFFF99">
</td>
<td class="style18" style="">
<img alt="" src="Images/banner1.gif"
style="width: 950px; height: 89px; margin-bottom: 0px;" /></td>
<td class="style17" bgcolor="#FFFF99">
</td>
</tr>
<tr>
<td class="style15">
</td>
<td class="style16" bgcolor="#FFFF99">
<asp:Menu ID="Menu1" runat="server" Width="44px" Orientation="Horizontal"
DataSourceID="SiteMapDataSource1" BackColor="#FFFBD6"
DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="0.8em"
ForeColor="#990000" StaticDisplayLevels="2" StaticSubMenuIndent="10px">
<StaticMenuStyle BorderStyle="Dotted" />
<StaticSelectedStyle BackColor="#FFCC66" />
<StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
<DynamicHoverStyle BackColor="#990000" ForeColor="White" />
<DynamicMenuStyle BackColor="#FFFBD6" />
<DynamicItemTemplate>
<%# Eval("Text") %>
</DynamicItemTemplate>
<DynamicSelectedStyle BackColor="#FFCC66" />
<DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
<StaticHoverStyle BackColor="#990000" ForeColor="White" />
<StaticItemTemplate>
<%# Eval("Text") %>
</StaticItemTemplate>
</asp:Menu>
</td>
<td class="style15">
</td>
</tr>
<tr>
<td class="style19" bgcolor="#FFFF99">
</td>
<td class="style20">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</td>
<td class="style19" bgcolor="#FFFF99">
</td>
</tr>
<tr>
<td class="style7">
</td>
<td class="style8" style="" bgcolor="#FFFF99">
Copyright Imam Mahdi Association of Marjeya</td>
<td class="style7">
</td>
</tr>
</table>
</div>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
</form>
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
简单的;设置
CascadingDropDown
控件的SelectedValue
属性,而不是DropDown
控件。它对我有用。例如。
CascadingDropDown1.SelectedValue = "KY"
Simple; set the
SelectedValue
property ofCascadingDropDown
control, instead ofDropDown
control. It's working for me.Eg.
CascadingDropDown1.SelectedValue = "KY"
我有同样的问题。作为解决方法,我只是使用 PromptText 属性绑定到数据库中的值。希望有帮助!
I have the same problem. As a workaround, I just used the PromptText property to bind to the value in the database. Hope it helps!
尝试使用此代码在 GridView 内进行级联下拉列表...
Try this code for cascading dropdown inside GridView...
我认为我将寻找替代解决方案,将数据绑定到标签,如果我想更新值,我将使用 CascadingDropDown。
I think that I will look for alternative solution which will bind the data to labels and if I want to update the value I will use CascadingDropDown.