Dear All
Here is a code for datalist with image / link button control. Also you can get the value of record id when you click on the button under the datalist item
Your Ascx file
<asp:DataList ID="DataList1" runat="server" Width="100%" OnItemCommand="Your_Function_Name">
<ItemTemplate>
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="/DesktopModules/Tarahum Admin CP - Add New Case/images/deleteNew.png" CommandName="del" CommandArgument='<%#Eval ("recID") %>' />
</ItemTemplate>
Note: Command Arugement is the value that you need to pass on button click and command name is a unique name of this control for code behind
**********
Code Behind Function
**********
protected void Your_Function_Name(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "del")
{
string recordID = e.CommandArgument.ToString();
//Do some coding
}
}
I hope it helps you allot
Regards
Rashid Imran Bilgrami
http://www.bestvisualization.com
Here is a code for datalist with image / link button control. Also you can get the value of record id when you click on the button under the datalist item
Your Ascx file
<asp:DataList ID="DataList1" runat="server" Width="100%" OnItemCommand="Your_Function_Name">
<ItemTemplate>
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="/DesktopModules/Tarahum Admin CP - Add New Case/images/deleteNew.png" CommandName="del" CommandArgument='<%#Eval ("recID") %>' />
</ItemTemplate>
Note: Command Arugement is the value that you need to pass on button click and command name is a unique name of this control for code behind
**********
Code Behind Function
**********
protected void Your_Function_Name(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "del")
{
string recordID = e.CommandArgument.ToString();
//Do some coding
}
}
I hope it helps you allot
Regards
Rashid Imran Bilgrami
http://www.bestvisualization.com
Comments
Post a Comment
Thanks for the Comments , Your review will display soon