Click here to Skip to main content
15,918,303 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionUploading Sql Database Pin
Ashish Porwal2-Dec-06 1:39
Ashish Porwal2-Dec-06 1:39 
AnswerRe: Uploading Sql Database Pin
jszulc2-Dec-06 1:59
jszulc2-Dec-06 1:59 
QuestionActive Report and Email Sending? Pin
Tridip Bhattacharjee2-Dec-06 1:38
professionalTridip Bhattacharjee2-Dec-06 1:38 
QuestionDropDownList Serach not showing what stored procedure displays during run Pin
jszulc2-Dec-06 1:38
jszulc2-Dec-06 1:38 
QuestionJavascript Problem Pin
monika_vasvani2-Dec-06 1:15
monika_vasvani2-Dec-06 1:15 
AnswerRe: Javascript Problem Pin
Guffa2-Dec-06 4:55
Guffa2-Dec-06 4:55 
AnswerRe: Javascript Problem Pin
K.P.Kannan2-Dec-06 13:48
K.P.Kannan2-Dec-06 13:48 
QuestionDynamic selectcommand and paging/sorting Pin
MarkLF2-Dec-06 0:29
MarkLF2-Dec-06 0:29 
Hi,

I know I am not the only one struggling with the following, but so far
I have not seen a solution.


Problem:
I have an asp.net 2.0 web page with a gridview which is bound to an
accessdatasource. In my code-behind I want to be able to set the
selectcommand of the datasource to a specific SQL string based on a
user's input to retrieve only certain records.


This works fine when I hit the search button. BUT, as soon as I start
paging or sorting (gridview's default), the accessdatasource seems to
revert back to the initial select command "SELECT * FROM tblProduct"
and all records are shown again.


I know that I could maintain state for the selectcommand using session
variables, but I would like to see a cleaner solution.


My code in aspx:
<asp:accessdatasource id="AccessDataSource1"
datafile="~/App_Data/product.mdb" selectcommand="SELECT * FROM
tblProduct" runat="server" datasourcemode="DataSet">


My code in code-behind:
AccessDataSource1.SelectCommand = "SELECT * FROM tblProduct WHERE
[brand]='" & txtBrandCustom.Text & "'"


Hopefully, anyone out there will have a solution for me!


Regards,


Mark
QuestionData Access Pin
Shriya Kapoor1-Dec-06 23:23
Shriya Kapoor1-Dec-06 23:23 
AnswerRe: Data Access Pin
Bassam Saoud2-Dec-06 1:16
Bassam Saoud2-Dec-06 1:16 
QuestionFrom Child browser to Parent browser Pin
indian1431-Dec-06 23:10
indian1431-Dec-06 23:10 
GeneralRe: From Child browser to Parent browser Pin
Guffa2-Dec-06 8:35
Guffa2-Dec-06 8:35 
GeneralFrom Child browser to Parent browser Pin
indian1433-Dec-06 18:01
indian1433-Dec-06 18:01 
GeneralRe: From Child browser to Parent browser Pin
Guffa3-Dec-06 19:24
Guffa3-Dec-06 19:24 
QuestionFor communication between child browser to parent browser [modified] Pin
indian1431-Dec-06 23:01
indian1431-Dec-06 23:01 
Questionhow to read values UserControl Valuse(textBox) from the datagrid? Pin
nabeelkhan1-Dec-06 22:56
nabeelkhan1-Dec-06 22:56 
QuestionCommunication between child browser to parent browser Pin
indian1431-Dec-06 22:50
indian1431-Dec-06 22:50 
QuestionRead PST File Pin
aaraaayen1-Dec-06 20:14
aaraaayen1-Dec-06 20:14 
AnswerRe: Read PST File Pin
Vasudevan Deepak Kumar1-Dec-06 20:56
Vasudevan Deepak Kumar1-Dec-06 20:56 
QuestionDataList's OnItemCreated events get called without page load event..! Need Help Pin
Sachin Pawar A.1-Dec-06 19:52
Sachin Pawar A.1-Dec-06 19:52 
QuestionHow to make a progress bar?? Pin
miss_neha_mishra1-Dec-06 19:43
miss_neha_mishra1-Dec-06 19:43 
AnswerRe: How to make a progress bar?? Pin
Dominic Pettifer2-Dec-06 6:13
Dominic Pettifer2-Dec-06 6:13 
QuestionCheckbox Problem Pin
monika_vasvani1-Dec-06 18:46
monika_vasvani1-Dec-06 18:46 
AnswerRe: Checkbox Problem Pin
Not Active1-Dec-06 18:53
mentorNot Active1-Dec-06 18:53 
Questionshow menu ites show over the dropdown list Pin
yesu prakash1-Dec-06 18:39
yesu prakash1-Dec-06 18:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.