将数据绑定到html按钮的onclick [英] binding data to the onclick of html button

查看:153
本文介绍了将数据绑定到html按钮的onclick的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好...
我有一个包含多个文本框的动态表,我使用了一个输入类型按钮.在这里,我需要为html按钮控件的onclick事件编写代码,但它是客户端,我们如何将代码背后的代码绑定到按钮并在click事件上将文本框值分配给字符串,可以有人帮助我吗

在此先感谢

hi all......
i had one dynamic table which contains several textboxes i used one input type button. here i need to write code for onclick event of html button control but its a client side how code behind code we can bind to the button and assign text box values to a string on click event can any one help me please

thanks in advance

推荐答案

您的问题很令人困惑.这听起来是您想知道如何在客户端分配文本框值.

首先,当您在服务器端动态创建此表时,所有控件也将是服务器端,您应该能够将onclick处理程序附加到可以在服务器端使用的onclick处理程序.
如果您拥有客户端控制权,那么您将剩下客户端事件.在这种情况下,如果您确实需要与服务器对话,则可以使用XMLHttpRequest进行对话.如果您只需要填写文本框的值,然后使用Javascript,则访问文本框并填写该值.大约回发时,文本框应在服务器端显示该值.
Your question is quite confusing. What it sounds is you want to know how you can assign textbox values on client side.

Firstly, when you are creating this table dynamically on server side then all the controls too would be server side and you should be able to attach an onclick handler to it that can be used on server side.

In case, you have client side control then you will be left with client side event. In this case, if you really need to talk to server then use XMLHttpRequest to talk. If you just need to fill in the value of textbox then use Javascript, access the textbox and fill in the value. On postback or so, the textbox should show you the value on server side.


这篇关于将数据绑定到html按钮的onclick的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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