在dataGridview内的文本框上进行客户端javascript验证 [英] client side javascript validation on textboxes inside dataGridview

查看:80
本文介绍了在dataGridview内的文本框上进行客户端javascript验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用gridview来显示和更新数据库..
girdview代码就像dis ..

I''m using a gridview to show and update database..
girdview code is like dis..

<asp:GridView ID="grdImage" runat="server" AutoGenerateColumns="false"

                                Width="82px" DataKeyNames="BannerId">
                                <Columns>
                                    <asp:BoundField HeaderText="Image Name" DataField="ImageName" />
                                    <asp:BoundField HeaderText="Image" DataField="Image" />
                                    <asp:TemplateField HeaderText="Position">
                                    <ItemTemplate >
                                       <asp:TextBox ID="txtPosition" runat="server" Width="50px" Text='<%# Eval("Position")%>' >
                                        </asp:TextBox>
                                    </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </asp:GridView>
<asp:Button ID="btnSave" runat="server" Text="Save" onclick="btnSave_Click" />



要更新数据,用户将在文本框中输入整数值,然后单击保存按钮.
我需要客户端JavaScript验证来检查在文本框中输入的值是否在除0以外的其他文本框中不重复..



to update data user will enter integer values in textboxes and click save button.
i need a client side javascript validation to check values entered in textboxes are not repeating in anothertext boxes except 0 ..

推荐答案

请参阅此链接

http://www.dotnetfunda.com/articles/article146.aspx [ http://www.c-sharpcorner.com/uploadfile/purankaushal/gridjavascript05212008014115am/gridjavascript.aspx [ ^ ]
see this links

http://www.dotnetfunda.com/articles/article146.aspx[^]

http://www.c-sharpcorner.com/uploadfile/purankaushal/gridjavascript05212008014115am/gridjavascript.aspx[^]


<asp:TextBox ID="txtPosition" runat="server" Width="50px" Text=''<%# Eval("Position")%>'' >
                                        </asp:TextBox>


在其中放置一个OnClientClick属性.用它.绑定一个JS方法.将"this"作为参数之一传递给方法.在Mehtod中,检查文本框的值并采取适当的措施.


Put a OnClientClick attribute in it. Use it. Tie a JS method. Pass ''this'' as one of the parameter to method. In mehtod, check the value of the textbox and take appropriate action.


这篇关于在dataGridview内的文本框上进行客户端javascript验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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