Saturday, October 18, 2014

how to use grid view in asp.net

Posted by Unknown  |  No comments


 if you want more related search please click here  
 please help to other  
 http://scriptquery.blogspot.in/  

 Read text box values and display in to the gridview with out using the database connectio using vb.net  
 -------------------------------------------------------------------------------------------------------------------  
 Imports System.Collections.Generic  
 Imports System.Linq  
 Imports System.Web  
 Imports System.Web.UI  
 Imports System.Web.UI.WebControls  
 Imports System.Data  
 Partial Class _Default  
   Inherits System.Web.UI.Page  
   Dim dt As DataTable  
   Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load  
     dt = New DataTable()             ' here we are creation the table  
     Dim dc1 As New DataColumn("NAME")      ' here we are declaring the column name  
     Dim dc2 As New DataColumn("ADDRESS")              ''  
     dt.Columns.Add(dc1)             'here we are assiging the cloumn names to datatable(dt)  
     dt.Columns.Add(dc2)  
   End Sub  
   Protected Sub Btnshow_Click(sender As Object, e As System.EventArgs) Handles Btnshow.Click  
     Dim dr1 As DataRow = dt.NewRow()        'here we are adding new row with two coloums in datatable  
     dr1(0) = txt1.Text  
     dr1(1) = Txt2.Text  
     dt.Rows.Add(dr1)  
     binddata()  
   End Sub  
   Public Sub binddata()  
     GridView1.DataSource = dt  
     GridView1.DataBind()  
   End Sub  
 End Class  

 if you want more related search please click here  
 please help to other  
 http://scriptquery.blogspot.in/  


11:34 PM Share:

0 comments:

Get updates in your email box
Complete the form below, and we'll send you the best coupons.

Deliver via FeedBurner
Proudly Powered by Blogger.
back to top