Web Design and Development Forums

[SOLVED] GidView RowDataBound Problem...

This is a discussion on "[SOLVED] GidView RowDataBound Problem..." within the ASP.NET Forum section. This forum, and the thread "[SOLVED] GidView RowDataBound Problem... are both part of the Program Your Website category.


Go Back   Webforumz.com > Program Your Website > ASP.NET Forum

Welcome to Webforumz.com.
Register Now Register now!

Reply
 
LinkBack Thread Tools Rate Thread
Old Dec 4th, 2007, 09:19   #1 (permalink)
New Member
 
Join Date: Dec 2007
Location: Malaysia
Posts: 2
Question [SOLVED] GidView RowDataBound Problem...

Hello frenz,
I am trying to modify the templateField itemized hyperlink on my GridView.
My problem is ,
I have 3 types of status, 'KIV','Complete'&'Incomplete'.
I must display 'KIV' in Red color font with its coresponding linkA.
As for 'Complete', it has to be in 'Green' and matched to linkB.
the 'Incomplete' status should be shown in Black color font and linked it with linkC.
To do this, i used the following method :
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim hLink As String = DataBinder.Eval(e.Row.DataItem, "STATUS").ToString()
If hLink.Equals("KIV") Then
Dim hLnk As HyperLink = CType(e.Row.FindControl("UW Status"), HyperLink)
hLnk.ForeColor = Drawing.Color.Red
hLnk.NavigateUrl = "linkA.asp?AppId=" + DataBinder.Eval(e.Row.DataItem, "APP_ID").ToString()
ElseIf hLink.Equals("Complete") Then
Dim hLnk As HyperLink = CType(e.Row.FindControl("UW Status"), HyperLink)
hLnk.ForeColor = Drawing.Color.Green
hLnk.NavigateUrl = "linkB.asp?AppId=" + DataBinder.Eval(e.Row.DataItem, "APP_ID").ToString()
Else
Dim hLnk As HyperLink = CType(e.Row.FindControl("UW Status"), HyperLink)
hLnk.ForeColor = Drawing.Color.Black
hLnk.NavigateUrl = "linkC.asp?AppId=" + DataBinder.Eval(e.Row.DataItem, "APP_ID").ToString()

End If
End If
End Sub
Problem is, im getting error when i execute the web site.The error description is 'Object reference not set to an instance of an object.'
Plz someoen help me sort it out what is the error with my coding.Realy appreciated.
thanks & regards dev
dev1910 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Dec 5th, 2007, 18:41   #2 (permalink)
 
TheSealPortalTeam's Avatar
 
Join Date: May 2007
Location: Buffalo
Posts: 241
Blog Entries: 12
Re: GidView RowDataBound Problem...

Thats the .net all purpose error.
Its like saying "I know somethings wrong... But I've given trying to help you. You have no hope at all. Sign Microsoft.com"

That error isn't going to help you, do you have 2008? If you did you could put a breakpoint in the HTML and it will help you know where the error is.

Mabe your conversion is faulty, to mention I'd never convert anything to a hyperlink just build one yourself. Your much better of.

Sry, can't help much here.
TheSealPortalTeam is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Dec 6th, 2007, 01:04   #3 (permalink)
New Member
 
Join Date: Dec 2007
Location: Malaysia
Posts: 2
Thumbs up Re: GidView RowDataBound Problem...

Tats fine fren, i found it oeldi.Its the hyperlink id didnt specify properly instead i hv entered the header text value.
Its too bad coz i nvr cud think of tat small mistake wen i try debug..ahaha
anyway, realy thanx lot fren for taking ur time , i appreciated that lot.
dev1910 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Dec 6th, 2007, 12:53   #4 (permalink)
 
TheSealPortalTeam's Avatar
 
Join Date: May 2007
Location: Buffalo
Posts: 241
Blog Entries: 12
Re: GidView RowDataBound Problem...

Your welcome.
TheSealPortalTeam is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] 1 solved problem causes another delusion CSS Forum 9 Dec 21st, 2007 08:12
[SOLVED] Another problem with mozilla thewebkid CSS Forum 12 Nov 29th, 2007 14:39
[SOLVED] FF problem nashultz07 CSS Forum 3 Nov 28th, 2007 03:49
[SOLVED] div positioning problem danny322 CSS Forum 5 Nov 28th, 2007 01:05



Latest Updates

All Points SEO Security Advisory - CHECK YOUR SITE NOW!

Creative Coding :: February 2008

Webforumz is sponsored by: WESH UK Web Hosting
All times are GMT. The time now is 13:59.

Sleep Study Scoring :: Free Bet :: Website Templates :: Online Betting :: Bookmakers :: Funny Quotes :: Internet Recruitment Software :: Microsoft CRM Experts :: Online Casino :: Decorated Christmas Trees :: Midwife Forums :: Football Betting :: Ecommerce Software :: Web Hosting :: Football Stats :: Dry Cleaning Collection :: xtreme wales - extreme clothing :: Apuestas :: Sharepoint Consultants :: Website Optimisation :: Office Clearance London :: Sharepoint Experts :: Sports Betting :: Casino :: Website Templates :: Web Design Development India :: Online Gambling

Powered by: vBulletin Version 3.7, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
© 2003-2008 Webforumz.com : All Rights Reserved
Search Engine Friendly URLs by vBSEO 3.2.0 RC6


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59