saurabh goyal
saurabh goyal

Reputation: 1744

sqldatasource default value

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

Upvotes: 1

Views: 3148

Answers (1)

Muhammad Akhtar
Muhammad Akhtar

Reputation: 52241

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();
}

Upvotes: 2

Related Questions