GridView中的OnRowDelete事件 [英] OnRowDelete event in GridView

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

问题描述

先生,我尝试了每个代码从sql中删除网格中的行.但是它给了我我在asp.cs页面中写的错误.代码是

Sir i tried every Code to delete row from the grid from sql. but it give me an error which i wrote in asp.cs page. the code is

string catagory=(int)Gridview1.Rows(e.rowIndex);


现在它给我一个RowIndex.means系统无法注册或类似错误的错误. RowIndex未知.


now it gives me an error of RowIndex.means system can not register or something like this. RowIndex is not known.

推荐答案

您已经问了好几天了.您应该买一本书并阅读,这显然是无可救药的.


You have been asking this stuff for days. You should buy a book and read it, you''re plainly hopelessly lost.


写道:​​

string catagory =(int)Gridview1.Rows(e.rowIndex);

string catagory=(int)Gridview1.Rows(e.rowIndex);



让我们逐步考虑一下此代码.

1-您定义一个字符串
2-您要分配给此字符串的内容,您正在转换为int.我不相信C#会允许这样做,我相信只有将其添加到现有字符串后,它才会将int转换为字符串
3-您的gridview被命名为gridview1.至少这意味着您不一定要编写专业的代码,但是也许有一天您可能想要编写足以让人们付钱的代码.养成给变量起有用名字的习惯
4-C#区分大小写.没有rowIndex属性,有RowIndex属性.您的计算机上的intellisense是否损坏,导致无法解决?
5-您告诉我们:



Let''s consider this code, step by step.

1 - you define a string
2 - the thing you want to assign to this string, you''re casting to int. I don''t believe C# will allow that, I believe it will convert int to string only if it''s added to an existing string
3- your gridview is named gridview1. At least that means you must not be writing professional code, but one day perhaps you will want to write code that''s good enough for people to pay for. Get in the habit of giving your variables useful names
4 - C# is case sensitive. There is no rowIndex property, there IS a RowIndex property. Is intellisense broken on your computer, that you could not work that out ?
5 - you tell us:

写道:​​

现在它给我一个RowIndex.means错误,系统无法注册或类似错误.

now it gives me an error of RowIndex.means system can not register or something like this.



如果您遇到错误,请告诉我们确切的含义.这样,我们就知道错误是什么,而不是试图根据您的发言进行猜测.您继续说未知的RowIndex".但是,问题在于它的rowIndex是未知的,并且该错误与注册任何内容都没有关系.如果收到错误消息说无法注册,请将其准确发布,这样我们就知道发生了什么.

买书或上课.学习者没有错,但是如果您日复一日地问同样的事情,那么这是一个好兆头,表明您跳入的深度太深,远远超出了您的能力水平.



If you get an error, tell us what it says EXACTLY. That way, we know what the error is, instead of trying to guess based on what you said. You go on to say ''RowIndex is not known''. But, the problem is that it''s rowIndex that is not known, and the error can''t have anything to do with registering anything. IF you got an error message that said can not register, post it exactly, so we know what''s going on.

Buy a book, or attend a class. There''s nothing wrong with being a learner, but if you need to ask the same thing day after day, that''s a good sign you''re jumping in too deep and well beyond your level of competence.


非常感谢先生.我会尽力阅读书籍并提出问题.
Thank you very much Sir.I will try my best to read books and ask questions.


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

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