Hey
ASP.NET 2.0
This the ObjectDataSourc e in my UserControl,
<asp:ObjectData Source ID="odsMessage " runat="server"
SelectMethod="E xecuteMessage"
TypeName="AH.My Network.BLL.Net work.Message">
<SelectParamete rs>
<asp:ProfilePar ameter Name="user" PropertyName="U serName"
Type="String" />
<asp:Paramete r Name="mode" Type="Boolean" />
</SelectParameter s>
</asp:ObjectDataS ource>
The problem is that I don't know a good way of setting the value of this
parameter "<asp:Param eter Name="mode" Type="Boolean" />" from the web page
in which the UserControl is placed..
This is how I've embedded this UserControl into the web page:
<%@ Register Src="~/Controls/Messages.ascx" TagName="Messag es"
TagPrefix="mb" %>
<mb:Messages ID="Messages1" runat="server" />
Maybe I should create a private variable in the UserControl, and set the
ObjectDataSourc e to reference it, but I don't know how to reference the
private variable from the ObjectDataSourc e in the markup/source...
My UserControl is designed to show messages (received or sent message). I
have a web page named inbox.aspx where this control is used to show received
message. But now I want to use the same UserControl on a web page named
Outbox.aspx showing sent message. Then I need a way to tell the UserControl
if it's received or sent message it should display
Or maybe I should instead use 2 repeat controls + 2 ObjectDataSourc e objects
(1 for each repeat control) and hide or show them programatically ... if the
UserControl should display received message, then hide the sent message
Repeater and display the Received Reapeater..
Any suggestions?
Jeff 3 3039
Create a PUBLIC property in the code section (or code behind if you use two
files). Once you compile (build website) you will see the new property and
you can set it either in the tags or in the code behind.
If you set a default condition in the controls load, you will want to have
property set reset the state of the control.
BTW, while this is a learning hurdle, it is a good coding style, as your
user controls become black boxes that are truly reuseable. One word of
caution: If you are not the only developer, either default the control or
throw custom exceptions that point to the property not being set (if it is
mandatory, that is). Otherwise, those maintaining the code will be lost,
esp. those who have not made the leap into making actual objects of their
user controls.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA http://gregorybeamer.spaces.live.com
*************** *************** *************** ****
Think outside of the box!
*************** *************** *************** ****
"Jeff" <it************ @hotmail.com.NO SPAMwrote in message
news:e3******** ******@TK2MSFTN GP04.phx.gbl...
Hey
ASP.NET 2.0
This the ObjectDataSourc e in my UserControl,
<asp:ObjectData Source ID="odsMessage " runat="server"
SelectMethod="E xecuteMessage"
TypeName="AH.My Network.BLL.Net work.Message">
<SelectParamete rs>
<asp:ProfilePar ameter Name="user" PropertyName="U serName"
Type="String" />
<asp:Paramete r Name="mode" Type="Boolean" />
</SelectParameter s>
</asp:ObjectDataS ource>
The problem is that I don't know a good way of setting the value of this
parameter "<asp:Param eter Name="mode" Type="Boolean" />" from the web page
in which the UserControl is placed..
This is how I've embedded this UserControl into the web page:
<%@ Register Src="~/Controls/Messages.ascx" TagName="Messag es"
TagPrefix="mb" %>
<mb:Messages ID="Messages1" runat="server" />
Maybe I should create a private variable in the UserControl, and set the
ObjectDataSourc e to reference it, but I don't know how to reference the
private variable from the ObjectDataSourc e in the markup/source...
My UserControl is designed to show messages (received or sent message). I
have a web page named inbox.aspx where this control is used to show
received message. But now I want to use the same UserControl on a web page
named Outbox.aspx showing sent message. Then I need a way to tell the
UserControl if it's received or sent message it should display
Or maybe I should instead use 2 repeat controls + 2 ObjectDataSourc e
objects (1 for each repeat control) and hide or show them
programatically ... if the UserControl should display received message,
then hide the sent message Repeater and display the Received Reapeater..
Any suggestions?
Jeff
thanks, but just more thing:
This is the property I created in the UserControl:
private Boolean _mode;
public Boolean Mode
{
get { return _mode; }
set { _mode = value; }
}
This is the new markup in the web page using the UserControl (see the
property "Mode"):
<mb:Messages ID="Messages1" runat="server" Mode="true" />
Somehow the correct value of Mode isn't passed into ExecuteMessage, (it gets
"false", but I was expecting "true"). I think this is related to
"<asp:Param eter Name="Mode" Type="Boolean" />" (see blow for the entire
markup of my ObjectDataSourc e) which can't be correct...
Here is the markup of ObjectDataSourc e:
<asp:ObjectData Source ID="odsMessage " runat="server"
SelectMethod="E xecuteMessage"
TypeName="AH.My Network.BLL.Net work.Message">
<SelectParamete rs>
<asp:ProfilePar ameter Name="user" PropertyName="U serName"
Type="String" />
<asp:Paramete r Name="Mode" Type="Boolean" />
</SelectParameter s>
</asp:ObjectDataS ource>
How should I set the SelectMethod "ExecuteMessage " to use the custom
property "Mode"?
Jeff
"Cowboy (Gregory A. Beamer)" <No************ @comcast.netNoS pamMwrote in
message news:eM******** ******@TK2MSFTN GP05.phx.gbl...
Create a PUBLIC property in the code section (or code behind if you use
two files). Once you compile (build website) you will see the new property
and you can set it either in the tags or in the code behind.
If you set a default condition in the controls load, you will want to have
property set reset the state of the control.
BTW, while this is a learning hurdle, it is a good coding style, as your
user controls become black boxes that are truly reuseable. One word of
caution: If you are not the only developer, either default the control or
throw custom exceptions that point to the property not being set (if it is
mandatory, that is). Otherwise, those maintaining the code will be lost,
esp. those who have not made the leap into making actual objects of their
user controls.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA http://gregorybeamer.spaces.live.com
*************** *************** *************** ****
Think outside of the box!
*************** *************** *************** ****
"Jeff" <it************ @hotmail.com.NO SPAMwrote in message
news:e3******** ******@TK2MSFTN GP04.phx.gbl...
>Hey
ASP.NET 2.0
This the ObjectDataSourc e in my UserControl, <asp:ObjectDat aSource ID="odsMessage " runat="server" SelectMethod=" ExecuteMessage" TypeName="AH.My Network.BLL.Net work.Message"> <SelectParamete rs> <asp:ProfilePar ameter Name="user" PropertyName="U serName" Type="String " /> <asp:Paramete r Name="mode" Type="Boolean" /> </SelectParameter s> </asp:ObjectDataS ource>
The problem is that I don't know a good way of setting the value of this parameter "<asp:Param eter Name="mode" Type="Boolean" />" from the web page in which the UserControl is placed..
This is how I've embedded this UserControl into the web page: <%@ Register Src="~/Controls/Messages.ascx" TagName="Messag es" TagPrefix="m b" %> <mb:Messages ID="Messages1" runat="server" />
Maybe I should create a private variable in the UserControl, and set the ObjectDataSour ce to reference it, but I don't know how to reference the private variable from the ObjectDataSourc e in the markup/source...
My UserControl is designed to show messages (received or sent message). I have a web page named inbox.aspx where this control is used to show received message. But now I want to use the same UserControl on a web page named Outbox.aspx showing sent message. Then I need a way to tell the UserControl if it's received or sent message it should display
Or maybe I should instead use 2 repeat controls + 2 ObjectDataSourc e objects (1 for each repeat control) and hide or show them programaticall y... if the UserControl should display received message, then hide the sent message Repeater and display the Received Reapeater..
Any suggestions?
Jeff
odsMessage.Sele ctParameters.Ad d(new Parameter("Mode ", TypeCode.Boolea n,
Mode.ToString() ));
"Jeff" <it************ @hotmail.com.NO SPAMwrote in message
news:eV******** ******@TK2MSFTN GP05.phx.gbl...
thanks, but just more thing:
This is the property I created in the UserControl:
private Boolean _mode;
public Boolean Mode
{
get { return _mode; }
set { _mode = value; }
}
This is the new markup in the web page using the UserControl (see the
property "Mode"):
<mb:Messages ID="Messages1" runat="server" Mode="true" />
Somehow the correct value of Mode isn't passed into ExecuteMessage, (it
gets "false", but I was expecting "true"). I think this is related to
"<asp:Param eter Name="Mode" Type="Boolean" />" (see blow for the entire
markup of my ObjectDataSourc e) which can't be correct...
Here is the markup of ObjectDataSourc e:
<asp:ObjectData Source ID="odsMessage " runat="server"
SelectMethod="E xecuteMessage"
TypeName="AH.My Network.BLL.Net work.Message">
<SelectParamete rs>
<asp:ProfilePar ameter Name="user" PropertyName="U serName"
Type="String" />
<asp:Paramete r Name="Mode" Type="Boolean" />
</SelectParameter s>
</asp:ObjectDataS ource>
How should I set the SelectMethod "ExecuteMessage " to use the custom
property "Mode"?
Jeff
"Cowboy (Gregory A. Beamer)" <No************ @comcast.netNoS pamMwrote in
message news:eM******** ******@TK2MSFTN GP05.phx.gbl...
>Create a PUBLIC property in the code section (or code behind if you use two files). Once you compile (build website) you will see the new property and you can set it either in the tags or in the code behind.
If you set a default condition in the controls load, you will want to have property set reset the state of the control.
BTW, while this is a learning hurdle, it is a good coding style, as your user controls become black boxes that are truly reuseable. One word of caution: If you are not the only developer, either default the control or throw custom exceptions that point to the property not being set (if it is mandatory, that is). Otherwise, those maintaining the code will be lost, esp. those who have not made the leap into making actual objects of their user controls.
-- Gregory A. Beamer MVP; MCP: +I, SE, SD, DBA http://gregorybeamer.spaces.live.com
************** *************** *************** ***** Think outside of the box! ************** *************** *************** ***** "Jeff" <it************ @hotmail.com.NO SPAMwrote in message news:e3******* *******@TK2MSFT NGP04.phx.gbl.. .
>>Hey
ASP.NET 2.0
This the ObjectDataSourc e in my UserControl, <asp:ObjectDa taSource ID="odsMessage " runat="server" SelectMethod= "ExecuteMessage " TypeName="AH.My Network.BLL.Net work.Message"> <SelectParamete rs> <asp:ProfilePar ameter Name="user" PropertyName="U serName" Type="Strin g" /> <asp:Paramete r Name="mode" Type="Boolean" /> </SelectParameter s> </asp:ObjectDataS ource>
The problem is that I don't know a good way of setting the value of this parameter "<asp:Param eter Name="mode" Type="Boolean" />" from the web page in which the UserControl is placed..
This is how I've embedded this UserControl into the web page: <%@ Register Src="~/Controls/Messages.ascx" TagName="Messag es" TagPrefix="mb " %> <mb:Message s ID="Messages1" runat="server" />
Maybe I should create a private variable in the UserControl, and set the ObjectDataSou rce to reference it, but I don't know how to reference the private variable from the ObjectDataSourc e in the markup/source...
My UserControl is designed to show messages (received or sent message). I have a web page named inbox.aspx where this control is used to show received message. But now I want to use the same UserControl on a web page named Outbox.aspx showing sent message. Then I need a way to tell the UserControl if it's received or sent message it should display
Or maybe I should instead use 2 repeat controls + 2 ObjectDataSourc e objects (1 for each repeat control) and hide or show them programatical ly... if the UserControl should display received message, then hide the sent message Repeater and display the Received Reapeater..
Any suggestions?
Jeff This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: A.M |
last post by:
Hi,
I have a property in my class like this:
public string CurrentDisplayName
{
get
{
...
return s;
|
by: moondaddy |
last post by:
I have a user control being used instead of a frame page. when the user
clicks on a menu item I need to send the ID (integer value) of that menu as
a parameter in the postback of the user control which will be used to query
sql server to repopulate the datagrid in the user control.
I also wrapped the user control in a panel element so I could position it on
the page.
I'm clueless on how to get started with this.
|
by: Alessandro Rossi |
last post by:
Hi
I developed a usercontrol with a textbox and an htmlInputHidden
When I add my usercontrol in a webform, it works properly
If I add my control in a template column of a datagrid i have some problems
When I load the webform, the usercontrol has a UniqueID like this: "LookUp1:txtRisultato", then I value the text of this textbox with a client-side script. If i post the page, the value saved in the textbox.text is null, but i see that the...
|
by: Michael Maes |
last post by:
Hi,
I have a UserControl with some "Children" (e.g. one ComboBox & one Label).
I add the UserControl on a Form.
If I perform a recursive scan through that Form's Control-Collection the ..HasChildren-Method scans the Controls within the UserControl.
This is a behavior I want to ommit.
* Is there a way to hide the Controls contained within a UserControl so that UserControl.HasChildren will always return False? *
|
by: Eþref DURNA |
last post by:
how could I send a parameter to a runing csharp windows application?
| |
by: h-h |
last post by:
i have a class that take usercontrol and page as parameter
like this
makeSession( UserControl object)
{
/// To do something
}
could i use usercontrol and page together?
how can i implement this?
|
by: amatuer |
last post by:
hi i have a link from page1 to page2. this link uses a querystring to
transfer data. usually i have no problems using querystring t transfer
data. bt for the first time page2 does not display.an eror page
displays. i had a look at the properties of the error page to see if
the url is correct and i noticed somthng iv never seen before.this is
it:...
|
by: Jesper Lund Stocholm |
last post by:
I have problems with sending javascript to the client from a dynamically
loaded usercontrol.
I have a single page that dynamically loads controls into a table cell in
a HTML-table. For one of these controls I would like to add some
javascript to the page loading my control. The problem is only - nothing
happens. The code that loads my usercontrol from my ASPX-page is:
tdContent.Controls.Add(Page.LoadControl(contentControl));
|
by: chpadmamca |
last post by:
Hi ,
I need this very urgent.please help me.
I have to send a parameter on to the popup window which will open when a command button is clicked,again i need to display that parameter on the popup window.
any help would be greatly appreciated.
|
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: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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: 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: 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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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...
| | |