首页 > 开发 > 综合 > 正文

动态绑定DATAGRID里的dropDownList

2024-07-21 02:25:29
字体:
来源:转载
供稿:网友
if(e.item.itemtype==listitemtype.edititem)
   {
    datarowview drv=(datarowview)e.item.dataitem;
    string currentvalue=drv["cur_id"].tostring();
    dropdownlist ddl=(dropdownlist)e.item.findcontrol("ddl_curinfo");
    datatable table=readcurinfo();
    ddl.datasource=table;
    ddl.datatextfield="cur_chname";
    ddl.datavaluefield="cur_id";
    ddl.databind();
    ddl.items.insert(0,new listitem("请选择",""));
    ddl.selectedindex=ddl.items.indexof(ddl.items.findbyvalue(currentvalue));
   }
   if(e.item.itemtype==listitemtype.alternatingitem||e.item.itemtype==listitemtype.item)
   {
    hyperlink hpl=(hyperlink)e.item.findcontrol("hpy_attch");
    datarowview drv=(datarowview)e.item.dataitem;
    string fileattch=drv["ownmana_appendfile"].tostring();
    hpl.navigateurl=fileattch;
    hpl.text=fileattch.substring(fileattch.lastindexof(@"/")+1);
   }
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表