protected void bindhostelname() { try { ds.Clear(); ds = d2.Bindmess_basedonrights(Session["usercode"].ToString(), Session["collegecode"].ToString()); ddl_Messname.Items.Clear(); if (ds.Tables[0].Rows.Count > 0) { ddl_Messname.DataSource = ds; ddl_Messname.DataTextField = "MessName"; ddl_Messname.DataValueField = "MessMasterPK"; ddl_Messname.DataBind(); Hostelcode = ddl_Messname.SelectedItem.Value; } else { alertmessage.Visible = true; lbl_alerterror.Text = "Please Set Mess Rights"; } bindsession(); } catch { } }
public void bindhostelname() { try { cbl_hostelname.Items.Clear(); ds.Clear(); //ds = d2.Bindmess_inv(collegecode1); ds = d2.Bindmess_basedonrights(usercode, collegecode1); if (ds.Tables[0].Rows.Count > 0) { cbl_hostelname.DataSource = ds; cbl_hostelname.DataTextField = "MessName"; cbl_hostelname.DataValueField = "MessMasterPK"; cbl_hostelname.DataBind(); if (cbl_hostelname.Items.Count > 0) { for (int i = 0; i < cbl_hostelname.Items.Count; i++) { cbl_hostelname.Items[i].Selected = true; cb_hostelname.Checked = true; } txt_hostelname.Text = "Mess Name(" + cbl_hostelname.Items.Count + ")"; } } else { txt_hostelname.Text = "--Select--"; } } catch { } }