Asp.net中的动态TextBox值 [英] Dynamic TextBox values in Asp.net

查看:81
本文介绍了Asp.net中的动态TextBox值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我参考此链接并开始工作。我需要一个关于链接的解决方案。



如何在GridView中将动态TextBox值保存并检索到ASP.Net Web应用程序中的SQL Server数据库。第二次运行相同的页面perview存储的值不会显示在gridview中。请给出解决方案。



http://www.aspsnippets.com/Articles/Save-and-Retrieve-Dynamic-TextBox-values-in-GridView-to-SQL-Server- Database.aspx

Hi,

I refer this link and work. I need one solution about link.

How to Save and Retrieve Dynamic TextBox values in GridView to SQL Server Database in ASP.Net Web Application. Second time running the same page perview stored values is not displaying in gridview. Kindly give the solution.

http://www.aspsnippets.com/Articles/Save-and-Retrieve-Dynamic-TextBox-values-in-GridView-to-SQL-Server-Database.aspx

推荐答案

确定。如果数据在数据库中可用,你想在第二次运行时自动填充GridView的文本框,对吧?



跟着这个 -

1.对TextBox的更改如下:

OK. So you want to get the textboxes of the GridView to be got filled automatically on second run if data is available in the database, right?

Follow this-
1. Do little changes to the TextBoxes as follows
<asp:gridview id="Gridview1" runat="server" showfooter="true" xmlns:asp="#unknown">
            AutoGenerateColumns="false" onrowcreated="Gridview1_RowCreated">
            <columns>
            <asp:boundfield datafield="RowNumber" headertext="Row Number" />
            <asp:templatefield headertext="Header 1">
                <itemtemplate>
                    <asp:textbox id="TextBox1" runat="server" text="<%#Eval("Column1")"></asp:textbox>
                </itemtemplate>
            </asp:templatefield>
            <asp:templatefield headertext="Header 2">
                <itemtemplate>
                    <asp:textbox id="TextBox2" runat="server" text="<%#Eval("Column2")"></asp:textbox>
                </itemtemplate>
            </asp:templatefield>
            <asp:templatefield headertext="Header 3">
                <itemtemplate>
                     <asp:textbox id="TextBox3" runat="server" text="<%#Eval("Column3")"></asp:textbox>
                </itemtemplate>
                <footerstyle horizontalalign="Right" />
                <footertemplate>
                 <asp:button id="ButtonAdd" runat="server" text="Add New Row">
                        onclick="ButtonAdd_Click" />
                </asp:button></footertemplate>
            </asp:templatefield>
                 <asp:templatefield headertext="Header 3">
                <itemtemplate>
                    <asp:label id="Label1" runat="server" text="Click Me"></asp:label>
                </itemtemplate>
            </asp:templatefield>
            </columns>
        </asp:gridview>



2.创建一种新方法,将记录作为数据表。

3.在Page_Load()中调用此方法而不是SetInitialRow()



这就是全部:)



如果您需要进一步的帮助,请告知我们:)


2. Create a new method to get records as a datatable.
3. Call this method in the Page_Load() instead of SetInitialRow()

That's all :)

In case you need further assistance, please let me know :)


这篇关于Asp.net中的动态TextBox值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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