Ajax Modal弹出控件 [英] Ajax Modal Pop up control

查看:115
本文介绍了Ajax Modal弹出控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用gridview,我正在使用ajax模式弹出扩展器编辑其中的数据。

当我点击编辑按钮时,事件不会第一次被触发。

事件仅在第二次点击时被解雇。



这是我的aspx代码。

< ; asp:TemplateField HeaderText =编辑>

< itemtemplate>

< asp:ImageButton ID =imgbtnImageUrl =〜/ image / Edit。 jpgrunat =serverWidth =25

Height =25OnClick =imgbtn_ClickCausesValidation =false/>







这是Modal Popup的代码



< asp:ModalPopupExtender ID = ModalPopupExtender1runat =serverTargetControlID =btnShowPopup

PopupControlID =pnlpopupCancelControlID =btnCancelBackgroundCssClass =modalBackground>



< asp:Panel ID =pnlpopuprunat =serverBackColor =WhiteHeight =269pxWidth =400px

Style =display:none>



cellpadding =0cellspacing =0>

< tr id = tr1runat =servervisible =false>



align =center>

Fuel Master

UserId:

< asp:Label ID =lblIDrunat =server>

用户名:

< asp:TextBox ID =txtfnamerunat =服务器/>

< asp:Button ID =btnUpdateCommandName =Updaterunat =serverText =UpdateOnClick =btnUpdate_Click/>

< asp:Button ID =btnCancelrunat =serverText =Cancel/ >







这是我点击按钮的aspx.cs代码事件。



protected void imgbtn_Click(object sender,ImageClickEventArgs e)

{

ImageButton btndetails = sender as ImageButton;

GridViewRow gvrow =(GridViewRow)btndetails.NamingContainer;

lblID.Text = gvdetails.DataKeys [gvrow.RowIndex ] .Value.ToString();

txtfname.Text = gvrow.Cells [1] .Text;

this.ModalPopupExtender1.Show();

}



请帮我解决这个问题?

I am having a gridview and I am editing the data in it using ajax modal pop up extender.
When I am clicking the edit button the event is not getting fired the first time.
The event is getting fired only on the 2nd click.

This is my aspx code.
<asp:TemplateField HeaderText="Edit">
<itemtemplate>
<asp:ImageButton ID="imgbtn" ImageUrl="~/image/Edit.jpg" runat="server" Width="25"
Height="25" OnClick="imgbtn_Click" CausesValidation="false" />



This is code for Modal Popup

<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btnShowPopup"
PopupControlID="pnlpopup" CancelControlID="btnCancel" BackgroundCssClass="modalBackground">

<asp:Panel ID="pnlpopup" runat="server" BackColor="White" Height="269px" Width="400px"
Style="display: none">

cellpadding="0" cellspacing="0">
<tr id="tr1" runat="server" visible="false">

align="center">
Fuel Master
UserId:
<asp:Label ID="lblID" runat="server">
Username:
<asp:TextBox ID="txtfname" runat="server" />
<asp:Button ID="btnUpdate" CommandName="Update" runat="server" Text="Update" OnClick="btnUpdate_Click" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" />



This is my aspx.cs code event for the button click.

protected void imgbtn_Click(object sender, ImageClickEventArgs e)
{
ImageButton btndetails = sender as ImageButton;
GridViewRow gvrow = (GridViewRow)btndetails.NamingContainer;
lblID.Text = gvdetails.DataKeys[gvrow.RowIndex].Value.ToString();
txtfname.Text = gvrow.Cells[1].Text;
this.ModalPopupExtender1.Show();
}

Please help me to fix this issue?

推荐答案

嗨...

查看此链接!

ASP.NET AJAX控件工具包ModalPopupExtender控件在行动 [ ^ ]

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

http://chandanprogramming.blogspot.in/2013/05/ajax-modalpopupextender-demo- in-aspnet.html [ ^ ]

http://aspdotnet-learning.blogspot.in/2013/11/ajax-modalpopup-exte nder-example-in.html [ ^ ]

谢谢你。
Hi...
See this links!
ASP.NET AJAX Control Toolkit ModalPopupExtender Control in Action[^]
http://www.aspdotnet-suresh.com/2011/03/how-to-show-modalpopup-to-edit-gridview.html[^]
http://chandanprogramming.blogspot.in/2013/05/ajax-modalpopupextender-demo-in-aspnet.html[^]
http://aspdotnet-learning.blogspot.in/2013/11/ajax-modalpopup-extender-example-in.html[^]
Thank u.


这篇关于Ajax Modal弹出控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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