David Rudlin
asked on
How to pass gridview button commandargument to jquery dialog
In an asp.net 3.5 website I have a gridview with an imagebutton on each row. The imagebutton onclick opens a jquery dialog.
How can I pass the imagebutton commandargument to the jquery dialog to be stored there in a hidden field?
Any help would be much appreciated.
Basic code is as follows:
<asp:GridView ID="dgMap" runat="server" AllowSorting="True" AutoGenerateColumns="False "......... .......... .....
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="imgbtnViewDialog" runat="server" ImageAlign="Middle" ImageUrl="~/images/copy.gi f" CommandArgument="<%# Container.DataItemIndex %>"
CssClass="imgbtnViewDialog Class" />
</ItemTemplate>
</asp:TemplateField>
...............</asp:GridV iew>
'CSS to open jquery dialog:
$('.imgbtnViewDialogClass' ).click(fu nction () {
$('#dialog-form').dialog(' open');
return false;
});
How can I pass the imagebutton commandargument to the jquery dialog to be stored there in a hidden field?
Any help would be much appreciated.
Basic code is as follows:
<asp:GridView ID="dgMap" runat="server" AllowSorting="True" AutoGenerateColumns="False
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton ID="imgbtnViewDialog" runat="server" ImageAlign="Middle" ImageUrl="~/images/copy.gi
CssClass="imgbtnViewDialog
</ItemTemplate>
</asp:TemplateField>
...............</asp:GridV
'CSS to open jquery dialog:
$('.imgbtnViewDialogClass'
$('#dialog-form').dialog('
return false;
});
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
However you may want to use .prop rather than attr OR consider using the
data-xxxx notation and then .data("xxxx") to get it
data-xxxx notation and then .data("xxxx") to get it
ASKER
Thank you mplungjan. That is useful additional information.
ASKER
AlternateText='<%# Eval("eventID")%>'
Thanks again.