c# - How to add if-else statement to change BoundFields of GridView -
i trying code below:
<%= if(ddlchoice.selecteditem.value ==1) { %> <asp:boundfield datafield="firstname" headertext="first name"> <headerstyle horizontalalign="left" /></asp:boundfield> <asp:boundfield datafield="lastname" headertext="last name"> <headerstyle horizontalalign="left" /></asp:boundfield> <%= } else { %>> <asp:boundfield datafield="name" headertext="name"> <headerstyle horizontalalign="left" /></asp:boundfield> <%= } %>
i have gridview
, want add if-else condition change available boundfield
s according selected item in dropdownlist
... please guide me !!!
in short: cannot place if
statement between boundfield
s trying do.
as alternative solution, change visible
property of each boundfield
either code behind or setting boolean value attribute in .aspx file.
another alternative solution have more 1 gridview
, change visibility upon user selection.
Comments
Post a Comment