473,395 Members | 1,915 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Datagrid: how-to dynamically change WHERE conditions

I'm trying to dynamicaly change Where conditions in a Datagrid without success.
The aspx form has some input fields, used to build the search, plus a final
SEARCH button. In the click event I build the SQL Select stmt and do the
following:
Me.DataSourceSearch.SelectCommand = "SELECT ... WHERE ...."
Me.gridResult.DataBind()

The datagrid has been designed with a generic SELECT command like "SELECT *
FROM Mytable", that in my supposing should be overwritten by the
..SelectCommand stmt.

Problem: Clickng the Search button I get a correct first page Datagrid, but
paging I then get data without any Where condition set.

I've tryed many other ways without success. Where is my fault?

Many thanks.
--
bruno
Aug 11 '06 #1
2 1897
Try writing the statements you write in the Search button click in a
function (e.g. Bind) and then call it from Search button. And also in the
paging event instead call the new Bind method.

Regards,
Rohit

"bruno" <br***@community.nospamwrote in message
news:9E**********************************@microsof t.com...
I'm trying to dynamicaly change Where conditions in a Datagrid without
success.
The aspx form has some input fields, used to build the search, plus a
final
SEARCH button. In the click event I build the SQL Select stmt and do the
following:
Me.DataSourceSearch.SelectCommand = "SELECT ... WHERE ...."
Me.gridResult.DataBind()

The datagrid has been designed with a generic SELECT command like "SELECT
*
FROM Mytable", that in my supposing should be overwritten by the
.SelectCommand stmt.

Problem: Clickng the Search button I get a correct first page Datagrid,
but
paging I then get data without any Where condition set.

I've tryed many other ways without success. Where is my fault?

Many thanks.
--
bruno

Aug 11 '06 #2
It worked.
Thanks
--
bruno
"Rohit Kukreti" wrote:
Try writing the statements you write in the Search button click in a
function (e.g. Bind) and then call it from Search button. And also in the
paging event instead call the new Bind method.

Regards,
Rohit

"bruno" <br***@community.nospamwrote in message
news:9E**********************************@microsof t.com...
I'm trying to dynamicaly change Where conditions in a Datagrid without
success.
The aspx form has some input fields, used to build the search, plus a
final
SEARCH button. In the click event I build the SQL Select stmt and do the
following:
Me.DataSourceSearch.SelectCommand = "SELECT ... WHERE ...."
Me.gridResult.DataBind()

The datagrid has been designed with a generic SELECT command like "SELECT
*
FROM Mytable", that in my supposing should be overwritten by the
.SelectCommand stmt.

Problem: Clickng the Search button I get a correct first page Datagrid,
but
paging I then get data without any Where condition set.

I've tryed many other ways without success. Where is my fault?

Many thanks.
--
bruno


Aug 11 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Paul Daly (MCP) | last post by:
How do you access the value of a cell in a Windows form datagrid? I know this is how you would do it using an ASP.NET datagrid: DataGrid1.Items.Cells.Text However, "Items" is not available in...
6
by: Dan | last post by:
I'd like to loop through selected datagrid rows and extract specified columns from those rows. How would I do that? Thanks... Dan
2
by: michael walser | last post by:
display checkbox in datagrid. I find that there are 3 status: checked - check box with click icon unchecked - blank in check box unknown - click icon but color in gray..... How can I set the...
1
by: SamIAm | last post by:
Hi I have a DataGrid called dgTraders 1 of the columns is a template column and this column has a Dropdown box in its HeaderTemplate section. The Dropdown box is called selCities. How do I...
1
by: msnews.microsoft.com | last post by:
Hello Every Body, I have the secnario, I have a web datagrid and in one template there is another datagrid. I means nested datagrid. The inner datagrid have three coloumns. Two coloumns are...
1
by: Raed Sawalha | last post by:
i have aspx page with user control containing a datagrid , the datagrid has TempleteColumn with checkbox in header and item ( doing multiselect task) I wondering how Can get the checkboxes status...
1
by: Wasco | last post by:
Hi All, somebody knows how can I implement a scrollable datagrid? I made one used DIV tag and the tricks of a datagrid for title and another for contents but I'm not satisfied. Thanks!!
1
by: Vili | last post by:
Hi all I have a datagrid with nested datagrid. How do I get event from dgNested button? I used example from...
0
by: rn5a | last post by:
All the rows in a DataGrid are accompanied by a CheckBox. When a user checks the rows & clicks a Button, the checked rows get deleted. For e.g. assume that the DataGrid displays 10 rows. A user...
3
by: tanya2001 | last post by:
hi m bac 2 trouble u agn can u tell me how do i update a datagrid which has got a datagrid which is displayed on a button click and thn it tht datagrid thr's a link which has 2 be updated...wen m...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.