请帮我编码 [英] Please help me in coding

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

问题描述

您好,先生,
我想问一下我在gridview中使用了三个下拉菜单

Project,Module和Form我在rowdatabound中调用了所有下拉列表,我必须检查依赖项,例如当我选择Project时,项目内的所有模块都应出现在下拉列表中Module所有过程都将在gridview中发生请指导我如何显示依赖项

请指导我


我的代码是

Hello Sir,
I want to ask that I used three dropdown in gridview

Project,Module and Form I called all dropdown''s in rowdatabound,I have to check dependency like when I select Project all Module inside project should come in dropdown Module all process will happen in gridview Please guide me how could I show dependency

Please guide me


my code is

protected void grdDaily_RowDataBound(object sender, GridViewRowEventArgs e)
   {
       if (e.Row.RowType == DataControlRowType.DataRow)
       {
           //Projects values in drodpown
           dt = DelayworkReport.fillProjects();
           ListItem lst = new ListItem("Select", "0");
           DropDownList list = (DropDownList)e.Row.Cells[5].FindControl("ddlProject");
           list.DataTextField = "ProjectABR";
           list.DataValueField = "ProjectId";
           list.DataSource = dt;
           list.DataBind();
           list.AutoPostBack = true;
           list.Items.Insert(0, lst);

           //Module Values in dropdown
           dt = DelayworkReport.fillModule(Convert.ToInt32(ViewState["ddlProject"]));
           ListItem lst1 = new ListItem("Select", "0");
           DropDownList list1 = (DropDownList)e.Row.Cells[6].FindControl("ddlModule");
           list1.DataTextField = "ModuleName";
           list1.DataValueField = "ModuleId";
           list1.DataSource = dt;
           list1.DataBind();
           //list1.Enabled = false;
           list1.AutoPostBack = true;
           list1.Items.Insert(0, lst1);

           //Form Values in dropdonwn
           dt = DelayworkReport.fillTask(Convert.ToInt32(ViewState["ddlModule"]));
           ListItem lst2 = new ListItem("Select", "0");
           DropDownList list2 = (DropDownList)e.Row.Cells[7].FindControl("ddlForm");
           list2.DataTextField = "EntityType";
           list2.DataValueField = "EntityId";
           list2.DataSource = dt;
           list2.DataBind();
           //list2.Enabled = false;
           list2.AutoPostBack = true;
           list2.Items.Insert(0, lst2);

           //Status in dropdown
           dt = DelayworkReport.fillStatus();
           ListItem lst3 = new ListItem("Select", "0");
           DropDownList list3 = (DropDownList)e.Row.Cells[9].FindControl("ddlStatus");
           list3.DataTextField = "CompletionValue";
           list3.DataValueField = "CompletionId";
           list3.DataSource = dt;
           list3.DataBind();
           list3.AutoPostBack = true;
           list3.Items.Insert(0, lst3);

           CheckBox cb = (CheckBox)e.Row.FindControl("CheckBox");

       }

   }

推荐答案

DropDownList控件的OnSelectedIndexChanged事件,您可以在列表中填充适当的数据.

OnSelectedIndexChanged event of DropDownList control, you can fill the appropriate data in the list.

<aspropdownlist cssclass="TxtBox" id="Project" runat="server" tabindex="13" autopostback="true" onselectedindexchanged="Project_SelectedIndexChanged"></aspropdownlist>



Project_SelectedIndexChanged事件将填充相邻的DropDownList控件.



Project_SelectedIndexChanged event will fill the adjacent DropDownList control.


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

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