Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / September 2007

Tip: Looking for answers? Try searching our database.

Change the value of cell in Grid View

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bobby - 06 Sep 2007 18:06 GMT
Hi all,
From my DATABASE i get Dataset to my GRIDVIEW.
On run time I want to change the value of a cell.
For example:
Instead of "0" i want to write "N/A".

let's make it clear - I don't want to update the value in the DB
just change the specific value of the cell that the user will see on the web.

Hope I made my self clear.
Mark Rae [MVP] - 06 Sep 2007 18:17 GMT
> From my DATABASE i get Dataset to my GRIDVIEW.
> On run time I want to change the value of a cell.
> For example:
> Instead of "0" i want to write "N/A".

<asp:GridView ID="MyGridView" runat="server
OnRowDataBound="MyGridView_RowDataBound">
   ...
</asp:GridView>

protected void MyGridView_RowDataBound(object sender, GridViewRowEventArgs
e)
{
   if (e.Row.RowType == DataControlRowType.DataRow)
   {
       if (e.Row.Cells[0].Text == "0") { e.Row.Cells[0].Text = "N/A"; }
   }
}

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.