Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Dec 27, 2010 09:56 PM by Ahmed A M
Oct 15, 2006 01:24 PM|LINK
I am using the Gridview custom paging code found here:http://www.asp.net/learn/dataaccess/tutorial25vb.aspx?tabid=63
On my page I also have a button which hides the gridview and shows a formview that is used for updating and inserting records that are displayed in the gridview. My problem is when I add a record via the formview and then the Gridview is shown again if the
record should be on the same page of data that is shown it doesn't show up (it correctly is added to the database). If I switch to a different select datasource on my object datasource it then shows up in the list.
I hope this makes sense, any help greatly appreciated.
gridview "custom paging" refresh insert
Oct 15, 2006 01:45 PM|LINK
Oct 15, 2006 02:25 PM|LINK
Oct 16, 2006 03:15 AM|LINK
Make sure you do not bind your GV on each postback in Page_Load() event.
protected void Page_Load()
//Bind your GV}
Oct 16, 2006 05:28 AM|LINK
Where do you call the DataBind method? Do you do it in the method where you display the Grid again after you insert a value with the FormView?
If you use a data-source control and call the GridView's DataBind method, the GridView will make a call to the data-source Select method and rebind the new values. If you don't use the data-source control, make sure you also call your method that gets the
value from the data source and set it to the GridView's DataSource property, after that call the DataBind method.
At least the DataBind method refresh my grid, I usually hook up to the data-source updated or inserted event and call the DataBind method directly after the Inert and Update has executed.
Oct 16, 2006 12:39 PM|LINK
[quote user="Fredrik N"] At least the DataBind method refresh my grid, I usually hook up to the data-source updated or inserted event and call the DataBind method directly after the Inert and Update has executed.
That did it! Thanks!
Oct 17, 2006 09:26 PM|LINK
I am having the same type of problem but I have a DropDownList that is being bound to an AccessDataSource.
Below the form that this is a part of, I have another form (these are two seperate forms on the same web form). This second form allows you to add a new record to the table that is populating the DropDownList from the other form. After inserting the new
record, the DropDownList is not getting the new value even though I am calling DataBind(), however if I step through it while debugging, it works. Any ideas?
Oct 18, 2006 06:25 PM|LINK
Oct 23, 2006 10:09 PM|LINK
Thank Ya'll so much I have been looking for this answer all day now... In fact I just posted the same question on here (yes like a DumbA$$ before searching the forum first)
Cool anyhow thank each of you for your input on this You guys ROCK
Oct 24, 2007 10:03 PM|LINK