I have a aspx page with one user control , in the user control i have hidden
field (name hdnSaved) runat server wrapped in property like following :-
in documentview.as cx
public string SaveClicked
{
get
{
return (hdnSaved == null) ? "" : hdnSaved.Text;
}
set
{
hdnSaved.Text = value;
}
}
inside aspx page
declaration of UC
protected DocumantViewer Documentview1;
private void Page_Load(objec t sender, System.EventArg s e)
{
//here when I called Documentview1.S aveClicked while debug and I put the
//breakpoint in the user control get section the hdnSaved set as (undefined)
why???
if(Documentview 1.SaveClicked == "true" || Documentview1.S aveClicked == "")
{
//do something
}
else
{
Documentview1.S howFolder();
}
} 2 1758
Raed:
Simple question, but you do have
protected HtmlInputHidden hdnSaved;
declared in the documentview.as cx.cs (codebehind) and <input type="hidden"
runat="server" id="hdnSave" /> in the aspx?
Karl
--
MY ASP.Net tutorials http://www.openmymind.net/
"Raed Sawalha" <Ra*********@di scussions.micro soft.com> wrote in message
news:4C******** *************** ***********@mic rosoft.com... I have a aspx page with one user control , in the user control i have
hidden field (name hdnSaved) runat server wrapped in property like following :-
in documentview.as cx public string SaveClicked { get { return (hdnSaved == null) ? "" : hdnSaved.Text; } set { hdnSaved.Text = value; } }
inside aspx page declaration of UC protected DocumantViewer Documentview1;
private void Page_Load(objec t sender, System.EventArg s e) { //here when I called Documentview1.S aveClicked while debug and I put
the //breakpoint in the user control get section the hdnSaved set as
(undefined) why??? if(Documentview 1.SaveClicked == "true" || Documentview1.S aveClicked ==
"") { //do something } else { Documentview1.S howFolder(); }
}
Hi Raed,
You only declare the usercontrol but not assign any
reference to it. So it's null (undefined). In order to use
it, you have to get its reference. You can get its
reference from its Control ID. In aspx page look at HTML
code, find something like
<uc1: Documentview1 id="Documentvie w11"
runat="server"> </uc1: Documentview1>.
So the ID is Documentview11.
In Page_Load
Documentview1 = (Documentview)t his.FindControl
("Documentview1 1");
// Then you can use the Documentview1
HTH
Elton Wang el********@hotm ail.com -----Original Message----- I have a aspx page with one user control , in the user
control i have hiddenfield (name hdnSaved) runat server wrapped in property
like following :-
in documentview.as cx public string SaveClicked { get { return (hdnSaved == null) ? "" :
hdnSaved.Text; } set { hdnSaved.Text = value; } }
inside aspx page declaration of UC protected DocumantViewer Documentview1;
private void Page_Load(objec t sender, System.EventArg s e) { //here when I called Documentview1.S aveClicked while
debug and I put the//breakpoint in the user control get section the hdnSaved
set as (undefined)why??? if(Documentview 1.SaveClicked == "true" ||
Documentview1.S aveClicked == "") { //do something } else { Documentview1.S howFolder(); }
}
. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Wee Bubba |
last post by:
my user control (usercontrol1.ascx) is added dynamically into a
placeholder on page_load. within usercontrol1.ascx there is a button.
When a user presses this button I want the page to reload with a
different user control (usercontrol2.ascx)
if i add the button to the main page I can do this within the button
event handler:
myPlaceHolder.Controls.RemoveAt(0);
myPlaceHolder.Controls.Add(LoadControl("usercontrol2.ascx"));
|
by: Marc Jennings |
last post by:
Hi there,
I have an ASP.NET page that includes the following items.
public string s1;
public string s2;
public string s3;
and a User control called TestForm with three text boxes and one
button.
|
by: Willy |
last post by:
Hi All!
Is there any ways to get access to the controls contained in another user
controls from an ASP.NET page?
For example I have...
- User Control A
|_ User Control B (which uses User Control A)
|_ User Control C (which uses User Control B)
|
by: darrel |
last post by:
I'm still trying to fully understand how best to pass variables between
pages/usercontrols/each other.
On a current site I've done, I've had one userControl do the logic and set
the variable, and then I had other usercontrols simply read this by
traversing the class structure: siteClass.userControlClass.specficVariable.
That worked fine.
The new site I'm working on is a bit different, as I'm using multiple
|
by: darrel |
last post by:
Karl has helped me in the past in regards to communicating between controls
and pages:
http://www.openmymind.net/communication/index.html#3.1
I ended up going down the interfaces path and actually got that working
fairly well, but, then, in the end, decided that was overkill and that it
would perhaps make more sense to start over using a much more simpler
communication between pages.
| |
by: eagle |
last post by:
How do I access a control, like a placeholder, from another page, or another
user control that may be on the same page.
For instance, I have a web page with 2 user controls. One user controls
contains a placeholder to that will contain any error messages to be
displayed. If the first user control creates an error, I want to be able to
push that error to the 2nd control to display it at the placeholder.
I have tried
Dim ctrlError as...
|
by: robgallen |
last post by:
I have 2 user controls within a master page, and I would like one of
them to call a function in the other.
All the examples I have seen involve a page communicating with the
Master page, or with a user control communicating with the Master
page, not with a user control directly talking to another user
control, bypassing the page itself.
So, I have the following files:
Haep.master - which contains:
|
by: ajk |
last post by:
Hi
I was wondering how to show different properties in design and
run-mode for a user control? Is it possible to do this when
implementing the System.ComponentModel.ICustomTypeDescriptor
interface?
e.g. when selecting the control from a toolbox with controls other
properties show up when the program is in design mode than in run
mode.
|
by: Brett |
last post by:
I have an ASP.NET page that displays work orders in a GridView. In that
GridView is a checkbox column. When the user clicks a "Print" button, I
create a report, using the .NET Framework printing classes, for each of the
checked rows in the GridView. This works fine in the Visual Studio 2005
development environment on localhost. But, when I move the page to the web
server, I get the error "Settings to access printer...
|
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: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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: 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: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |