Click here to Skip to main content
12,998,483 members (129,269 online)
Rate this:
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
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">
        <asp:BoundField DataField="LogTypeName" HeaderText="Log"/>
                <asp:BoundField DataField="Message" HeaderText="Message" />
            <asp:TemplateField HeaderText="Stack Trace" >
                            <asp:LinkButton ID="lnkStackTrace" runat="server" Text="Show Popup" CommandName="Display"></asp:LinkButton>

    <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">


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

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170622.1 | Last Updated 24 Dec 2012
Copyright © CodeProject, 1999-2017
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