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 boundfields according selected item in dropdownlist... please guide me !!!

in short: cannot place if statement between boundfields 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

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -