S
Steven
I have 2 different data grids that are storing data from
two different tables in my data base:
My datagrid starts like this:
<aspataGrid id="DataGridGPA" runat="server"
OnItemDataBound="bindGPAList" ...
My bindGPAList looks like this:
public void bindGPAList(object sender,
DataGridItemEventArgs e) {
if(e.Item.ItemType == ListItemType.EditItem) {
DropDownList Dl = (DropDownList)
e.Item.FindControl("dropDownListGPASemester");
Dl.SelectedIndex = Dl.Items.IndexOf(
Dl.Items.FindByValue( DataBinder.Eval
(e.Item.DataItem, "theSemester").ToString() ) );
}
if((e.Item.ItemType == ListItemType.Item) ||
(e.Item.ItemType == ListItemType.AlternatingItem)) {
if(DataBinder.Eval
(e.Item.DataItem, "theSemester").ToString() == "1")
e.Item.Cells[0].Text = "Winter";
else if(DataBinder.Eval
(e.Item.DataItem, "theSemester").ToString() == "2")
e.Item.Cells[0].Text = "Spring";
else if(DataBinder.Eval
(e.Item.DataItem, "theSemester").ToString() == "3")
e.Item.Cells[0].Text = "Summer";
else if(DataBinder.Eval
(e.Item.DataItem, "theSemester").ToString() == "4")
e.Item.Cells[0].Text = "Fall";
}
When the page loads, Winter, Summer... semesters are
shown in the cells. Whenever someone clicks on edit or
update... in the second grid, the text Winter, Summer....
from the first datagrid cells disapears, until the user
comes back and clicks on edit link of the first. What is
causing the mysterious disapearance of the data in the
first grid column? Thank you.
two different tables in my data base:
My datagrid starts like this:
<aspataGrid id="DataGridGPA" runat="server"
OnItemDataBound="bindGPAList" ...
My bindGPAList looks like this:
public void bindGPAList(object sender,
DataGridItemEventArgs e) {
if(e.Item.ItemType == ListItemType.EditItem) {
DropDownList Dl = (DropDownList)
e.Item.FindControl("dropDownListGPASemester");
Dl.SelectedIndex = Dl.Items.IndexOf(
Dl.Items.FindByValue( DataBinder.Eval
(e.Item.DataItem, "theSemester").ToString() ) );
}
if((e.Item.ItemType == ListItemType.Item) ||
(e.Item.ItemType == ListItemType.AlternatingItem)) {
if(DataBinder.Eval
(e.Item.DataItem, "theSemester").ToString() == "1")
e.Item.Cells[0].Text = "Winter";
else if(DataBinder.Eval
(e.Item.DataItem, "theSemester").ToString() == "2")
e.Item.Cells[0].Text = "Spring";
else if(DataBinder.Eval
(e.Item.DataItem, "theSemester").ToString() == "3")
e.Item.Cells[0].Text = "Summer";
else if(DataBinder.Eval
(e.Item.DataItem, "theSemester").ToString() == "4")
e.Item.Cells[0].Text = "Fall";
}
When the page loads, Winter, Summer... semesters are
shown in the cells. Whenever someone clicks on edit or
update... in the second grid, the text Winter, Summer....
from the first datagrid cells disapears, until the user
comes back and clicks on edit link of the first. What is
causing the mysterious disapearance of the data in the
first grid column? Thank you.