Passing values to property in user web control

I have the following user web control:

public class ServiceRequestListControl : System.Web.UI.UserControl
protected Infragistics.WebUI.UltraWebGrid.UltraWebGrid ServiceRequestGrid;
private Program objProgram;
private string m_TestString;

private void Page_Load(object sender, System.EventArgs e)
private void bindServiceRequestGrid()
objProgram = (Program)Session["objProgram"];

if (objProgram != null)
// Get the list of service requests from the current objProgram
ServiceRequestGrid.DataSource = objProgram.ProgramServiceRequestList;
if (Session["StatusRange"] != null)
// Get list of service requests for status range from objServiceRequestColection
Nordis.Enterprise.BusinessObjects.ServiceRequestCollection objServiceRequestCollection = new ServiceRequestCollection();
ServiceRequestGrid.DataSource = objServiceRequestCollection.ServiceRequestList;
// Get the list of all service requests from the objServiceRequestCollection
Nordis.Enterprise.BusinessObjects.ServiceRequestCollection objServiceRequestCollection = new ServiceRequestCollection();
ServiceRequestGrid.DataSource = objServiceRequestCollection.ServiceRequestList;
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
// CODEGEN: This call is required by the ASP.NET Web Form Designer.

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
this.Load += new System.EventHandler(this.Page_Load);

#region Property Accessors
public string TestString
set{m_TestString = value;}
get{return m_TestString;}

which I then load into a page using the following:
private void loadControl(int tabID)
System.Web.UI.UserControl uc = (System.Web.UI.UserControl) Page.LoadControl("~/UserWebControls/ServiceRequestListControl.ascx");
Infragistics.WebUI.UltraWebGrid.UltraWebGrid grid = (Infragistics.WebUI.UltraWebGrid.UltraWebGrid) uc.FindControl("ServiceRequestGrid");
grid.InitializeLayout += new Infragistics.WebUI.UltraWebGrid.InitializeLayoutEventHandler(grid_InitializeLayout);
grid.InitializeRow += new Infragistics.WebUI.UltraWebGrid.InitializeRowEventHandler(grid_InitializeRow);

The question that I have is how can a set the value for the public property TestString from the page that the control is load onto
1/27/2005 7:31:34 PM 93655 articles. 5 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 2

I have always used to redirect questions about UserControls to An Extensive Examination of UserControls

Bilal Hadiar, MCP, MCTS, MCPD, MCT
Microsoft MVP - Telerik MVP
1/27/2005 8:30:11 PM

Similar Artilces:

Pass data from Web User Control to Web Form
I have a Web Form that contains a Web User Control. The WUC displays dynamic content. I want to change the TITLE property of the Web Form, based on the contents of the WUC. For example, if the WUC displays information about Horses, I want to change the page title to "HORSES" by passing the string to the parent Web Form. I have tried playing with parameters and such, but I can't remember how I did this in the past. PLEASE HELP!~o0 Spin-Monkey Oo~ The best way to do this is by creating a public property on your web user control and accessing that from your web form. Check ...

Retreiving a value from a web form within a web user control
Hi  I have a page (web form) that retreives some data from a database. To be more specific: at some point when user clicks a button (in the web form) there is some ID number retreived from a database in code behind. At the same time the Visible property of the nestet web user control is chamged to true. I want than forward the ID to the web user control so that a grid view can load data from a database for that ID. How can I access that data (the ID) within a web user control context nested in that page?  Kind regards   Check this ;ink

Pass Values from a user control to a web form
Hi All,  I am currently trying to add captcha to my webform. I have a question on how to pass a number/string from a .ascx to a .aspx page. The aspx is being used in the .ascx (user control) in an image tag. <asp:Image ID="imgCaptcha" runat="server" ImageUrl="Image.aspx"/> The aspx page is being rendered as a jpeg image. So Inorder for the captcha to be displayed with the image, I need to pass the code from the user control to the aspx page. I have an option to pass the number as a query string or use it in session. But is there any ot...

Passing Values from a Web Form to Another Web Form
Hello All! I am trying to pass values from one web form to another web form. I know that there are 3 ways of doing this: queryString, Server.Transfer and Session. I am using the Server.Transfer method. But I am not able to create, in my 2nd web form, an instance of my 1st web form. My 1st Web form is named CallTrack.aspx and my 2nd is named Export.aspx. What I mean is something like this: Public value as CallTrack. I can't create it in my 2nd web form because when the intellisense is displayed, there's no CallTrack in the options. Thanks!   How about using cross-...

Web User Control to Web User Control...
Hi, I have 2 User controls on a page and want Control1 to call a method of Control2. Is this Possible? Example: Con1 = Datalist showing products, each with a Quantity Box and a Button. Con2 = Repeater showing Cart Preview (name, Price) in page.aspx. When I click on the button on the DataList in Con1 it adds the item into the Session based Cart. However it does not update the Cart Preview. I need to call BindPreview() in Con2 in order to update the Cart Preview... Does that make sense? argh! any help much appreciated! PeteWeb Design Nottingham, UK Well I can call BindPreview() from m...

Passing same property value to multiple Web User Controls
I am trying to write a Web Form (aspx) page that accepts QueryString parameters for a Web User Control to display and a LocalValue that is common across all ascx pages. The following code works: Private Sub ShowControl(ByVal AscxName As String, ByVal LocalValue As String) Dim uc As UserControl uc = LoadControl(AscxName) Select Case AscxName Case "WebUserControl1.ascx" DirectCast(uc, WebUserControl1).CommonProperty = LocalValue Case "WebUserControl2.ascx" DirectCast(uc,...

Using property values of user control between two web forms.
Hi,I am stuck with a problem.I have a user control on more than one web form( say webform1 and webform2 ).The user control consists of several hyperlinks(say hyp1 and hyp2 ).When I enter values in webform1 and then click 'save' button , one of the property of user control (say ID ) is assigned some value. I want to use that value 'ID' in webform2 after the user clicks on hyp2. I dont think using Querystring will be useful because hyp1 is selected be default. It is not a compulsion for the user, that he has to click on hyp2..he can also click on other hyperlinks of the user control also...Ple...

Passing values from a parent web control to child web control
I have a parent control which called CONTROL1 and a child control witch called CONTROL2 I would link to pass a value from the parent control to the child control. In the parent control(CONTROL1) I have the following Event Handler . private void btn_Handler(object sender, EventArgs e) { …      if (Page.IsPostBack) {              // Send the officer names to the child controls.             if(m_nameList.SelectedItem.Text != "")     ...

Web Form and Web User Control
Hello, I have a Web User Control (ascx) that includes a button. This button has an onclick event method. This Web User control is included into a Web Form. (thru LoadControl). However, when I click on the button, the event method is not executed. What should I include in order it works fine? Thanks in advance. GAA. Using Loadcontrol is using dynamic controls and when using dynamic controls you must recreate the same dynamic controls ono postback to econstruct the page control tree. It is best if you do this during the Page PreInit event. How complex are your controls ...

access controls on web user control x from web user control Y
I have 2 web users controls in a page and I would like to get or set the selected values of a few dropdown boxes on web user control X from web user control Y and I also would like to know how to access functions that are on a web user control X from a web user control Y, is this possible? How can I do it? User can access and set the values of the User Control from .aspx page through properties,using javascript and in code-behind of aspx page.The details of it are shown below Using PropertiesIf the Sample.ascx control has two textboxes and submit button.You can access the valu...

Clearing Web Controls Values from a Web Form
I have a web form and after a user submit it I want to clear the form so that they may submit another entry. I have seen examples in VB of how to loop thru a web form and clear the controls, but I need a C# solution. I have tried the following code, while it does not give me an error, it does not clear the controls on the form. Any suggestions? Thanks! foreach (Control parent in Page.Controls)         {             foreach (Control child in parent.Controls)           ...

custom web user control and web form
Guys,          I am trying to develop a context menu control for all of my pages. what i am trying to do is that i want the control to pick a datasource from the markup and then check whether its an xml file or a datatable. I created a class called datasource.   /**************************DataSource Class****************************/  public class DataSource { /// <summary> /// This is to identify unique elements from the markup /// </summary>protected string _ID; /// <summary> /// This will be the Datasource ID e...

Web User Control Not rendering in Web Form
I have created a Web User control that is made up of a Multiview with 2 views inside the Multiview. I have buttons on both views and a gridview on 1 view. My question is when I drop this Web User Control on a Web Form all I see is [MultiView"MultiView1"] and when I view the from in the browser I dont see the Web User Control. I was wondering if someone could please tell me why the Web User Control is not displaying or rendering.     Thanks In Advance Hi, Please check your aspx file for correct reference, like following example: TestControl.ascx:<%@ Control ...

web controls and web user control
i have a problem in a web form , I have a webform that contains a web user control which in turn contains a html input form ,the web control events don't fire up ,When I click button ,no effect ,I don't know what is the effect of the html form which is in the web user control on the web controls in the web form ?? can any one help me the web control event should be handle in the code behind page, is the event handler for the button you are clicking registered? You can try double clicking the button, should give you the default btn_click event handler in code behind. Also, make ...

Web resources about - Passing values to property in user web control -

Property - Wikipedia, the free encyclopedia
This article may require copy editing for grammar, style, cohesion, tone, or spelling . You can assist by editing it . In abstract, property ...

Property - Wikipedia, the free encyclopedia
In abstraction, property is that which belongs to or with something, whether as an attribute or as a component of said thing. For the significant ...

RBA governor Glenn Stevens welcomes slowing property market
The easing of property markets is welcome and essential says RBA governor Glenn Stevens.

Man kidnaps inflatable Santa from Port Macquarie property
A thief is sure to be left off the &quot;nice list&quot; this Christmas after stealing a giant, inflatable Santa Claus from a yuletide display ...

China stocks rise, led by property shares - DailyTelegraph Search Search
CHINA stocks have climbed, led by property and resources shares, amid signs that insurers are scrambling for stakes in real estate majors and ...

China stocks rise, led by property shares
CHINA stocks have climbed, led by property and resources shares, amid signs that insurers are scrambling for stakes in real estate majors and ...

$863m stamp duty windfall for NSW Government on back of asset sales and property
The Baird government is expecting a massive stamp duty bonanza but warn it may be the last for some time as the property market cools.

Men face court after $30,000 worth of suspected stolen property seized in Griffith
Two men are set to face the ACT Magistrates Court on Saturday morning in relation to stolen property and burglary charges.

Perth bushfire: Wattle Grove property lost in blaze but warning now downgraded
A bushfire burning in Perth's south-east destroys one derelict house and a shed, but is no longer threatening lives and homes.

Vandals spray-paint Hawthorne mosques, leave fake grenade on property
Two mosques in Hawthorne were vandalized and police say both incidents are being investigated as hate crimes.

Resources last updated: 12/23/2015 10:55:30 PM