C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » ASP.NET WebForms »

Bind Textbox values to Datalist


Posted Date: 03 Jul 2009    Resource Type: Code Snippets    Category: ASP.NET WebForms
Author: UltimateRenganMember Level: Diamond    
Rating: 1 out of 5Points: 10



Just Drag and drop the Datalist to form
In page load create the DataTable and create the columns
Assign the Textbox values to Datatable and reassing to Dataset
Bind the Dataset values to DataList.

Imports System.Data
Partial Class _Default
Inherits System.Web.UI.Page
Dim ds As New DataSet
Dim dt As New DataTable
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
dt.Columns.Add("S.No", GetType(Integer))
dt.Columns.Add("Name", GetType(String))
dt.Columns.Add("UserName", GetType(String))
End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
'Dynamic textbox values to Datarow of DataTable.
dt.Rows.Add(New String() {Convert.ToInt32(TextBox1.Text), TextBox2.Text, TextBox3.Text})
ds.Tables.Add(dt)
'Bind the DataSet values to Datalist control
DataList1.DataSource = ds
DataList1.DataBind()
End Sub
End Class




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Bind Textbox values to Datalist  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Create an Text File Using File Stream Objects
Previous Resource: Dynamic controls with Validation
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET WebForms


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use