SqlDataSource的默认值 [英] sqldatasource default value

查看:253
本文介绍了SqlDataSource的默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何一个SqlDataSource参数的默认值设置为全选

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

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

感谢您的帮助。 SAURABH

Thanks for the help. saurabh

推荐答案

您可以这样做...

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

编辑::如果你想,当你点击按钮,它会选择所有的记录,而忽略了 where子句参数,然后作出一个重载的无参数,然后清除 SqlDataSource的选择时选择的参数 。例如,

If you want that when you click Select All button, it will pick all 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();
}

这篇关于SqlDataSource的默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆