public void loadhostel() { try { //string bindhostel = "select HostelName,HostelMasterPK from HM_HostelMaster"; //ds.Clear(); //ds = d2.select_method_wo_parameter(bindhostel, "TEXT"); string MessmasterFK = d2.GetFunction("select value from Master_Settings where settings='Mess Rights' and usercode='" + usercode + "'"); ds = d2.BindHostelbaseonmessrights_inv(MessmasterFK); if (ds.Tables[0].Rows.Count > 0) { cbl_hostelname.DataSource = ds; cbl_hostelname.DataTextField = "HostelName"; cbl_hostelname.DataValueField = "HostelMasterPK"; cbl_hostelname.DataBind(); ddl_hostelname.DataSource = ds; ddl_hostelname.DataTextField = "HostelName"; ddl_hostelname.DataValueField = "HostelMasterPK"; ddl_hostelname.DataBind(); ddl_hostelname.Items.Insert(0, "Select"); if (cbl_hostelname.Items.Count > 0) { for (int i = 0; i < cbl_hostelname.Items.Count; i++) { cbl_hostelname.Items[i].Selected = true; } txt_hostelname.Text = "Hostel Name(" + cbl_hostelname.Items.Count + ")"; } } else { ddl_hostelname.Items.Insert(0, "Select"); txt_hostelname.Text = "--Select--"; } } catch { } }