protected void DrpApplications_SelectedIndexChanged(object sender, EventArgs e) { localhost1.WebService1 obj = new localhost1.WebService1(); DropDownList drp = sender as DropDownList; if (drp != null) { int id = Convert.ToInt32(drp.SelectedItem.Value); int GridViewItemIndex = ((GridViewRow)drp.NamingContainer).RowIndex; //DropDownList Drpapptype = (DropDownList)RptAddefforts.Items[RepeaterItemIndex].FindControl("DrpApplicationType"); DropDownList Drpapptype = (DropDownList)GridView1.FindControl("DropDownList4"); //DropDownList Drpvendor = (DropDownList)RptAddefforts.Items[RepeaterItemIndex].FindControl("DrpVendor"); if (Drpapptype != null) { DataTable dtapplications = obj.BindCascadingDropList("applications", id); if (dtapplications != null && dtapplications.Rows.Count > 0) { Drpapptype.SelectedIndex = Drpapptype.Items.IndexOf(Drpapptype.Items.FindByValue(Convert.ToString(dtapplications.Rows[0]["AppCat_id"]))); // Drpvendor.SelectedIndex = Drpvendor.Items.IndexOf(Drpvendor.Items.FindByValue(Convert.ToString(dtapplications.Rows[0]["AppVendor_Id"]))); Drpapptype.Enabled = false; // Drpvendor.Enabled = false; } } } }
protected void DrpTicketType_SelectedIndexChanged(object sender, EventArgs e) { localhost1.WebService1 obj = new localhost1.WebService1(); DropDownList drp = sender as DropDownList; if (drp != null) { int id = Convert.ToInt32(drp.SelectedItem.Value); int GridViewItemIndex = ((GridViewRow)drp.NamingContainer).RowIndex; // DropDownList Drpclass = (DropDownList)GridView1.Items[RepeaterItemIndex].FindControl("DrpClassification"); DropDownList Drpclass = (DropDownList)GridView1.FindControl("DropDownList2"); if (Drpclass != null) { DataTable DtClassfication = obj.BindCascadingDropList("classification", id); if (DtClassfication != null && DtClassfication.Rows.Count > 0) { Drpclass.Items.Clear(); Drpclass.DataSource = DtClassfication; Drpclass.DataTextField = "TClassification_Name"; Drpclass.DataValueField = "TClassification_Id"; Drpclass.DataBind(); } } } }
private bool validateuser(string userid, string password) { bool result = false; SqlConnection con = new SqlConnection(); try { localhost1.WebService1 obj = new localhost1.WebService1(); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(obj.GetResourceDetails(TxtUserId.Value, TxtPassword.Value)); DataSet ds = new DataSet(); XmlNodeReader xmlreader = new XmlNodeReader(xmlDoc); ds.ReadXml(xmlreader, XmlReadMode.Auto); string dbUserID = ds.Tables[0].Rows[0].Field <string>("RName"); string Userpassword = ds.Tables[0].Rows[0].Field <string>("RPassword"); // string ResourceId = ds.Tables["TblResource"].Rows[0]["RID"].ToString(); //string dbUserID = ds.Tables["Tblresource"].Rows[0]["RName"].ToString(); // string Userpassword = ds.Tables["TblResource"].Rows[0]["RPassword"].ToString(); string ResourceId = ds.Tables[0].Rows[0].Field <string>("RID"); string RRole = ds.Tables[0].Rows[0].Field <string>("RROLE"); TxtUserId.Value = dbUserID; TxtPassword.Value = Userpassword; if (dbUserID.ToLower().Equals(userid.ToLower()) && Userpassword.Equals(password)) { Session["resourceid"] = ResourceId; Session["Username"] = TxtUserId.Value; Session["Role"] = RRole; result = true; } else { result = false; } } catch (Exception M) { } finally { if (con.State == ConnectionState.Open) { con.Close(); } } return(result); }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DropDownList drptickettype = (DropDownList)e.Row.FindControl("DropDownList2"); DropDownList DrpApplications = (DropDownList)e.Row.FindControl("DropDownList3"); DropDownList DrpApplicationType = (DropDownList)e.Row.FindControl("DropDownList4"); // DropDownList DrpVendor = (DropDownList)e.Item.FindControl("DrpVendor"); DropDownList DrpClassification = (DropDownList)e.Row.FindControl("DropDownList5"); // DropDownList DrpTicketStatus = (DropDownList)e.Item.FindControl("DrpTicketStatus"); Button BtnDelete = (Button)e.Row.FindControl("Btndelete"); localhost1.WebService1 obj = new localhost1.WebService1(); BindDropList("tickettype", drptickettype); BindDropList("applications", DrpApplications); BindDropList("applicationtype", DrpApplicationType); //BindDropList("vendor", DrpVendor); BindDropList("classification", DrpClassification); // BindDropList("ticketstatus", DrpTicketStatus); Label LblTEID = ((Label)e.Row.FindControl("Label2")); DataTable DtPagedData = ((DataTable)ViewState["PagedData"]); if (DtPagedData != null && DtPagedData.Rows.Count > 0) { DataRow[] DR = DtPagedData.Select("TEID ='" + LblTEID.Text + "'"); if (DR != null && DR.Count() > 0) { drptickettype.SelectedIndex = drptickettype.Items.IndexOf(drptickettype.Items.FindByValue(Convert.ToString(DR[0]["TicketTypeId"]))); DrpApplications.SelectedIndex = DrpApplications.Items.IndexOf(DrpApplications.Items.FindByValue(Convert.ToString(DR[0]["ApplicationId"]))); DrpClassification.SelectedIndex = DrpClassification.Items.IndexOf(DrpClassification.Items.FindByValue(Convert.ToString(DR[0]["ClassificationId"]))); DrpApplicationType.SelectedIndex = DrpApplicationType.Items.IndexOf(DrpApplicationType.Items.FindByValue(Convert.ToString(DR[0]["ApplicationTypeId"]))); //DrpVendor.SelectedIndex = DrpVendor.Items.IndexOf(DrpVendor.Items.FindByValue(Convert.ToString(DR[0]["VendorId"]))); //DrpTicketStatus.SelectedIndex = DrpTicketStatus.Items.IndexOf(DrpTicketStatus.Items.FindByValue(Convert.ToString(DR[0]["TicketStatusId"]))); bindpastdropdowndata(DrpClassification, Convert.ToInt32(drptickettype.SelectedItem.Value)); DrpClassification.SelectedIndex = DrpClassification.Items.IndexOf(DrpClassification.Items.FindByValue(Convert.ToString(DR[0]["ClassificationId"]))); if (LblPagemode.Text == "U") { BtnDelete.Visible = true; } else { BtnDelete.Visible = true; //BtnDelete.Visible =false; } } } } }
private void bindpastdropdowndata(DropDownList drplist, int id) { localhost1.WebService1 obj = new localhost1.WebService1(); if (drplist != null) { DataTable DtClassfication = obj.BindCascadingDropList("classification", id); if (DtClassfication != null && DtClassfication.Rows.Count > 0) { drplist.Items.Clear(); drplist.DataSource = DtClassfication; drplist.DataTextField = "TClassification_Name"; drplist.DataValueField = "TClassification_Id"; drplist.DataBind(); } } }