J
JB
Hello Community
Using ASP.NET and C# with Sql Server in the back end I have a GridView that
uses Row_DataBound event on a web page. When one of the columns contains a
letter in the database such as “N†or “Y†that column in the GridView shows
“No†or “Yes†using Row_DataBound.
This works fine initially but after modifying a row in the database the “Nâ€
or “Y†doesn’t show the “No†or “Yes†in the GridView when the page comes
back but instead still shows the “N†or “Y†in the GridView that is
literally in the database until I add another record, then it will go back to
showing the “No†or “Yes†in the GridView as directed by the Row_DataBound
event when the page show again.
Is there a way to make the Row_DataBound event always show “No†or “Yes†in
the GridView for the N†or “Y†that is in the database column ?
When does this GridView actually respond to actions on the web page?
Below is a similar to the Row_DataBound event :
protected void grid1_RowDataBound(object sender, GridViewRowEventArgs e)
{
int inRow = grid1.Rows.Count;
if (ddlPipes.SelectedIndex < 1)
{
return;
}
if (grid1.Rows.Count == 0)
{
return;
}
GridViewRow gRow
gRow = e.Row;
if (gRow.RowType == DataControlRowType.DataRow)
gRow.Cells[4].Text = grid1.Cells[4].Text.Equals("Y") ? "Yes" : "No";
}
Thanks
Jeff
Using ASP.NET and C# with Sql Server in the back end I have a GridView that
uses Row_DataBound event on a web page. When one of the columns contains a
letter in the database such as “N†or “Y†that column in the GridView shows
“No†or “Yes†using Row_DataBound.
This works fine initially but after modifying a row in the database the “Nâ€
or “Y†doesn’t show the “No†or “Yes†in the GridView when the page comes
back but instead still shows the “N†or “Y†in the GridView that is
literally in the database until I add another record, then it will go back to
showing the “No†or “Yes†in the GridView as directed by the Row_DataBound
event when the page show again.
Is there a way to make the Row_DataBound event always show “No†or “Yes†in
the GridView for the N†or “Y†that is in the database column ?
When does this GridView actually respond to actions on the web page?
Below is a similar to the Row_DataBound event :
protected void grid1_RowDataBound(object sender, GridViewRowEventArgs e)
{
int inRow = grid1.Rows.Count;
if (ddlPipes.SelectedIndex < 1)
{
return;
}
if (grid1.Rows.Count == 0)
{
return;
}
GridViewRow gRow
gRow = e.Row;
if (gRow.RowType == DataControlRowType.DataRow)
gRow.Cells[4].Text = grid1.Cells[4].Text.Equals("Y") ? "Yes" : "No";
}
Thanks
Jeff