DetailsView Get value of dropdown ,chechbox in template
/*If your development speed slowed down because
you are having hard time getting values out
of DetailsView control then check the following code
which allows you to get value from any control and
even dropdownlist control inside the template inside detailsview */
string textfield1Value=
((TextBox)(DetailsView1.Rows[0].Cells[1].Controls[0])).Text.ToString();
/*you might want to verify that if it has been
cast properly in TextBox or not by putting in try catch*/
DropDownList dl = (DropDownList)DetailsView1.FindControl("DropDownList1");
/* you can put checks like if dl not null etc */
string dropdownselectionValue = cbox.SelectedValue.ToString();
0 comments:
Post a Comment