如何纠正错误网格视图触发了未处理的事件PageIndexChanging." [英] how to rectify error " grid view fired event PageIndexChanging which wasn't handled."

查看:85
本文介绍了如何纠正错误网格视图触发了未处理的事件PageIndexChanging."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从数据库中检索数据到作为我的gridview的数据源的数据集中.现在,我收到此错误未处理的网格视图触发的事件PageIndexChanging"如何纠正此错误以及为什么得到此错误.我在这里给出我的代码.请建议我步骤tp修改我的步骤,以消除此错误
我的gridview名称是gdshow.
这是我的代码

hi i am retrieving data from database into dataset which acts as a datasource for my gridview. Now i am getting this error "grid view fired event PageIndexChanging which wasn''t handled" how to rectify this error and why i am getting it . i am giving my code here. please suggest me steps tp modify my steps so as to remove this error
my gridview name is gdshow.
here is my code

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
                   SqlConnection conn = new SqlConnection(str);
                   SqlCommand cmd = new SqlCommand("spshow",conn);
                   cmd.CommandType = CommandType.StoredProcedure;
                   cmd.Parameters.AddWithValue("@var", ddlshow.SelectedValue);
                   SqlDataAdapter adp = new SqlDataAdapter(cmd);
                   DataSet ds = new DataSet();
                   adp.Fill(ds);

                   try
                   {
                       conn.Open();
                       gdshow.Visible = true;
                       gdshow.DataSource = ds;
                       gdshow.DataBind();
                   }

                   catch (Exception E)
                   {
                       Response.Write(E.Message);

                   }
                   finally
                   {
                       conn.Close();

                   }
}




*修复了前置标记




*Fixed pre tag

推荐答案

亲爱的朋友,

您的问题的解决方案在于以下链接:-

http://www.jigsawboys.com/2008 /10/22/the-gridview-fired-event-pageindexchanging-which-wasnt-handled/ [
Dear Friend,

The solution to your problem lies in this link:-

http://www.jigsawboys.com/2008/10/22/the-gridview-fired-event-pageindexchanging-which-wasnt-handled/[^]

Don''t forget to mark this as your answer if it helps you out.

Thanks


Hii允许在griedview中进行分页功能.可能是ds中的记录数大于gried中的默认记录.增加griedview的页面大小或将其嵌入具有分页功能希望它对您有帮助... !!
Hii allow paging functionallity in your griedview.May be the number of records in the ds is more than the default records in gried.either increase the pagesize of griedview or embed it with paging functionallity.Hope it helps you...!!


这个问题只有一种解决方法..

您的问题是您尚未处理gridview的PageIndexChanging事件..只需为您的gridview编写一个事件处理程序即可.它将100%工作..

编写活动的步骤:

1)选择您的网格视图.
2)转到该网格视图的属性窗口
3)选择PageIndexChanging事件,然后双击该事件

编写代码以处理gridview分页(如果需要)..
如果您需要页面视图的分页编码,请与我联系.
尝试一下.如果您愿意,请接受答案..
最好的..:)
There is only one solution to this problem..

Your problem is that you have not handled PageIndexChanging event of your gridview.. Just write an event handler for your gridview.. It will 100% work..

steps for writing the event:

1) select your grid view.
2) go to properties window of that grid view
3) select the PageIndexChanging event and double click on the event

write the code to handle the gridview paging(if required) ..
If you need the paging coding for grid view just contact me..

try it.. Accept the answer if you like it..
All the best.. :)


这篇关于如何纠正错误网格视图触发了未处理的事件PageIndexChanging."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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