[已解决] GridViw RowCommand第一次不触发 [英] [Solved] GridViw RowCommand does not fire for the first time

查看:66
本文介绍了[已解决] GridViw RowCommand第一次不触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个GridView,里面有一个linkbutton.当单击链接按钮时,我的gridviews RowCommand被触发.我的问题是,第一次单击链接按钮时,不会触发GridView的RowCommand.在随后单击链接按钮时,将触发GridView的RowCommand.我尝试使用AJAX单击行(链接按钮)时显示详细信息.我的GridView在UpdatePannel中.

我已经使用.net 3.0创建了应用程序.
谢谢
Saubhagya

更新:问题解决
我发现了问题,我正在使用引起问题的GridView_RowCreated ,而是我使用了GridView_RowDataBound 为我解决了问题.

Hi,

I have a GridView, and a linkbutton inside it. When clicking on the link button, my gridviews RowCommand gets fired. My problenm is that GridView''s RowCommand does not get fired when clicking on the linkbutton for the first time. On subsequent click on the linkbutton, the GridView''s RowCommand gets fired. I am trying to display details when clicking on row (linkbutton) using AJAX. My GridView is inside an UpdatePannel.

I have created the application using .net 3.0.
Thanks
Saubhagya

UPDATE: Issue resolution
I figured out the issue, I was using GridView_RowCreated which was causing the problem, instead I used GridView_RowDataBound which solved the problem for me.

推荐答案

可能会发布您尝试过的代码,但是我想问题可能是您在回发时将数据源绑定到了Gridview.
因此,请编写代码而不是回发.

Atleast you might post the code which you have tried, but i guess the issue may be you bound the datasource to Gridview on postback.
So write the code in not postback.

protected void Page_Load(object sender, EventArgs e)
{
 if (!IsPostBack)
 {
  GridView1.Datasource = DataTable1;
  GridView1.DataBind();
 }
}



请告知我们状态,否则请发布您的代码.



Just let us know the status, if not then post your code.


这篇关于[已解决] GridViw RowCommand第一次不触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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