1

How do I set the default value of a SQLdatasource parameter to the select all

<asp:Parameter Name="original_lastsaved" Type="string" defaultvalue="???"/> 

Thanks for the help. saurabh

1 Answer 1

2

You can do like...

SqlDataSource1.SelectParameters["original_lastsaved"].DefaultValue = "Set Value here";

Edit: If you want that when you click the Select All button, it will pick up all of the record and ignore the where clause parameter, then make an overloaded with no parameter and then clear the Select parameter in SQLDataSource Selecting event. e.g.

protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
    SqlDataSource1.SelectParameters.Clear();
}
Sign up to request clarification or add additional context in comments.

2 Comments

sorry you got my question wrong . i mean if parameter value is empty suppose in control parameter then how will i show all the records.
hmm.it might work . but i already got a simple solution for that simply set the default value as '%'.sorry for sharing the answer late

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.