I have a ModalPopup
in the ItemTemplate
of a GridView
like
<ItemTemplate>
<asp:LinkButton ID="lnkbtnSeek" CommandArgument='<%# Eval("ID") %>' runat="server" Text= "Info" CommandName="Seek" />
<asp:Panel ID="pnlProject" runat="server" Style="display: none" CssClass="ModalPopupPa开发者_高级运维nel">
<div style="float: right;">
<asp:LinkButton ID="lnkClose" runat="server" Text="Close" />
</div>
<asp:Label ID="lblDescription" runat="server" Text="Give Description" /><br /><br />
<asp:TextBox ID="txtDescription" runat="server" Height="150px" Width="100%" TextMode="MultiLine" />
<br />
<asp:Button ID="btnSubmit" OnClientClick="<% %>" runat="server" Text="Submit" CommandArgument='<%# Eval("Id") %>' OnCommand="btnSubmit_Click" />
</asp:Panel>
<asp:ModalPopupExtender id="extProject" runat="server" targetcontrolid="lnkbtnSeek" popupcontrolid="pnlProject" dropshadow="true" backgroundcssclass="ModalPopupBackground" cancelcontrolid="lnkClose" />
</ItemTemplate>
Now when click on btnsubmit
I want to get the txtDescription
value in button command event. Else every thing is working fine. On pressing Info Linkbutton I am able to popup the modal popup and on button click able to do the work(else that textbox data). Also only able to call Gridview_RowCreated event not others even Gridview_RowCommand event is not firing.
But events I don't need if I can get the value of that txtbox in somewhere.
How to get that?
Thanks.
Inside of your btnSubmit_Click event, you have the particular button that was clicked:
Button btnSubmit = (Button)sender;
Then you can navigate from there
TextBox txtDescription = btnSubmit.Parent.FindControls("txtDescription") as TextBox;
You must pass refernce in when you open the dialog:
var vReturn = window.showModalDialog(<url here>, self, <features here>);
In your modal dialog page have the following code:
var opener = window.dialogArguments;
精彩评论