Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hello, I have a grid view populated from the database.
i populate it Programmatically i make 2 bound columns and one template field.
in the template field button image when clicked populate ajax model PopUp extender to edit the row .
how to populate the pop up from template field ?
how to connect the ajax model popup to the btn image in the template field i mean.
Posted 22-Dec-12 2:43am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

//aspx code
 
//add your model popup css here
 
//your grid
 
<asp:GridView ID="grvLog" runat="server" CssClass="tableMain" AutoGenerateColumns="false">
     <Columns>
        <asp:BoundField DataField="LogTypeName" HeaderText="Log"/>
                <asp:BoundField DataField="Message" HeaderText="Message" />
            <asp:TemplateField HeaderText="Stack Trace" >
                       <ItemTemplate>
                            <asp:LinkButton ID="lnkStackTrace" runat="server" Text="Show Popup" CommandName="Display"></asp:LinkButton>
                       </ItemTemplate>
                </asp:TemplateField>
     </Columns>
</asp:GridView>
 

    <asp:button id="btnHidden" runat="server" text="Button" style="Display:none;"/>
 

//your extender
    <asp:ModalPopupExtender ID="ModalPopup" runat="server"
        OkControlID="btnOkay" TargetControlID="btnHidden" PopupControlID="DivTrace" PopupDragHandleControlID="PopupHeader"
        Drag="true" BackgroundCssClass="ModalPopupBG">
    </asp:ModalPopupExtender>
 

 

 
//code behind aspx.cs
 
    protected void grvLog_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Display")
            {
                GridViewRow row = (GridViewRow)((LinkButton)e.CommandSource).NamingContainer;
                //access the value of your control/ fetch the data from database and fill your pop control here like--
        textboxInPopup.Text = ((TextBox)row.FindControl("txtYourTextBox")).Text;
                ModalPopup.Show();
            }
        }
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web01 | 2.8.141022.2 | Last Updated 24 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100