-
August 23rd, 2007, 01:03 PM
#1
Trouble with FormView
Hi,
I am learning ASP.Net.
I have a project with a FormView.
In the ItemTemplate there is a label called lblFY
In the Page_PreRender event there is a call to...
frmBudgetSummary.FindControl("lblFY")
However, this does not find the control.
What am I doing wrong?
Is there a way to directly reference the label control without resorting to FindControl?
What is the best way to reference a control in a FormView in code?
Thanks,
Scott
-
August 27th, 2007, 03:39 PM
#2
Re: Trouble with FormView
you should put a breakpoint somewhere in the pre-render code and do a Watch on the frmBudgetSummary. It may have the control but you may need to drill down to it. using watch will let you know how many control levels you may have to drill down.
For example the FormView may have one main control, and in that several different controls so you may need something like
Code:
frmBudgetSummary.Controls[0].FindControl("lblFY");
using watch you can easily see how nested the label is.
hth,
mcm
rate my posts!
mcm
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|