Hi all,
I'm developing a site. One of the features is a search page, for which
I'm using a data repeater control.
For the rest of the pages it is fine, but, obviously, on the search
page, for the first time, there will be no search results. Only when
the user specifies his search parameters will the search show up.
The Page_Load event for the search control looks as follows:
protected void Page_Load(objec t sender, EventArgs e)
{
DataBind();
if (!IsPostBack)
{
LoadDefinedData ();
DoSearch();
}
DoSearch();
}
and other methods are:
protected void btnSearch_Click (object sender, EventArgs e)
{
DoSearch();
}
private void DoSearch()
{
...prepare params
if (csi.Search(par ams))
{
Repeater.DataSo urce = csi.DefaultView ;
Repeater.DataBi nd();
}
}
So I'm having to hit the database TWICE for each request. If I remove
the 2nd DoSearch from the Page_Load, then no data shows up, and I
actually want to remove both the DoSearch()es from the Page_load, and
just rely on the Search_Click DoSearch.
How can I achieve this? I've gone MAD trying to get this stupid
straight forward thing to work, and I need to put it into production
as soon as possible.
Thanks in advance, and all help appreciated.
Regards,
--Jaffar 7 1707
Maybe I'm making this too simple. You said on the inital load of the
search page there would be no results. Then once they search the
results should show.
Remove all the code from the page_load you have shown. Put the
DoSearch() function in the button click event. Make sure you finish
by binding the data to your repeater.
-joe
No, the problem is that my problem SOUNDS too simple. I did exactly
what you suggested before I posted this problem. If I remove any code
from the Page_Load which results in DataBinding, the search does not
work whenever I press the search button. I mean, the search works, but
the ItemCommand event does not fire on the repeater. Because of this,
the ID of the record does not get populated, and I cannot view the
details, when I press the button present in the DataRepeater.
Thanks for your time. And sorry for not being so clear the first time.
Regards,
--Jaffar
On Jun 3, 2:00 pm, jaffarkazi <jaffar.k...@gm ail.comwrote:
No, the problem is that my problem SOUNDS too simple. I did exactly
what you suggested before I posted this problem. If I remove any code
from the Page_Load which results in DataBinding, the search does not
work whenever I press the search button. I mean, the search works, but
the ItemCommand event does not fire on the repeater. Because of this,
the ID of the record does not get populated, and I cannot view the
details, when I press the button present in the DataRepeater.
Thanks for your time. And sorry for not being so clear the first time.
Regards,
--Jaffar
Hi
Try Remove the Page's DataBind() method invocation at the top of the
page...
First of all there should not be any code in the page_load event of
your scenario , thing are pretty simple in your case...
1. Get the search option from somewhere (where from the search query
come from by the way?)
2. Execute the search ...
3. Get the result
4. bind it to result grid and save the result in session or somewhere
else to use it for later use.
In your case
if (!IsPostBack)
{
LoadDefinedData ();
DoSearch(); //this code is useless
}
DoSearch(); //since this will be execute any way...
please investigate your search binding scenario...
Best of luck
Munna www.munna.shatkotha.com www.munna.shatkotha.com/blog www.shatkotha.com
sounds like you have viewstate disabled on the repeater
"jaffarkazi " <ja*********@gm ail.comwrote in message
news:1b******** *************** ***********@p39 g2000prm.google groups.com...
No, the problem is that my problem SOUNDS too simple. I did exactly
what you suggested before I posted this problem. If I remove any code
from the Page_Load which results in DataBinding, the search does not
work whenever I press the search button. I mean, the search works, but
the ItemCommand event does not fire on the repeater. Because of this,
the ID of the record does not get populated, and I cannot view the
details, when I press the button present in the DataRepeater.
Thanks for your time. And sorry for not being so clear the first time.
Regards,
--Jaffar
On Jun 3, 4:10 pm, "gerry" <g...@newsgroup .nospamwrote:
sounds like you have viewstate disabled on the repeater
"jaffarkazi " <jaffar.k...@gm ail.comwrote in message
news:1b******** *************** ***********@p39 g2000prm.google groups.com...
No, the problem is that my problem SOUNDS too simple. I did exactly
what you suggested before I posted this problem. If I remove any code
from the Page_Load which results in DataBinding, the search does not
work whenever I press the search button. I mean, the search works, but
the ItemCommand event does not fire on the repeater. Because of this,
the ID of the record does not get populated, and I cannot view the
details, when I press the button present in the DataRepeater.
Thanks for your time. And sorry for not being so clear the first time.
Regards,
--Jaffar
Tried enabling that too! :) No solution.
is it enabled on all containers as well ? ie usercontrol , page ... have
you posted an actual example of this problem somewhere ?
"jaffarkazi " <ja*********@gm ail.comwrote in message
news:63******** *************** ***********@56g 2000hsm.googleg roups.com...
On Jun 3, 4:10 pm, "gerry" <g...@newsgroup .nospamwrote:
>sounds like you have viewstate disabled on the repeater
"jaffarkazi " <jaffar.k...@gm ail.comwrote in message
news:1b******* *************** ************@p3 9g2000prm.googl egroups.com...
No, the problem is that my problem SOUNDS too simple. I did exactly
what you suggested before I posted this problem. If I remove any code
from the Page_Load which results in DataBinding, the search does not
work whenever I press the search button. I mean, the search works, but
the ItemCommand event does not fire on the repeater. Because of this,
the ID of the record does not get populated, and I cannot view the
details, when I press the button present in the DataRepeater.
Thanks for your time. And sorry for not being so clear the first time.
Regards,
--Jaffar
Tried enabling that too! :) No solution.
No, not posted it anywhere.
I've found a workaround/temporary solution/whatever you call it.
Earlier I was using buttons to go to the details page from search. Now
I'm using URLs, with the ID being passed as part of the URL.
Now, the code which was actually wrong, i.e., SearchData in Page_Load
has been correctly removed, and it works properly.
Thanks everyone for your time.
Regards,
--jaffar This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: mike420 |
last post by:
In the context of LATEX, some Pythonista asked what the big
successes of Lisp were. I think there were at least three *big*
successes.
a. orbitz.com web site uses Lisp for algorithms, etc.
b. Yahoo store was originally written in Lisp.
c. Emacs
The issues with these will probably come up, so I might as well
mention them myself (which will also make this a more balanced
|
by: RSB |
last post by:
Hi Every one,
I am currently using Visual Studio .Net and trying to open a project from
SourceSafe and once i open the project for the first time i get the
following error/warning...
"The binding information for this solution could not be retrieved from its
source control provider. This solution may have been placed under source
control with a different provider configuration from the current one.
To keep source control working for...
|
by: muhamad |
last post by:
Hi,
How can I use the DataRepeater in CSharp , this control exists in VB6 ,i
never used it .
I want to insert into the DataRepeater TextBoxs that will show all the time
data from the database .
Does anyone have an example or direction ?
|
by: |
last post by:
Hi, NG!
Is there any updated version (.Net) of the Datarepeater control or do I have
to use the old (VS6.0) version?
Thanks.
pax
|
by: John J. Hughes II |
last post by:
I have a DataGridView displaying data from a DataSet. To the right of that
I have a custom user control which displays one of the data set fields.
The custom user control is bound to the data set object and displays the
data correctly when I move from row to row.
The problem I am having is the data set always reads the data back and
considers it change even when it's not. I am looking for how to change the
following code so the...
| |
by: David Veeneman |
last post by:
How do I get the data bindings for a control that is bound at design time?
I'm binding a DataGridView control to a data source at design time, using a
BindingSource control. I set the grid's DataSource property to the
BindingSource control, which the Data Source Configuration Wizard created
for me.
The data binding works fine when I run the app, but I can't get a reference
to the DataGridView's data bindings.
|
by: TC |
last post by:
I'm using Visual Studio 2005 with SourceGear Vault. I'm having trouble
with the integrated source code control features. I think the problem
is entirely with Visual Studio, not Vault.
First, let me say that I think the integrated source control features
are wonderful. They work great, except when they don't work at all.
Unfortunately, they don't work every time I need them, so I've had to
turn them off completely.
The trouble is with...
|
by: needin4mation |
last post by:
In this code:
protected void GridView1_RowCreated(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DataRowView rowView = (DataRowView)e.Row.DataItem;
// Retrieve the value for the current row.
|
by: morathm |
last post by:
I have a windows client database management application written in C# that connects to remote web services to do all the heavy work. The thin-client app uses strong typed datasets, all maintained at the web service, with a web reference to those datasets via exposed s on the web service.
The client app has a series of windows forms designed to manage particular types of data. For example, there's a manage users form. On each of these...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |