hi
I have a list box with some country names from database.
when i click search button the "country" list selecteditem should be selected.
but it is not.
here is my code where iam using a stored procedure which is outputting 3 tables simultaneously.
the list box of country is 3rd table that is table[2]
if iam using the above condition its neither showing any results nor debugger entering the if condition
when i use this condition as table is passing string it is showing error.
plz help me out where iam going wrong
thanks,
raam
I have a list box with some country names from database.
when i click search button the "country" list selecteditem should be selected.
but it is not.
here is my code where iam using a stored procedure which is outputting 3 tables simultaneously.
the list box of country is 3rd table that is table[2]
Code:
if (objDataSet.Tables[1].Rows.Count > 0)
{
for (int i = 0; i < objDataSet.Tables[1].Rows.Count; i++)
{
int k;
k = Convert.ToInt32(objDataSet.Tables[1].Rows[i][0]);
lbspecialty.Items[k].Selected = true;
lbspecialty.Items.FindByText("select").Selected = false;
}
}
else
{
lbspecialty.Items.FindByText("select").Selected = true;
}
if (objDataSet.Tables[2].Rows.Count > 0)
{
for (int i = 0; i < objDataSet.Tables[2].Rows.Count; i++)
{
string k;
k = objDataSet.Tables[2].Rows[i][0].ToString();
//k = Convert.ToInt32(objDataSet.Tables[2].Rows[i][0]);
lstgbgterr.Items.FindByText("k").Selected=true;
lstgbgterr.Items.FindByText("select").Selected = false;
}
}
Code:
if (objDataSet.Tables[1].Rows.Count > 0)
{
for (int i = 0; i < objDataSet.Tables[1].Rows.Count; i++)
{
int k;
k = Convert.ToInt32(objDataSet.Tables[1].Rows[i][0]);
lbspecialty.Items[k].Selected = true;
lbspecialty.Items.FindByText("select").Selected = false;
}
}
else
{
lbspecialty.Items.FindByText("select").Selected = true;
}
if (objDataSet.Tables[2].Rows.Count > 0)
{
for (int i = 0; i < objDataSet.Tables[2].Rows.Count; i++)
{
int k;
k = Convert.ToInt32(objDataSet.Tables[2].Rows[i][0]);
lbspecialty.Items[k].Selected = true;
lbspecialty.Items.FindByText("select").Selected = false;
}
}
plz help me out where iam going wrong
thanks,
raam
Comment