Ask a Question related to ASP.NET General, Design and Development.
-
Steven #1
DataGrid OnItemDataBound problem in APS.NET C#
I have 2 different data grids that are storing data from
two different tables in my data base:
My datagrid starts like this:
<asp:DataGrid 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.
Steven Guest
-
OnItemDataBound not called
Hello, I have overriden the OnItemDataCommand in my component, but it is never called. What I am doing wrong? I defined it like this: ... -
OnItemDataBound Problem
Hi, I created a DataGrid programmatically, my problem is that I dont know how to associate a function with the OnItemDataBound event of the... -
OnItemDataBound Master Detail
Hello, I use the OnItemDataBound event to dynamically Create a Master Detail Relationship between two DataGrids. How would I go about storing... -
DataGrid - OnItemDataBound - Selected
Try putting some of this into the item created event. "Trevor Oakley via .NET 247" <anonymous@dotnet247.com> wrote in message... -
URGENT question about binding collection to a datagrid onitemdatabound
The following code works to hide specific columns before they are bound to a datagrid that has "autogeneratecolumns=true" enabled. My question is:... -
Simon #2
Re: DataGrid OnItemDataBound problem in APS.NET C#
Hi Steven,
Is the EnableViewState control set to "true" ? if no, try that.
where do you bind the datagrid ? try page_load!
I hope this can help...
Simon
Simon Guest



Reply With Quote

