Click here to Skip to main content
15,922,894 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Sir want to ask u that in grid view i have 3 field and in one field i want to show image for that can i use simple html image button and bind it as we bind the asp image button. plz reply...
Posted

Yes, of course. You just need to create your own template to emit the HTML that you require.
 
Share this answer
 
Hi is it possible to bind any one image button but if u have any event raising on that button u may create asp or html . if u add html give it run at server b'coz u must identify which event clinck if u wrinte in rowcommand event even that aslo u can keep in image button(asp/html) commandname and commandArgument so better to use asp in that we can create event and access in code behind also.
see the example

<asp:GridView ID="GridView1" ShowFooter="true" SkinID="GridView" runat="server" Width="100%" ToolTip="FoodCalender"
Visible="true" OnRowCommand="GridView1_RowCommand1" OnPageIndexChanging="GridView1_PageIndexChanging" DataKeyNames="intFoodCalendarId" >
<Columns>
<asp:TemplateField HeaderText="FoodCalendar Id">
<ItemTemplate>

<asp:Label ID="LblCalendar" runat="server" Text='<%# Eval("intFoodCalendarId")%>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" />
<HeaderStyle HorizontalAlign="Left" />
</asp:TemplateField>

<asp:TemplateField HeaderText="Dates">
<ItemTemplate>

<asp:Label ID="LblDate" runat="server" Text='<%# Eval("Dates","{0:d}")%>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" />
<HeaderStyle HorizontalAlign="Left" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Day">
<ItemTemplate>

<asp:Label ID="LblDay" runat="server" Text='<%# Eval("Day")%>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" />
<HeaderStyle HorizontalAlign="Left" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Serving Type">
<ItemTemplate>
<asp:Label ID="Lblservingtype" runat="server" Text='<%# Eval("ServingName")%>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" />
<HeaderStyle HorizontalAlign="Left" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Food Item Name">
<ItemTemplate>
<asp:Label ID="Lblfoodname" runat="server" Text='<%# Eval("ItemNames")%>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" />
<HeaderStyle HorizontalAlign="Left" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Edit">
<ItemTemplate>
<asp:ImageButton ID="imgEdit" runat="server" SkinID="EditButton" CommandArgument='<%#Eval("ItemNames")%>'
CommandName="EditFoodCalender" />

</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>

<asp:TemplateField>
<HeaderTemplate>
<input id="chkAll" onclick="javascript:SelectAllCheckboxes(this);" runat="server" type="checkbox" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chk" AutoPostBack="false" runat="server" />
</ItemTemplate>

<FooterTemplate>
<asp:Button ID="btnDelete" runat="server" Font-Size="10pt" OnClick="btnDelete_OnClick" CommandName="Delete" ToolTip="Removes any items that where checked" Text="Delete" />
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900