hi,
I have two comboboxes were in combobo1 i have data of hospitals and linked hospital users to combobox but while i running the outpit i amnot getting exact list of users who all under certain hopspital, how can we get the same
- void CmbHospitalsSelectedIndexChanged(object sender, EventArgs e)
- {
- try
- {
- dynamic refobj = cmbHospitals.SelectedItem;
- MessageBox.Show(refobj.Key);
- cmbhusers.SelectedIndex = -1;
- cmbhusers.Items.Clear();
- if(true)
- {
- WebClient wc = new WebClient();
- wc.Headers["Content-type"] = "application/x-www-form-urlencoded";
- NameValueCollection collection = new NameValueCollection();
- collection.Add("hid",cmbHospitals.SelectedIndex.ToString());
- collection.Add("sno", "4");
- byte[] bret = wc.UploadValues(URLAuth, collection);
- string sret = "";
- sret = System.Text.Encoding.ASCII.GetString(bret);
- int count=0;
- string[,] husers ;
- if (sret != "")
- {
- XmlDocument readDoc = new XmlDocument();
- readDoc.LoadXml(sret);
- count = readDoc.SelectNodes("hospitalusers/huids").Count;
- husers = new string[count, 2];
- XmlNodeList xhuid = readDoc.GetElementsByTagName("huid");
- XmlNodeList xuser_name = readDoc.GetElementsByTagName("user_name");
- for (int i= 0; i < count; i++)
- {
- husers[i,0] = xhuid[i].InnerText;
- husers[i, 1] = xuser_name[i].InnerText;
- }
- cmbhusers.DisplayMember="text";
- cmbhusers.ValueMember="key";
- for (int i = 0; i < husers.GetLength(0); i++)
- {
- cmbhusers.Items.Add(new { text = husers[i, 1], key=Convert.ToInt16(husers[i,0])});
- }
- }
- }
- }
- catch (NullReferenceException e1)
- {
- MessageBox.Show(e1.Message);
- }
- }