I'm not sure what I'm doing wrong. Here's my code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArg s)
Handles Me.Load
Dim hyp As HyperLink = CType(Me.FindCo ntrol("hypFilt" &
Request.QuerySt ring("Filt")), HyperLink)
If Not hyp Is Nothing Then
hyp.Font.Bold = True
EndIf
End If
I have several hyperlink controls on a page. Some are ID = hypFiltA,
hypFiltB, hypFiltC, etc. They are used to filter some data by first letter
of the alphabet. The code runs, nothing crashes but but the code above never
finds them. hyp always = nothing.
"hypFilt" & Request.QuerySt ring("Filt") does evaluate out to the correct
value.
Thanks,
Keith 15 1315
I should mention that the hyperlink controls are not embeded inside another
control. They are in a content section but they are recognized by
intellisense when I type "me.hyp..." into the vb code page.
"Keith G Hicks" <kr*@comcast.ne twrote in message
news:uF******** ******@TK2MSFTN GP05.phx.gbl...
I'm not sure what I'm doing wrong. Here's my code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s)
Handles Me.Load
Dim hyp As HyperLink = CType(Me.FindCo ntrol("hypFilt" &
Request.QuerySt ring("Filt")), HyperLink)
If Not hyp Is Nothing Then
hyp.Font.Bold = True
EndIf
End If
I have several hyperlink controls on a page. Some are ID = hypFiltA,
hypFiltB, hypFiltC, etc. They are used to filter some data by first letter
of the alphabet. The code runs, nothing crashes but but the code above
never
finds them. hyp always = nothing.
"hypFilt" & Request.QuerySt ring("Filt") does evaluate out to the correct
value.
Thanks,
Keith
Set a breakpoint and see if the id is formed correctly, run Me.FindControl
in the watch window, see what is inside the Me.Controls collection. This
should help you to figure out what is going on.
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET] http://msmvps.com/blogs/egoldin http://usableasp.net
"Keith G Hicks" <kr*@comcast.ne twrote in message
news:uF******** ******@TK2MSFTN GP05.phx.gbl...
I'm not sure what I'm doing wrong. Here's my code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s)
Handles Me.Load
Dim hyp As HyperLink = CType(Me.FindCo ntrol("hypFilt" &
Request.QuerySt ring("Filt")), HyperLink)
If Not hyp Is Nothing Then
hyp.Font.Bold = True
EndIf
End If
I have several hyperlink controls on a page. Some are ID = hypFiltA,
hypFiltB, hypFiltC, etc. They are used to filter some data by first letter
of the alphabet. The code runs, nothing crashes but but the code above
never
finds them. hyp always = nothing.
"hypFilt" & Request.QuerySt ring("Filt") does evaluate out to the correct
value.
Thanks,
Keith
It seems that the ID's are fine. When I put me.hypFiltA, or me.hypFiltB, etc
in the watch, they give me a value.
Request.QuerySt ring("Filt") in the watch window returns what I expect: "A"
or "B" or "C" etc.
When I put me.Controls in the watch window, I get a count of 1.
When I put Me.FindControl( "hypFilt" & Request.QuerySt ring("Filt")) in the
watch window, it comes up as Nothing.
If I hard code me.hypFiltA in the same event handler, it works fine. The
control exists and I'm able to set its properties. But I don't want to code
all 26 letters of the alphabet into the event handler.
I tried this in other page events as well (preload, init, initcomplete,
loadcomplete, prerender, prerendercomple te... all with same results.
"Eliyahu Goldin" <RE************ **************@ mMvVpPsS.orgwro te in
message news:eX******** ******@TK2MSFTN GP06.phx.gbl...
Set a breakpoint and see if the id is formed correctly, run Me.FindControl
in the watch window, see what is inside the Me.Controls collection. This
should help you to figure out what is going on.
--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET] http://msmvps.com/blogs/egoldin http://usableasp.net
"Keith G Hicks" <kr*@comcast.ne twrote in message
news:uF******** ******@TK2MSFTN GP05.phx.gbl...
I'm not sure what I'm doing wrong. Here's my code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s)
Handles Me.Load
Dim hyp As HyperLink = CType(Me.FindCo ntrol("hypFilt" &
Request.QuerySt ring("Filt")), HyperLink)
If Not hyp Is Nothing Then
hyp.Font.Bold = True
EndIf
End If
I have several hyperlink controls on a page. Some are ID = hypFiltA,
hypFiltB, hypFiltC, etc. They are used to filter some data by first
letter
of the alphabet. The code runs, nothing crashes but but the code above
never
finds them. hyp always = nothing.
"hypFilt" & Request.QuerySt ring("Filt") does evaluate out to the correct
value.
Thanks,
Keith
"Keith G Hicks" <kr*@comcast.ne twrote in message
news:u4******** ******@TK2MSFTN GP03.phx.gbl...
When I put Me.FindControl( "hypFilt" & Request.QuerySt ring("Filt")) in the
watch window, it comes up as Nothing.
If you put Request.QuerySt ring("Filt") in the watch window, what do you see?
If you put "hypFilt" & Request.QuerySt ring("Filt") in the watch window, what
do you see?
Does Me.FindControl( "hypFilt" & Request.QuerySt ring("Filt").To String())
work?
--
Mark Rae
ASP.NET MVP http://www.markrae.net
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message
news:Og******** ******@TK2MSFTN GP05.phx.gbl...
"Keith G Hicks" <kr*@comcast.ne twrote in message
news:u4******** ******@TK2MSFTN GP03.phx.gbl...
When I put Me.FindControl( "hypFilt" & Request.QuerySt ring("Filt")) in
the
watch window, it comes up as Nothing.
If you put Request.QuerySt ring("Filt") in the watch window, what do you
see?
returns "A"
>
If you put "hypFilt" & Request.QuerySt ring("Filt") in the watch window,
what
do you see?
returns "hypFiltA"
Does Me.FindControl( "hypFilt" & Request.QuerySt ring("Filt").To String())
work?
returns Nothing
>
--
Mark Rae
ASP.NET MVP http://www.markrae.net
"Keith G Hicks" <kr*@comcast.ne twrote in message
news:Ol******** ******@TK2MSFTN GP03.phx.gbl...
>If you put Request.QuerySt ring("Filt") in the watch window, what do you see?
returns "A"
>If you put "hypFilt" & Request.QuerySt ring("Filt") in the watch window, what do you see?
returns "hypFiltA"
>Does Me.FindControl( "hypFilt" & Request.QuerySt ring("Filt").To String()) work?
returns Nothing
In which case, it sounds very much like the hypFiltA hyperlink isn't
actually in the Page control container. Might it be contained within another
container within the Page container e.g. an <asp:Panel... ?
--
Mark Rae
ASP.NET MVP http://www.markrae.net
No. Like I said in my 2nd post, it's all in a content section. It's a master
page setup (asp.net 2.0 if that helps). This is one of the content pages.
Here's the markup (below the @Page and the @Register Assembly lines):
<asp:Content ID="Content1" ContentPlaceHol derID="ContentP laceHolder2"
runat="Server">
<asp:Image ID="Image1" runat="server"
ImageUrl="~/Images/PageTitles_Year bookPics.jpg" /><br />
<br />
Click an image for a larger view.<br />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHol derID="ContentP laceHolder1"
runat="Server">
<br />
<span style="font-size: 11pt">Filters (based on last name at
graduation):</span>
<asp:HyperLin k ID="hypFiltAll " runat="server"
NavigateUrl="~/ClassmateYearbo okPics.aspx?Fil t=ALL" Font-Size="11pt">Sho w
All</asp:HyperLink>
<asp:HyperLin k ID="hypFiltA" runat="server"
NavigateUrl="~/ClassmateYearbo okPics.aspx?Fil t=A"
Font-Size="11pt">A</asp:HyperLink>
<asp:HyperLin k ID="hypFiltB" runat="server"
NavigateUrl="~/ClassmateYearbo okPics.aspx?Fil t=B"
Font-Size="11pt">B</asp:HyperLink>
etc.....
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message
news:#E******** *****@TK2MSFTNG P05.phx.gbl...
"Keith G Hicks" <kr*@comcast.ne twrote in message
news:Ol******** ******@TK2MSFTN GP03.phx.gbl...
If you put Request.QuerySt ring("Filt") in the watch window, what do you
see?
returns "A"
If you put "hypFilt" & Request.QuerySt ring("Filt") in the watch window,
what do you see?
returns "hypFiltA"
Does Me.FindControl( "hypFilt" & Request.QuerySt ring("Filt").To String())
work?
returns Nothing
In which case, it sounds very much like the hypFiltA hyperlink isn't
actually in the Page control container. Might it be contained within
another
container within the Page container e.g. an <asp:Panel... ?
--
Mark Rae
ASP.NET MVP http://www.markrae.net
"Keith G Hicks" <kr*@comcast.ne twrote in message
news:uQ******** ******@TK2MSFTN GP06.phx.gbl...
[top-posting corrected]
>In which case, it sounds very much like the hypFiltA hyperlink isn't actually in the Page control container. Might it be contained within
another
>container within the Page container e.g. an <asp:Panel... ?
No. Like I said in my 2nd post, it's all in a content section. It's a
master
page setup (asp.net 2.0 if that helps). This is one of the content pages.
Here's the markup (below the @Page and the @Register Assembly lines):
OK, just for the sake of clarity, the hyperlinks are all within a content
page, not the MasterPage.
And presumably the code which is trying to refer to those hyperlinks is
similarly behind the content page, not behind the MasterPage...?
--
Mark Rae
ASP.NET MVP http://www.markrae.net
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message
news:e8******** ******@TK2MSFTN GP06.phx.gbl...
"Keith G Hicks" <kr*@comcast.ne twrote in message
news:uQ******** ******@TK2MSFTN GP06.phx.gbl...
[top-posting corrected]
In which case, it sounds very much like the hypFiltA hyperlink isn't
actually in the Page control container. Might it be contained within
another
container within the Page container e.g. an <asp:Panel... ?
No. Like I said in my 2nd post, it's all in a content section. It's a
master
page setup (asp.net 2.0 if that helps). This is one of the content
pages.
Here's the markup (below the @Page and the @Register Assembly lines):
OK, just for the sake of clarity, the hyperlinks are all within a content
page, not the MasterPage.
That's correct.
And presumably the code which is trying to refer to those hyperlinks is
similarly behind the content page, not behind the MasterPage...?
That's correct also.
>
--
Mark Rae
ASP.NET MVP http://www.markrae.net This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ivan Demkovitch |
last post by:
Hi!
I have following problem:
When I create control dynamically and assign ID to it it get's changed if
you look at output HTML.
Because I add this control inside ascx it is prefixed with something like
"ctl0_". Therefore FindControl is not working...
|
by: Michael Murschell |
last post by:
If I call Page.FindControl() on an aspx, it finds the control, but if I call
it on an ASCX, it does not. Why not?
And how would I call it?
|
by: Adam Billmeier |
last post by:
Problem:
I am trying to use FindControl to grab a dropdownlist that is in the
EditItemTemplate of a Datalist and then Bind it to a dataset. I also then
need to put the correct values in all of the text boxes in the
EditItemTemplate.
I have set the EditItemIndex for the Datalist to -1, and then bound the
Datalist. I then want to Bind the DropDown, and populate the values.
All attempts to use FindControl on the control return "Nothing"
|
by: tshad |
last post by:
I am using sample code from C# and am trying to convert it to VB.Net in my
aspx page.
This works in C#:
DataGrid oGrid = (DataGrid)oItem.FindControl("DataGrid1");
I have tried all kinds of combinations trying to get it to work:
***********************************************************************
|
by: Greg Fischer |
last post by:
I need to access the properties of a control that is nested in 2 datalists.
How do you use findcontrol method to do that?
what I have is like this:
<asp:datalist id="dlist" runat="server">
<edititemtemplate>
<asp:datalist id="dlistdet" runat="server">
<asp:dropdownlist id="ddlTypes" runat="server"></dropdownlist>
</asp:datalist>
| |
by: Terry Olsen |
last post by:
I've got a datagrid set up to display data. I've also got an
Edit,Update,Cancel column set up to allow editing of data.
I've got a DropDownList (ID="ddl3")in the EditItemTemplate for a certain
column that I need to populate while in Edit Mode.
Two questions: Is there a way to directly use another DropDownList as a
DataSource? If so how?
I'm using the following code to try to populate the DropDownList, but
|
by: daniel.hedz |
last post by:
I am generating a usercontrol dynamically successfully, but when I try
to find that usercontrol I get a type mismatch. This is what I am
doing:
//Loading my usercontrol
MyWebApp.Folder.Folder.MyUsercontrol myUC =
(MyWebApp.Folder.Folder.MyUsercontrol)
LoadControl("~/Folder/Folder/MyUsercontrol.ascx");
|
by: =?Utf-8?B?QWxleCBNYWdoZW4=?= |
last post by:
Hi. I have created a UserControl ("MyUC"). I've put a bunch of instances of
that control on a Page ("Defaul.aspx"). The control works fine.
Now, I want to be able to use "FindControl()" from within my Default.aspx as
follows:
MyUC C = (MyUC)this.FindControl("SomeID");
When I try to run this, I get error:
"The type or namespace name 'MyUC' could not be found (are you missing a
|
by: AAaron123 |
last post by:
Me.FindControl("MissionScheduleID"), below returns null.
Do you know what I'm doing wrong?
Thanks
***In my .aspx file I have:
asp:Content ID="Content3" contentplaceholderid="MainMasterLeftDataID"
runat="server">
|
by: AAaron123 |
last post by:
I'm this far in determining the correct code to find a textbox I need to
set.
Me.Master.FindControl("Body1").FindControl("Form2").FindControl("Table2").FindControl("TableRow7").FindControl("TableCellR7C2S2").FindControl("RightCPH").FindControl("div1").FindControl("div2").FindControl("LoginView1")
Took me longer than I want to say to produce the above and I'm not there
yet.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |