dear please help me to solve below problem....
getting error in fillgird()..
'cmbcontractor_name' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value
dear i am sending class file.....
public DataTable gridviewfetch()
{
library lib = new library();
DataTable dtdetailview = new DataTable();
dtdetailview = lib.GetconDetail();
return dtdetailview;
}
and aspx page fillgrid()...
private void fillgrid()
{
DataTable dttab = cons.gridviewfetch();
{
if (dttab.Rows.Count > 0)
{
GridView1.DataSource = dttab;
GridView1.DataBind();
}
else
{
dttab.Rows.Add(dttab.NewRow());
GridView1.DataSource = dttab;
GridView1.DataBind();
int TotalColumns = GridView1.Rows[0].Cells.Count;
GridView1.Rows[0].Cells.Clear();
GridView1.Rows[0].Cells.Add(new TableCell());
GridView1.Rows[0].Cells[0].ColumnSpan = TotalColumns;
GridView1.Rows[0].Cells[0].Text = "No Record Found";
}
}
thanksyou.....
karthick kumarPosted Sep 7, 2010, 6:49 AM
ex.Suppose when the dropdownlist(cmbcontractor_name) in the list box contains (1,2,3) as Datavaluefield as default binded datasource value.
for example when u use cmbcontractor_name.selectedvalue= "4"; it shows
Make sure ur assigned selected value for the dropdownlist(cmbcontractor_name) in fillgrid method is correct.