views:

38

answers:

2

Hi,

I am having a modal pop in Item Template of a gridview

like

    <ItemTemplate>
                                <asp:LinkButton ID="lnkbtnSeek" CommandArgument='<%# Eval("ID") %>' runat="server" Text= "Info" CommandName="Seek"></asp:LinkButton>
                            <asp:Panel ID="pnlProject" runat="server" Style="display: none" 
                                CssClass="ModalPopupPanel">
                                    <div style="float: right;">
                                        <asp:LinkButton ID="lnkClose" runat="server">Close</asp:LinkButton>
                                    </div>

                                    <asp:Label ID="lblDescription" runat="server" Text="Give Description" /><br />
                                    <br />
                                    <asp:TextBox ID="txtDescription" runat="server" Height="150px" Width="100%" TextMode="MultiLine"></asp:TextBox>
                                    <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 On click on btnsubmit I want to get the textbox(txtDiscription) 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.

A: 

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;
JustLoren
awesome. It worked. I didn't saw that Parent property.Nice and Thanks a lot.
Nits
Mark as accepted, then? :)
JustLoren
sure buddy, It really helped
Nits
A: 

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;
Saurabh