You must Sign In to post a response.
  • Category: Visual Studio Data GridView Adding New row

    Dear All,

    i have a module in VB.Net with GridView.
    i have 4 columns in that GridView. While i click 1st column in grid, it popup another window with multiple records, if i choose any one record, that selected records line will fetch in main window(4 columns) Grid.

    i need one extra row every time, after selected record will fetch in gridview.

    As i know, whenever we type in gridview column, it automatically create a new line.

    But i need new row, even if we didn't type..

    Ramkumar G.R
  • #757041
    try this code

    I have add datatable and Bind gridview in Pageload method after button click event i added one column rebind the gridview check and let me know if u need assist

    Dim dt As New DataTable
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If (IsPostBack = False) Then
    Dim dr As DataRow
    dr = dt.NewRow()
    dr(0) = "AA"
    dr(1) = "100"
    Session("dtrecords") = dt
    Grd1.DataSource = dt
    End If
    End Sub
    Protected Sub Bt1_Click(sender As Object, e As EventArgs) Handles Bt1.Click
    Dim dt1 As New DataTable
    dt1 = Session("dtrecords")

    Dim dr As DataRow
    dr = dt1.NewRow()
    dr(0) = "AA1"
    dr(1) = "1001"
    dr(2) = "1500"
    Session("dtrecords") = dt1
    Grd1.DataSource = dt1

    End Sub

    Name : Dotnet Developer-2015
    Email Id :

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • Sign In to post your comments