弹出数据使用Jquerry和gridview中的linkbutton [英] Popup data using Jquerry with linkbutton in gridview

查看:51
本文介绍了弹出数据使用Jquerry和gridview中的linkbutton的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户单击gridview中的linkbutton时,我想弹出所选行的数据。但它现在不能正常工作,请帮我解决这个问题。

gridview中的Linkbutton:

I want to popup data of selected row when user click the linkbutton inside the gridview. But its not working properly now, please help me to solve this.
Linkbutton in gridview:

<asp:TemplateField ShowHeader="False">
<ItemTemplate>                      
<asp:LinkButton ID="LinkButton1" CausesValidation="false"  runat="server" Text="Edit" OnClick="lnkapprove_Click"></asp:LinkButton>                       
</ItemTemplate>
</asp:TemplateField>



< b> lnkapprove_Click


lnkapprove_Click

protected void lnkapprove_Click(object sender, EventArgs e)
   {
       GridViewRow row = (GridViewRow)btn.NamingContainer;
       int selectedIndexInPage = Convert.ToInt32(row.RowIndex);
       int pagesize = GridView1.PageSize;
       int pageindex = GridView1.PageIndex;
       int i = selectedIndexInPage + pageindex * pagesize;
       CurrentCard = CurrentDataTable.Clone();
       CurrentCard.ImportRow(CurrentDataTable.Rows[i]);
       //Bind data to the hidden Div
       imgR1.ImageUrl = Page.ResolveUrl(CurrentCard.Rows[0]["picUrl"].ToString().Trim());
       txtPicR1.Text = CurrentCard.Rows[0]["picUrl"].ToString().Trim();
       imgR4.ImageUrl = CurrentCard.Rows[0]["picR4"].ToString().Trim();
       txtPicR4.Text = Page.ResolveUrl(CurrentCard.Rows[0]["picR4"].ToString().Trim());
       txtName.Text = CurrentCard.Rows[0]["name"].ToString().Trim();

   }



Jquerry:


Jquerry:

$('[id*="LinkButton1"]').click(function (event) {
                 loading();
                 setTimeout(function () { // then show popup, deley in .5 second
                     loadPopup(); // function show popup
                 }, 500); // .5 second
                 return false;
             });





使用上面的jquerry函数,它确实显示弹出窗口而没有触发lnkapprove_Click事件。

if我删除



With above jquerry function, it does show popup without trigger lnkapprove_Click event.
if i remove

return false;

或设置它是真的,弹出窗口显示第一但没有任何数据然后在页面完全加载后关闭。

所以我想在页面完全加载后,它将执行jquerry以后正确显示弹出的数据。

请帮我解决这个问题,谢谢:)。

or set its to true, the popup show first but without any data then close after page completely loaded.
So i want to after page completely loaded it will execute the jquerry later to properly display the popup with data.
Please help me to solve this, thanks :).

推荐答案

' [id * =LinkBut​​ton1]')。click( function (event){
loading();
setTimeout( function (){ // 然后显示弹出窗口,deley在.5秒
loadPopup() ; // function show popup
}, 500 ); // .5秒
return false ;
});
('[id*="LinkButton1"]').click(function (event) { loading(); setTimeout(function () { // then show popup, deley in .5 second loadPopup(); // function show popup }, 500); // .5 second return false; });





使用上面的jquerry函数,它确实显示弹出窗口而没有触发lnkapprove_Click事件。

if我删除



With above jquerry function, it does show popup without trigger lnkapprove_Click event.
if i remove

return false;

或设置它是真的,弹出窗口显示第一但没有任何数据然后在页面完全加载后关闭。

所以我想在页面完全加载后,它将执行jquerry以后正确显示弹出的数据。

请帮我解决这个问题,谢谢:)。

or set its to true, the popup show first but without any data then close after page completely loaded.
So i want to after page completely loaded it will execute the jquerry later to properly display the popup with data.
Please help me to solve this, thanks :).


如果你正在使用jQuery popup希望你的弹出代码将是这样的

If you are using jQuery popup hope your popup code will be like this
<script>


function (){

这篇关于弹出数据使用Jquerry和gridview中的linkbutton的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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