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
|
No responses found. Be the first to respond and make money from revenue sharing program.
|