如何使用C#将值插入表格 [英] how to insert value into table using c#

查看:78
本文介绍了如何使用C#将值插入表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些文本框和一个下拉列表.我想插入表(additem).

I have some text box and one dropdownlist.I want to insert into table (additem).

推荐答案

关注链接...
使用C#读取,插入,更新和删除简单的ADO.NET数据库. [
follow the link...
Simple ADO.NET Database Read, Insert, Update and Delete using C#.[^]


用于在其中添加控件表格,您可以在HTML中做这样的事情
For adding control in table you can do somthing like this In HTML
<table id="test"  runat="server">



并在后面的代码中.例如,我在表格
中添加文本框



and in code behind>.For Example i am adding text box in table


TextBox text = new TextBox();
          test.Controls.Add(text);



只需在下拉菜单中添加项目,您就可以做这样的事情



And just for adding item in dropdown you can do somthing like this

'''''' adds a row to a drop down menu. In old code line no  62 to 78
   ''''''
   '''''' <param name="dropDown"></param>
   '''''' <param name="text"></param>
   '''''' <param name="value"></param>
   '''''' <remarks></remarks>
   Sub addDropDownItem(ByVal dropDown As DropDownList, ByVal text As String, ByVal value As String)
       Dim dropDownItem As New ListItem
       dropDownItem.Text = text.ToString()
       dropDownItem.Value = value.ToString()
       dropDown.Items.Add(dropDownItem)
       dropDown.DataBind()
   End Sub


http://msdn.microsoft.com/zh-cn/library/dw70f090.aspx [ ^ ]


这篇关于如何使用C#将值插入表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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