网格视图控件中的验证 [英] validation in the grid view control

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

问题描述

Grow=BindTextBoxGv.SelectedRow;
TextBox ValTextbox = (TextBox)row.Cells[1].FindControl("NameofFormTxt");
if (row.RowIndex == 1)
{
  ValTextbox.Attributes.Add("onblur", "return validateDate(this.id);");
}



这是我的代码.
在这里,我想验证网格中的文本框,因此我在文本框text_change事件中使用了selectrow,但我并非总是能获得selectedrow的原因以及如何解决我的问题.谁能帮我.



This is my code.
Here I want to validate the Textbox in the grid so i taken the selectrow in the textbox text_change event but i am not albe to get the selectedrow why and how can i solve my problem. can any one help me.

推荐答案

嗨 拉杰什,

您需要执行以下操作:

.aspx.cs文件

Hi Rajesh,

You need to do following:

.aspx.cs file

void CustomersGridView_SelectedIndexChanged(Object sender, EventArgs e)
{
  // Get the currently selected row using the SelectedRow property.
  GridViewRow row = CustomersGridView.SelectedRow;
 
}



.aspx文件



.aspx file

<asp:gridview id="CustomersGridView"

       selectedindex="1"

       onselectedindexchanged="CustomersGridView_SelectedIndexChanged"

       runat="server" >
</asp:gridview>



谢谢,
Imdadhusen



Thanks,
Imdadhusen


这篇关于网格视图控件中的验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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