G
Guest
Hi,
I am using DropDownList. Then, I am adding the DropDownList item from the
database and it is work. When I check the value of the items in the
Page_Load, it is appear without problem. The problem appears when
SelectedIndexChanged is active; the value of the item is always "1".
This is ASP.NET code:
<asp
ropDownList id="categoryDropDownList" runat="server"
DataTextField="name" DataValueField="id"></asp
ropDownList>
and this is my C# code (code behind):
private void Page_Load(object sender, System.EventArgs e) {
// Put user code to initialize the page here
DataTable categoryDataTable = sweCategory.SelectAll();
categoryDropDownList.DataSource = categoryDataTable;
categoryDropDownList.DataBind();
}
....
....
....
private void categoryDropDownList_SelectedIndexChanged(object sender,
System.EventArgs e) {
SqlString categoryId = categoryDropDownList.SelectedItem.Value;
this.addItemPanel.Visible = false;
this.doneLabel.Text = categoryId.ToString();
}
Any help please ?!?
Thanks
I am using DropDownList. Then, I am adding the DropDownList item from the
database and it is work. When I check the value of the items in the
Page_Load, it is appear without problem. The problem appears when
SelectedIndexChanged is active; the value of the item is always "1".
This is ASP.NET code:
<asp

DataTextField="name" DataValueField="id"></asp

and this is my C# code (code behind):
private void Page_Load(object sender, System.EventArgs e) {
// Put user code to initialize the page here
DataTable categoryDataTable = sweCategory.SelectAll();
categoryDropDownList.DataSource = categoryDataTable;
categoryDropDownList.DataBind();
}
....
....
....
private void categoryDropDownList_SelectedIndexChanged(object sender,
System.EventArgs e) {
SqlString categoryId = categoryDropDownList.SelectedItem.Value;
this.addItemPanel.Visible = false;
this.doneLabel.Text = categoryId.ToString();
}
Any help please ?!?
Thanks