public void BindOfficer() { bl_RTI_Request objblData = new bl_RTI_Request(); dl_RTIReAssign objData = new dl_RTIReAssign(); ReturnClass.ReturnDataTable rd = new ReturnClass.ReturnDataTable(); //DDL_RTI_Officer.Items.Clear(); objblData.Base_department_id = ddl_department.SelectedValue; objblData.District_id_ofc = ddl_district.SelectedValue; objblData.Office_id = ddl_office.SelectedValue; rd = objData.BindOfficerDL(objblData); ddl_officer.DataSource = rd.table; ddl_officer.DataTextField = "Name_en"; ddl_officer.DataValueField = "office_mapping_id"; ddl_officer.DataBind(); // DDL_RTI_Officer.Items.Add(new ListItem(" select officer", "0")); ddl_officer.Items.Insert(0, new ListItem("--Select Officer--", "0")); }
public void bind_grid_officer() { DropDownList ddl_office = (DropDownList)GridView1.Rows[GridView1.EditIndex].FindControl("ddl_office_grid"); DropDownList ddl_district = (DropDownList)GridView1.Rows[GridView1.EditIndex].FindControl("ddl_district_grid"); DropDownList ddl_department = (DropDownList)GridView1.Rows[GridView1.EditIndex].FindControl("ddl_department_grid"); DropDownList ddl_officer = (DropDownList)GridView1.Rows[GridView1.EditIndex].FindControl("ddl_officer_grid"); bl_RTI_Request objblData = new bl_RTI_Request(); dl_RTIReAssign objData = new dl_RTIReAssign(); ReturnClass.ReturnDataTable rd = new ReturnClass.ReturnDataTable(); objblData.District_id_ofc = ddl_district.SelectedValue; objblData.Base_department_id = ddl_department.SelectedValue; objblData.Office_id = ddl_office.SelectedValue; rd = objData.BindOfficerDL(objblData); ddl_officer.DataSource = rd.table; ddl_officer.DataTextField = "Name_en"; ddl_officer.DataValueField = "office_mapping_id"; ddl_officer.DataBind(); ddl_officer.Items.Insert(0, new ListItem("--Select Officer--", "0")); }
protected void RowDataBound(object sender, GridViewRowEventArgs e) { //GridViewRow gvRow = e.Row; //if (gvRow.RowType == DataControlRowType.Header) //{ // GridViewRow gvrow = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert); // TableCell cell0 = new TableCell(); // cell0.Text = "RTI Information"; // cell0.HorizontalAlign = HorizontalAlign.Center; // cell0.ColumnSpan = 5; // TableCell cell1 = new TableCell(); // cell1.Text = "Office Information"; // cell1.HorizontalAlign = HorizontalAlign.Center; // cell1.ColumnSpan = 5; // gvrow.Cells.Add(cell0); // gvrow.Cells.Add(cell1); // GridView1.Controls[0].Controls.AddAt(0, gvrow); //} if (e.Row.RowType == DataControlRowType.DataRow) { //if (e.Row.RowType == DataControlRowType.DataRow && GridView1.EditIndex == e.Row.RowIndex) //{ // DropDownList ddl_state = (DropDownList)e.Row.FindControl("ddl_state"); // rd = dl.state_code(); // ddl_state.DataSource = rd.table; // ddl_state.DataTextField = "state_name_e"; // ddl_state.DataValueField = "state_id"; // ddl_state.DataBind(); // ddl_state.Items.Insert(0, new ListItem("Select", "0")); // ddl_state.SelectedValue = GridView1.DataKeys[e.Row.RowIndex].Values["state_id"].ToString(); //} if (e.Row.RowType == DataControlRowType.DataRow && GridView1.EditIndex == e.Row.RowIndex) { DropDownList ddl_district = (DropDownList)e.Row.FindControl("ddl_district_grid"); //DropDownList ddl_state = (DropDownList)e.Row.FindControl("ddl_state"); bl.StateCode = "22"; rd = dl.district_code(bl); ddl_district.DataSource = rd.table; ddl_district.DataTextField = "District_Name"; ddl_district.DataValueField = "District_ID"; ddl_district.DataBind(); ddl_district.Items.Insert(0, new ListItem("--Select--", "0")); ddl_district.SelectedValue = GridView1.DataKeys[e.Row.RowIndex].Values["dist_id"].ToString(); } } if (e.Row.RowType == DataControlRowType.DataRow && GridView1.EditIndex == e.Row.RowIndex) { DropDownList ddl_department = (DropDownList)e.Row.FindControl("ddl_department_grid"); rd = dl.department_id(bl); ddl_department.DataSource = rd.table; ddl_department.DataTextField = "dept_name"; ddl_department.DataValueField = "dept_id"; ddl_department.DataBind(); ddl_department.Items.Insert(0, new ListItem("--Select--", "0")); ddl_department.SelectedValue = GridView1.DataKeys[e.Row.RowIndex].Values["dept_id"].ToString(); } if (e.Row.RowType == DataControlRowType.DataRow && GridView1.EditIndex == e.Row.RowIndex) { DropDownList ddl_office = (DropDownList)e.Row.FindControl("ddl_office_grid"); DropDownList ddl_district = (DropDownList)e.Row.FindControl("ddl_district_grid"); // DropDownList ddl_state = (DropDownList)e.Row.FindControl("ddl_state"); DropDownList ddl_department = (DropDownList)e.Row.FindControl("ddl_department_grid"); bl.StateCode = "22"; bl.DistrictCodeNew = ddl_district.SelectedValue; bl.Department = ddl_department.SelectedValue; rd = dl.office(bl); ddl_office.DataSource = rd.table; ddl_office.DataTextField = "OfficeName"; ddl_office.DataValueField = "NewOfficeCode"; ddl_office.DataBind(); ddl_office.Items.Insert(0, new ListItem("--Select--", "0")); ddl_office.SelectedValue = GridView1.DataKeys[e.Row.RowIndex].Values["ofc_id"].ToString(); } if (e.Row.RowType == DataControlRowType.DataRow && GridView1.EditIndex == e.Row.RowIndex) { DropDownList ddl_office = (DropDownList)e.Row.FindControl("ddl_office_grid"); DropDownList ddl_district = (DropDownList)e.Row.FindControl("ddl_district_grid"); DropDownList ddl_department = (DropDownList)e.Row.FindControl("ddl_department_grid"); DropDownList ddl_officer = (DropDownList)e.Row.FindControl("ddl_officer_grid"); bl_RTI_Request objblData = new bl_RTI_Request(); dl_RTIReAssign objData = new dl_RTIReAssign(); ReturnClass.ReturnDataTable rd = new ReturnClass.ReturnDataTable(); objblData.District_id_ofc = ddl_district.SelectedValue; objblData.Base_department_id = ddl_department.SelectedValue; objblData.Office_id = ddl_office.SelectedValue; rd = objData.BindOfficerDL(objblData); ddl_officer.DataSource = rd.table; ddl_officer.DataTextField = "Name_en"; ddl_officer.DataValueField = "office_mapping_id"; ddl_officer.DataBind(); ddl_officer.Items.Insert(0, new ListItem("--Select Officer--", "0")); ddl_officer.SelectedValue = GridView1.DataKeys[e.Row.RowIndex].Values["ofc_map_id"].ToString(); } if (e.Row.RowType == DataControlRowType.DataRow && GridView1.EditIndex == e.Row.RowIndex) { DropDownList ddl_status = (DropDownList)e.Row.FindControl("ddl_dept_status"); dl_RTIReAssign objData = new dl_RTIReAssign(); ReturnClass.ReturnDataTable rd = new ReturnClass.ReturnDataTable(); rd = objData.BindRTIStatusDL(); ddl_status.DataSource = rd.table; ddl_status.DataTextField = "name"; ddl_status.DataValueField = "value"; ddl_status.DataBind(); ddl_status.Items.Insert(0, new ListItem("--Select Status--", "0")); } //if (Page.IsPostBack) //{ // if (e.Row.RowType == DataControlRowType.DataRow) // { // DropDownList ddl = e.Row.FindControl("ddl_district_grid") as DropDownList; // if (ddl != null) // { // ddl.AutoPostBack = true; // ddl.SelectedIndexChanged += new EventHandler(ddl_grid_district_SelectedIndexChanged); // } // } //} }