|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How do I reference or change formview child controls in code?I have a FormView control (which, by the way, is VERY cool) that contains a
bunch of controls inside it. One of them is a label called "Status". I would like this label to be one of several colors, depending on its value. I was going to set up a "SELECT CASE" in my Page_Load code, but I can't seem to figure out how to reference the control. I'm pretty sure it's FormView1.Something.Something.Something("Status") but I don't know what the "something"s are. Can anyone fill in the blanks for me? Thanks in advance! --Scott ps. I've also tried to search for appropriate documentation in Help, but apparently I need training in how to find it. It's GOT to be out there, but I sure could use help in finding it. Use FormView1.FindControl("Status").
-- Show quoteHide quoteChristopher A. Reed "The oxen are slow, but the earth is patient." "Scott at Cedar Creek" <ScottatCedarCr***@discussions.microsoft.com> wrote in message news:D418F91A-F2D5-40E5-9407-8B8A35B55E36@microsoft.com... >I have a FormView control (which, by the way, is VERY cool) that contains a > bunch of controls inside it. One of them is a label called "Status". I > would like this label to be one of several colors, depending on its value. > I > was going to set up a "SELECT CASE" in my Page_Load code, but I can't seem > to > figure out how to reference the control. I'm pretty sure it's > FormView1.Something.Something.Something("Status") but I don't know what > the > "something"s are. Can anyone fill in the blanks for me? Thanks in > advance! > --Scott > > ps. I've also tried to search for appropriate documentation in Help, but > apparently I need training in how to find it. It's GOT to be out there, > but > I sure could use help in finding it. I'm not exactly sure HOW to use FormView1.FindControl("Status").
Would I do it like this? FormView1.FindControl("Status").Text = "NewText" FormView1.FindControl("Status").ForeColor = "Red" FormView1.FindControl("Status").Visible = True I'm trying stuff like this, and VS isn't liking it. Try as I might (I'm feeling VERY stupid right now), I cannot find any documentation of any examples of this. I sure would appreciate it if someone who is smarter than me (nearly all of you out there qualify!) would help me out here. I'm overwhelmed by the .Net learning curve. Show quoteHide quote "Christopher Reed" wrote: > Use FormView1.FindControl("Status"). Assuming that you're using VB (so forgive me if my syntax is goofy because I
primarily use C#): In Page_Load: Dim Status As Label Status = CType(FormView1.FindControl("Status"), Label) Status.Text = "NewText" Status.ForeColor = Color.Red Status.Visible = True etc., etc., etc. You might spend some time looking at the QuickStart Tutorials. You can find them at www.asp.net . -- Show quoteHide quoteChristopher A. Reed "The oxen are slow, but the earth is patient." "Scott at Cedar Creek" <ScottatCedarCr***@discussions.microsoft.com> wrote in message news:042D2860-E3B4-4129-A31D-46763DD3B4F9@microsoft.com... > I'm not exactly sure HOW to use FormView1.FindControl("Status"). > > Would I do it like this? > > FormView1.FindControl("Status").Text = "NewText" > FormView1.FindControl("Status").ForeColor = "Red" > FormView1.FindControl("Status").Visible = True > > I'm trying stuff like this, and VS isn't liking it. Try as I might (I'm > feeling VERY stupid right now), I cannot find any documentation of any > examples of this. I sure would appreciate it if someone who is smarter > than > me (nearly all of you out there qualify!) would help me out here. I'm > overwhelmed by the .Net learning curve. > > "Christopher Reed" wrote: > >> Use FormView1.FindControl("Status"). >
asp.net 2.0 treeview control - very slow
DataGrid not responding to Update/Cancel click treeview asp.net 2.0 Menu Control - SubItem Shadows Flickering imagebutton with smartnavigation on Any Help on TabStrip Control?? Gridview hypterlink colomn to popup a new window disabling back button of window Calendar control question AxWebBrowser & POSTing forms |
|||||||||||||||||||||||