English 中文(简体)
清单箱在选定的IndexChange大火后回到第一个项目
原标题:List box pops back to the first item after SelectedIndexChange event fires
  • 时间:2012-05-11 12:29:16
  •  标签:
  • c#
  • asp.net

我有3次降级控制,有一次选定的指数变化活动,火灾是正确的。 然而,在你从清单中选择一个项目时,返回选定指数变动活动的指数值没有变化;清单箱又回到名单上的第一个项目。 希望得到任何帮助。 ~Dharmendra~

`public partial class Production : System.Web.UI.Page
{ 
    EmployeeQuotientCL.Production _production = null;
    DataSet dsNatureOfWork = new DataSet();
    DataSet dsProjectRegion = new DataSet();
    DataSet dsCountyDetails = new DataSet();
    DataSet dsWorkType = new DataSet();
    DataSet dsTask = new DataSet();


    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
             string userEcode=Convert.ToString(Session["UserID"]); 
            _production = new EmployeeQuotientCL.Production();                       
            dsNatureOfWork = _production.GetNatureOfWork();
            if (dsNatureOfWork.Tables[0].Rows.Count > 0)
            {
                BindDdlNatureOfWork(dsNatureOfWork);
            }
            else
            {
            }
        }            

    }



    public void BindDdlNatureOfWork(DataSet dsNatureOfWork)
    {
        ddlNatureofWork.DataSource = dsNatureOfWork.Tables[0];
        ddlNatureofWork.DataTextField = "NatureOfWorkName";
        ddlNatureofWork.DataValueField = "NatureOfWorkID";
        ddlNatureofWork.DataBind();
        ddlNatureofWork.Items.Insert(0, "--Select Nature of Work--");
    }

    public void FillRegionProject(int NatureOfWorkID)
    {
        if ((NatureOfWorkID != null) || (NatureOfWorkID != 0))
        {
            _production = new EmployeeQuotientCL.Production();
            dsProjectRegion = _production.GetProjectRegion(NatureOfWorkID);
            if (dsProjectRegion.Tables[0].Rows.Count > 0)
            {
                ddlRegionProjectName.DataSource = dsProjectRegion.Tables[0];
                ddlRegionProjectName.DataTextField = "RegionProjectName";
                ddlRegionProjectName.DataValueField = "RegionProjectID";
                ddlRegionProjectName.DataBind();
                ddlRegionProjectName.Items.Insert(0, "--Select Region/Project--");

            }
            else
            {
            }
        }

    }

    protected void ddlRegionProjectName_SelectedIndexChanged(object sender, EventArgs e)
    {
        int RegionProjectID = Convert.ToInt32(ddlRegionProjectName.SelectedValue.ToString());
        FillCounty(RegionProjectID);
        ddlRegionProjectName.SelectedIndex = 0;

    }

    public void FillCounty(int regionprojectID)
    {
        if ((regionprojectID != null) || (regionprojectID != 0))
        {
            _production = new EmployeeQuotientCL.Production();
            dsCountyDetails = _production.GetCounty(regionprojectID);
            if (dsCountyDetails.Tables[0].Rows.Count > 0)
            {
                ddlCountyName.DataSource = dsCountyDetails.Tables[0];
                ddlCountyName.DataTextField = "CountyName";
                ddlCountyName.DataValueField = "CountyID";
                ddlCountyName.DataBind();
                ddlCountyName.Items.Insert(0, "--Select County--");

            }
            else
            {
            }
        }
    }

    protected void ddlNatureofWork_SelectedIndexChanged(object sender, EventArgs e)
    {
        int NowID = Convert.ToInt32(ddlNatureofWork.SelectedValue.ToString());
        FillRegionProject(NowID);
        ddlRegionProjectName.SelectedIndex = 0;
    }

}

iii ......

最佳回答

页: 1

你没有在你们共享的法典中控制dlCountyName的活动。

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签