生成动态文本字段并将其值保存在数据库中 [英] generate the dynamic textfield and save its value in database

查看:142
本文介绍了生成动态文本字段并将其值保存在数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我想使用C#在asp.net中生成动态标签和文本字段,在另一个文本字段的文本更改事件中,然后检索其值并将其保存到数据库中.例如:一个文本字段要求输入数字以生成字段,然后将其保存到数据库中.
我使用表控件来创建字段,但无法将数据保存到数据库中.

请尽快解决此问题.

Hello,

I want to generate the dynamic label and text fields in asp.net using C#, On the text changed event of the other text field and then retrive its value and to save that into the database. for example: one text filed ask for the number to generate the fields and then save that to the database.
I used table controls to create the fields but not able to save the data to the data base.

Please Help on this issue as soon as possible.

推荐答案

您尝试将数据绑定到连接的数据表并使用提交吗?
Did you try binding the data to a connected datatable and using the commit?


一旦我使用XForm通过服务器端xml生成整个表单.最终将表单发布到保存数据的自定义处理程序中.

如果您通过ASP.NET方式需要它,请在Pre_Init中创建文本字段,以便保留视图状态数据.

现在,当页面发回时,遍历所有元素并获取数据.最好将字段ID放在控件中,这可能会对您有所帮助.
Once I used XForm to generate the entire form using the server side xml. Finally posting the form to a custom handler from where I saved the data.

If you need it by ASP.NET way, create text fields in Pre_Init so that viewstate data remains.

Now when page is posted back, loop through all the elements and get the data. It is better to put Id of the field the control, which might help u.


谢谢您Alaric和Abhishek
我解决了.
实际上,我在表单加载事件中编写了该代码,只是使主文本字段的autopostback属性为"true".
然后通过将其保存在一个变量中将该值保存在数据库中.

但是必须使用批查询.

再次谢谢你们.
Thank You Alaric and Abhishek
I Solved it.
Actually i wrote that code in form load event just make the autopostback property "true" of the main textfield.
and subsequently saved that value in database by keeping it in one variable.

But Batch Query is required to be used.

Thank you both once again.


这篇关于生成动态文本字段并将其值保存在数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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