|
Hello folks,
I have a SqlDataSource wired up to a GridView . I let the user filter by typing a value in a text box and invoking a parameterized FilterExpression . The GridView is set to have paging enabled and display, e.g., 10 records/page.
When I do a filter by typing an expression in a TextBox and clicking Submit, the GridView changes to display my query. Say for example the query returned 24 rows, so with my paging the GridView displays 3 pages. When I click a page in the Pager, the GridView 'forgets' my query and reverts back to displaying the entire table bound to it with the SelectCommand property.
How do I make a GridView 'remember' its filter results set between pages? I assume I handle GridView1_OnPageIndexChanging however I am a newbie, and it's not immediately appearent to me what sort of code I might use to ensure the query is remembered, so I could click 'Page 2' and actually get Page 2 of my filter instead of Page 2 of the whole table...
Thanks in advance.
Sincerely Yours,
Brian Hart
Department of Physics and Astronomy
University of California, Irvine
|
|
|
|
|
I found a solution that worked for me....my SqlDataSource.FilterExpression in the page code is:
<asp:SqlDataSource ID="SqlDataSource1" ... FilterExpression="{0} LIKE '%{1}%'">
<FilterParameters>
<asp:ControlParameter ControlID="SearchField" Name="field" PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="Value" Name="value"
PropertyName="Text" Type="String" />
</FilterParameters> To solve my problem above, I handled the GridView.PreRender event like so:
protected void GridView1_PreRender(object sender, EventArgs e)
{
SqlDataSource1.FilterExpression = "{0} LIKE \'%{1}%\'";
}
Basically, I just re-initialized my FilterExpression every time the GridView.PreRender event is fired. Thanks to you all.
|
|
|
|
|
How would I get the length of a textbox using VBA when there is no such code such as:
Dim intIndex, intIndexMax As Integer
intIndexMax = txtOutputFilePath.Length
For intIndex = intIndexMax To 0 Step -1
Next
Does anybody have some code to separate the directory path from the directory path and file name combination? Please provide some assistance...
|
|
|
|
|
Use a ruler?
(Or maybe something like txtOutputFilePath.Value.Length)
|
|
|
|
|
I think that I may not have stated my question clearly. What I meant was the length of the string value in the textbox not the width of the actual textbox as an object on the form.
I tried to assign the value to a string and to check that but I cannot get the strTextBox.Length value either.
Instead, I decided to use the FileDialog Common Dialog control. However, I am having some trouble retrieving values from that control as well. Please see the message above.
|
|
|
|
|
new_phoenix
Try: strTextBox.Text.Length
ken
|
|
|
|
|
Does anybody have some code to separate the directory path from the directory path and file name combination? Please provide some assistance...
try using dir() like this..
<br />
dir(txtOutputFilePath.text)<br />
im using it on vb6 hope it helps you..
|
|
|
|
|
hi
my aim is to create a ms access database table using c#.net
query for creating a table which i am using is
create table tab
(
name varchar(30),
dateofbirth datetime,
photo ole object
)
now the error is coming at ole position please suggest me what database type should i replace from Ole object to get rid of the problem
i will be heartly thankful to ......U.......
regards
sindhu tiwari
Always Innovative
|
|
|
|
|
use the key word image instead
create table tab
(
name varchar(30),
dateofbirth datetime,
photo image
)
cheers
Raz
/*
Ghazi Hadi Al Wadi, PMP, ASQ SSGB, DBA
*/
|
|
|
|
|
Hi all,
I have a SQL2005 database running in my PC.I would like to keep a back up to a CD.However i am not sure which files i have to copy.
When i try to copy database primary Datafile in C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data
It Comes up with an error saying file is being used,can't copy.
Please advice
Thanks
|
|
|
|
|
Copying files is not the right way to do it.
You should create a backup for the database as described here[^]
you get "file is being used" because SQL Server service opens the file.
|
|
|
|
|
Thank you very much.Its very helpfull.
After having the file forinstance BackUP_database.bak.Does it mean that this file contains all the script for creating the database together with the datas stored in table.
Thanks
|
|
|
|
|
Yes. If you use full backup option.
|
|
|
|
|
Hi Frieds.
how can i Insert Multiple rows from frontend through a single query.
thanx in advance..
Amit Metkar
3i-infotech, Mumbai.
|
|
|
|
|
|
hi
Please clarify your question
regards
Joe
|
|
|
|
|
I m Using .Net as Front end, in code behind i hv a datatable which has multiple rows (row count is variable),
And now i want to insert this data of datatable into database through a single SP/query..
Amit Metkar
3i-infotech, Mumbai.
|
|
|
|
|
Use Databasename
GO
INSERT INTO tablename(Fieldname)
SELECT 'raj'
UNION ALL
SELECT 'mukesh'
UNION ALL
SELECT 'aneesh'
UNION ALL
SELECT 'pradeep'
UNION ALL
SELECT 'kishore'
GO
try this...
|
|
|
|
|
Thanks
but i can not use this type of query, because row count is variable and i want to insert all row at a time.
Amit Metkar
3i-infotech, Mumbai.
|
|
|
|
|
I think we can't get directly...additionally we have to use temp table like following query...
INSERT INTO mainTable SELECT * FROM tempTable;
|
|
|
|
|
Pass it as xml and use OpenXml in the stored procedure?
|
|
|
|
|
Hi
I am using an Oledb connection in my application.
My connection string is
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; datasource=C:\\Project\\DataBase.mdb");
and I am getting Oledb Exception at
OleDbDataReader dr = cmd.ExecuteReader();
What is the problem,help me
Thank u
Deepak
|
|
|
|
|
whats the command u r using
its me sid
|
|
|
|
|
Hi
This is my command
OleDbCommand cmd = new OleDbCommand("select * from Employee where EmpID=" + ListBox1.SelectedValue,con);
Thank u
Deepak
|
|
|
|
|
write this one
oledbcommand cmd = new oledbcommand("select * from employee where empid = @a",con)
cmd.parameters.addwithvalue("@a",listbox1.selectedvalue.text)
its me sid
|
|
|
|