locked
Grid Row Columns Fill on Button Submit RRS feed

  • Question

  • User-159752495 posted

    Hello,

              I have Gridview with Filled up rows from database along with drop down and button for each row. Each GridView Row has two columns that needs to be filled up only after button submit. First the drop down is to be selected, then button is to be pressed, then record is inserted into the database, and the corresponding row's 2 columns need to be filled from database. Button coding is done in rowCommand event . How do I use RowDatabound event in the rowcommand to fill up those 2 columns.

    Thanks

    Regards

    Anoop Mathur

    Tuesday, February 19, 2019 4:10 AM

All replies

  • User-1716253493 posted
        Protected Sub GridView1_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GridView1.RowDataBound
            If e.Row.RowType = DataControlRowType.DataRow Then
                Dim x As String = String.Format("{0}", DataBinder.Eval(e.Row.DataItem, "fieldx"))
            End If
        End Sub

    The sample using string.format to avoid null exception error

    If you don't like it, use if condition to check eval("x") value is not null before converting

    Tuesday, February 19, 2019 10:37 AM
  • User-1174608757 posted

    Hi anp123,

    According to your description, I couldn't know your requirement clearly.

    then record is inserted into the database,

    Could you please tell me how the record get? Does it based on the value of dropdown?

    the corresponding row's 2 columns need to be filled from database.

    What is exactly the 2 columns?

    If you could post more details , it will help us to solve your problem quickly.

    Best Regards

    Wei Zhang  

     

    Wednesday, February 20, 2019 8:03 AM