Search code examples
sqlasp.netgridviewdata-bindingobout

obout gridview postback databind


Hello i am working with visual studio , asp.net vb.net and using obout gridview my problem is that it aint updating after inserting new data ( it does only after reloading the page )
i am using the asp.net sql control for selection and insertion so after something like :

Protected Sub createCategoryBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles createCategoryBtn.Click
.
.
.
 sql1.insert()
 sql1.databind() 
 grid1.databind() 
.
.
.
END SUB

i still cant see the new row ( only after reloading the page ) i noticed obout grid got rebind option on click in which u can open sql connection and probebly data bind the grid, but i was wondering if i can avoid doing that? ( if thats even the right way to do so with obout gridview )


Solution

  • You need grid1.datasource = sql1 before grid1.databind()