asp.net - class icon in gridView column using VB.net -


i have 1 gridview , have css class called class="icon-p". want use class in gridview column "modify", except using buttontype="image" , imageurl..`

here gridview code:

<asp:gridview id="gridview2" runat="server" autogeneratecolumns="false"         cssclass="table" datakeynames="id_s" datasourceid="sqldatasource1">     <columns>         ..         <asp:commandfield canceltext="cancel" deletetext="delete" edittext="update" headertext="modify" showeditbutton="true" showheader="true" buttontype="image"/>     </columns> </asp:gridview> 

right click on gridview in design view go edit columns.

find commandfield , click blue hyperlink @ bottom says "convert template".

exit out , go markup , find individual controls there , can @ them set cssclass etc. thing makes update button commandname="update" attribute.

this article here details conversion steps trying explain:

you left this:

<asp:templatefield showheader="false">                      <itemtemplate>                          <asp:linkbutton id="linkbutton1" runat="server" causesvalidation="false" visible='<%# getshoweditbutton() %>'                              commandname="edit" text="edit"></asp:linkbutton>                          &nbsp;<asp:linkbutton id="linkbutton2" runat="server" causesvalidation="false" visible='<%# getshowinsertbutton() %>'                              commandname="new" text="new"></asp:linkbutton>                          &nbsp;<asp:linkbutton id="linkbutton3" runat="server" causesvalidation="false"                               commandname="delete" text="delete" visible='<%# getshowdeletebutton() %>'     ></asp:linkbutton>                      </itemtemplate> </asp:templatefield> 

you can set cssclass example:

<asp:linkbutton id="linkbutton1" runat="server" causesvalidation="false"  visible='<%# getshoweditbutton() %>' commandname="edit" text="edit" cssclass="icon-p"></asp:linkbutton> 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -