使用PopUpExtender的ASP.NET GridView [英] ASP.NET GridView With PopUpExtender

查看:71
本文介绍了使用PopUpExtender的ASP.NET GridView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我有一个从数据库填充的网格视图。

i填充它以编程方式我制作2个绑定列和一个模板字段。
模板字段按钮图像中的
当点击时填充ajax模型PopUp扩展器来编辑行。

如何填充模板字段中的弹出窗口?

如何将ajax模型弹出窗口连接到btn图像中我的意思是模板字段。

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.

推荐答案

您好,

请按照以下链接:



http ://www.aspsnippets.com/Articles/Add-Edit-Update-Records-in-GridView-using-Modal-Popup-in-ASP.Net.aspx [ ^ ]



http://www.aspdotnet-suresh.com/2011/03/how-to-show-modalpopup-to-edit-gridview.html [< a href =http://www.aspdotnet-suresh.com/2011/03/how-to-show-modalpopup-to-edit-gridview.htmltarget =_ blanktitle =New Window> ^ ]
Hello,
Please follow this given link:

http://www.aspsnippets.com/Articles/Add-Edit-Update-Records-in-GridView-using-Modal-Popup-in-ASP.Net.aspx[^]

http://www.aspdotnet-suresh.com/2011/03/how-to-show-modalpopup-to-edit-gridview.html[^]


//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();
            }
        }


这篇关于使用PopUpExtender的ASP.NET GridView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆