how to fill gridview with checkboxes in asp.net using vb -


i have gridview pregenerated columns

<asp:gridview id="gridview1" runat="server" autogeneratecolumns="false"              backcolor="white" bordercolor="#336666" borderstyle="double" borderwidth="3px"              cellpadding="4" gridlines="horizontal">             <rowstyle backcolor="white" forecolor="#333333" />             <columns>                 <asp:templatefield headertext="menuid" >                     <itemtemplate>                         <asp:label id="label1" runat="server" text='<%# bind("menuid") %>'></asp:label>                     </itemtemplate>                 </asp:templatefield>                 <asp:templatefield headertext="menuparentid" >                     <itemtemplate>                         <asp:label id="label2" runat="server" text='<%# bind("menuparentid") %>' ></asp:label>                     </itemtemplate>                 </asp:templatefield>                 <asp:templatefield headertext="particulars">                     <itemtemplate>                         <asp:label id="label3" runat="server" text='<%# bind("particulars") %>'></asp:label>                     </itemtemplate>                     <itemstyle width="250px" />                 </asp:templatefield>                 <asp:boundfield datafield="options" headertext="options"                      itemstyle-horizontalalign="center" > <itemstyle horizontalalign="center"></itemstyle>                 </asp:boundfield>                 <asp:templatefield headertext="menu(m)" >                     <itemtemplate>                         <asp:checkbox id="chkmenu" runat="server" oncheckedchanged="chkmenu_checkedchanged" />                     </itemtemplate>                 </asp:templatefield>                 <asp:templatefield headertext="add(a)">                     <itemtemplate>                         <asp:checkbox id="chkadd" runat="server" />                     </itemtemplate>                 </asp:templatefield>                 <asp:templatefield headertext="edit(e)">                     <itemtemplate>                         <asp:checkbox id="chkedit" runat="server" />                     </itemtemplate>                 </asp:templatefield>                 <asp:templatefield headertext="delete(d)">                     <itemtemplate>                         <asp:checkbox id="chkdelete" runat="server" />                     </itemtemplate>                 </asp:templatefield>             </columns>             <footerstyle backcolor="white" forecolor="#333333" />             <pagerstyle backcolor="#336666" forecolor="white" horizontalalign="center" />             <selectedrowstyle backcolor="#339966" font-bold="true" forecolor="white" />             <headerstyle backcolor="#336666" font-bold="true" forecolor="white" />         </asp:gridview> 

want fill grid database , check/uncheck checkboxes database condition. how fill gridview ...................................................................................

on condition want check /un-check chechbox?

you can write code on rowdatabound event of grid.

void customersgridview_rowdatabound(object sender, gridviewroweventargs e) {

if(e.row.rowtype == datacontrolrowtype.datarow) {    // here  check condition , find check box of current row , set checked/uncheked  } 

}


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -