sqldatasource default value

元气小坏坏 提交于 2019-12-13 00:05:26

问题


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:


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


来源:https://stackoverflow.com/questions/6596783/sqldatasource-default-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!