找回密码
 立即注册

QQ登录

只需一步,快速开始

zhuyinyin_66
高级会员   /  发表于:2015-3-6 16:47  /   查看:8534  /  回复:5
二级分行<wijmo:C1ComboBox ID="C1ComboBox1" runat="server" AutoPostBack="True"
                        onselectedindexchanged="C1ComboBox1_SelectedIndexChanged1">
                    </wijmo:C1ComboBox>日不良率时点、月增减及年增减表

                string sql_date = "SELECT distinct([日期]) FROM [produce1].[dbo].[nong_erfen_jin] order by [日期] desc";
                DataTable dt_date = db.GetDataSet(sql_date, "ok");
                C1ComboBox1.DataTextField = "日期";
                C1ComboBox1.DataSource = dt_date;
                C1ComboBox1.DataBind();        

protected void C1ComboBox1_SelectedIndexChanged1(object sender, C1.Web.Wijmo.Controls.C1ComboBox.C1ComboBoxEventArgs args)
        {
            string fd = C1ComboBox1.SelectedValue.ToString();
            string f1 = C1ComboBox1.SelectedItem.ToString();
            string f2=C1ComboBox1.SelectedItem.Value.ToString();
        }

怎么取才正确呢

5 个回复

倒序浏览
zhuyinyin_66
高级会员   /  发表于:2015-3-6 16:54:00
沙发
用C1COMBOX必须要加<ScriptManager>吗
回复 使用道具 举报
zhuyinyin_66
高级会员   /  发表于:2015-3-6 17:06:00
板凳
已经明白了,谢谢,刚才没有设 C1ComboBox1.DataValueField,
            string fd = C1ComboBox1.SelectedValue.ToString();
string f2=C1ComboBox1.SelectedItem.Value.ToString();这两个都能取到值
回复 使用道具 举报
Alice
社区贡献组   /  发表于:2015-3-6 17:07:00
地板
回复 1楼zhuyinyin_66的帖子

SelectedItem是指选中的项,相当于一个对象,这个对象依然会有其他属性,比如Text, Value,Tooltip.
SelectedItem.Value和SelectedValue都是值选中的值。但是当你选中多个项目的时候,selecteditem.value返回的是选择的索引值中的最小的。
SelectedIndex是指选中项的索引,是从0开始计数的。

不太清楚你说的ScriptManager是否和我理解的一致。在我们的示例中并未使用这个。

另外C1ComboBox的在线示例,请参考:
http://demo.gcpowertools.com.cn/ ... ox/DataBinding.aspx

评分

参与人数 1满意度 +5 收起 理由
zhuyinyin_66 + 5 谢谢

查看全部评分

请点击评分,对我的服务做出评价!  5分为非常满意!

葡萄城控件服务团队

官方网站: http://www.gcpowertools.com.cn
回复 使用道具 举报
zhuyinyin_66
高级会员   /  发表于:2015-3-6 17:08:00
5#
回复 0楼zhuyinyin_66的帖子

In this topic you will create an ASP.NET web site and add a C1ComboBox control to the Default.aspx page.

Begin by creating an ASP.NET Web application. Note that if using Visual Studio 2008, you must add a ScriptManager control to the form. If using Visual Studio 2005, the ScriptManager control is automatically added to the form.
见英文文档里,说需要加ScriptManager
回复 使用道具 举报
Alice
社区贡献组   /  发表于:2015-3-6 18:07:00
6#
回复 5楼zhuyinyin_66的帖子

英文文档特指了VisualStudio2008。这个属于比较老的VisualStudio版本,我这里没有这个版本,所以不能为你做验证。
如果你在使用时候具体遇到了这个问题,可以提出来,我帮你看看。

评分

参与人数 1满意度 +5 收起 理由
zhuyinyin_66 + 5 谢谢

查看全部评分

请点击评分,对我的服务做出评价!  5分为非常满意!

葡萄城控件服务团队

官方网站: http://www.gcpowertools.com.cn
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部