をgridview.Templateするには、私は、このハイパーリンクのテンプレートをGridViewのを持っている:
<asp:TemplateField HeaderText="Notes" ItemStyle-CssClass="NoMargin NoPadding" SortExpression="lineNotes">
<ItemTemplate>
<asp:HyperLink id="notesHl" runat="server" text='<%# Bind("lineNotes") %>' Font-Underline="true" Font-Bold="true"></asp:HyperLink>
</ItemTemplate>
<ItemStyle Font-Size="Smaller" Height="10px" Width="10px" Wrap="True" />
</asp:TemplateField>
次にjQueryのポップアップ(によって呼び出されたモーダルダイアログを作成します) ;
テストのために$(document).ready(function() {
// increase the default animation speed to exaggerate the effect
$.fx.speeds._default = 1000;
$(function() {
$("#divLineItemComments").dialog({
autoOpen: false,
show: "blind",
hide: "explode",
width: 900,
height: 500
});
});
$("#_ctl0_ContentPlaceHolder1_cwgPhysical__ctl3_notesHl").click(function() {
$("#divLineItemComments").dialog("open");
return false;
});
});
function Popup() {
$("#divLineItemComments").dialog("open");
return false;
}
、私はハードのGridViewの最初のリンクの生成名コード化:ASP.NETは、IDの動的に生成されるため
_ctl0_ContentPlaceHolder1_cwgPhysical__ctl3_notesHl
を、私は動的にバインドする必要がありますハイパーリンクのクリックイベント。これは、ASP.NETで使用されている名前で動作するようにします。私はXXまで生成された名前までハードコードすることができます(そして、彼らは常に同じ名前を生成することを願っています)。これはひどい解決策だと思われます...
クリックをハイパーリンクにバインドするにはどうすればよいですか?
働くかもしれrowboundにフッキングが、私はjQueryのをバインドする方法がわからない、ここで
protected void cwgPhysical_RowDataBound(object sender, GridViewRowEventArgs e)
{
Hyperlink.NavigateUrl = "javascript:Popup();";//this might work somehow...
}
各モーダルは異なるデータを持っているので、また、あなたがLOL – naveen