Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

GridView Databinding in ASP.Net 2 / VB.NET

Posted on 2006-07-02
3
Medium Priority
?
395 Views
Last Modified: 2012-05-05
Hi - I am very new to web development, so hopefully the solution to my question is reasonably straightforward.

I have a web page with a reasonably complex search facility on it, due to this complexity I store the results in a temporary table which I then bind bound to a gridview.

In order to get the gridview to refresh and show the search results Ihave to use

gridview.databind()

I have put this in the pageload function, however the gridview always shows me the previous search results. I guess I have the gridview.databind in the wrong place, but I have no ideaw where it should go.

If anyone can shed any light on my problem and point me in the right direction then it would be much appreciated.

Many thanks
...Steve

0
Comment
Question by:swtiley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 9

Accepted Solution

by:
noulouk earned 2000 total points
ID: 17027451
Hi Steve,

Maybe try:
IF NOT Page.IsPostback
gridview.databind()
END IF

This will load your grid the first time.

Then you can use the button click event for example to rebind your gridview.

Hope this helps.
0
 

Expert Comment

by:daforga
ID: 17028009
Hi Steve,
You could use a stored procedure as the source of the gridview (or an sql statement). Pass the parameters to call the stored procedure when you fire whatever event you choose to bind data to your gridview.  It could be from a button event, or the SelectedIndexChanged Event od another GridView.   The main thing is, the data must change and you have to tell it what to change to by paramerizing your SQL Calls.
Have fun
daforga
0
 
LVL 1

Author Comment

by:swtiley
ID: 17033893
Thanks noulouk - your solution worked fine

Cheers
...Steve
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question