更新时间:2023-10-19 19:11:04
在模板字段内添加文本框写入
Add textbox inside template field write
<asp:textbox id="txt1" onkeypress="return changeColoronfocus(this);" xmlns:asp="#unknown"></asp:textbox>
谢谢
Sanju Nambiar
Thanks
Sanju Nambiar
以下是调用a的示例处理按键事件的JavaScript方法。我还包括下面的JavaScript方法。
GridView专栏内:
Here is example of calling a JavaScript method that handles key press event. I also included the JavaScript method, below.
Inside of the GridView column:
<asp:TemplateField HeaderText="Doses Received" FooterStyle-Width="70px" HeaderStyle-Wrap="true" ItemStyle-Width="70px">
<ItemTemplate>
<asp:TextBox ID="txtDosesReceived" runat="server" onkeypress="return NoCommaAllowed(event);" MaxLength="10" Width="70px"
Text='<%# Bind("DosesReceived") %>'></asp:TextBox>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center" />
</asp:TemplateField>
JS方法:
< pre lang =cs>函数NoCommaAllowed(evt){
var charCode =(evt.which)? evt.which:event.keyCode
return!(charCode == 44);
}< / pre>
JS Method:
<pre lang="cs">function NoCommaAllowed(evt) {
var charCode = (evt.which) ? evt.which : event.keyCode
return !(charCode == 44);
}</pre>
亲切虽然这个链接希望你的要求能够实现
http://***.com/questions/6341856/keypress-event-for-textbox-which-is-in-gridview [ ^ ]
Kindly go though this link hope your requirements will fulfilled
http://***.com/questions/6341856/keypress-event-for-textbox-which-is-in-gridview[^]