.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

ScriptManager in Composite Control

Posted By:      Posted Date: October 04, 2010    Points: 0   Category :ASP.Net

Hello Frnds

Can anybody tell me how can i access ScriptManager in my Composite Control?

I do have reference of system.web in my project but when i type System.Web.UI.

i am not able to get reference of ScriptManager afeter UI.

The reason for doing this is that i have a composite control which is registering some client script on OnPreRender event.

this control works fine when placed on web page without update panel but gives error "object expected" when placed in an update panel

i am registering client script as follows 

this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "test" + this.ClientID, script.ToString());
when i search on google i found that i should register it like this 
ScriptManager.RegisterStartupScript(this, typeof(Page), UniqueID, "alert('Data successfully insert into database');", true);

but i am not getting the reference of

can anybody help me to get rid of this problem.

View Complete Post

More Related Resource Links

Composite Control which contains arbitrary content defined in .aspx of parent and thier ViewState


I want to write own control which can contain other. And I want to define content of the control in the .aspx file where the control is defined. I have written such control. But now I have issue with ViewState of inner controls of my control. The following samle illustrates the issue: I defined two asp:DropDownList ID="ddl1" and ID="ddl2" One of them is inside of my control and other is outside. When posback is occurred asp:DropDownList ID="ddl1 loses state and becomes empty. How to say ASP.net to store state of inner controls defined by this way?


<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MyControl.ascx.cs" Inherits="DynamicControls.Controls.MyControl" %>

<div class="box">
    <div class="Header-Left">
        <div class="Header-Right">
            My Control
    <div class="Content">
        <asp:PlaceHolder ID="contentPlace" runat="Server" />

video tutorial link for composite and rendered custom server control


hii all

i am new to technology so go easy on this post

according to what i read from web there are 3 type of custom server controls

1 superclass

2 composite

3 rendered

i found video tutorial for superclass custom server control but couldnt find video tutials for other 2.

please forward me link for composite and rendered custom server controls video tutorial  

require Video tutorial for Composite server control and rendered server control


hi guys

i am new to forum and technology so please go easy

according to what i read from web there 3 types of custom server controls

1. composite



i found video tutorial to create and use superclass custom control in your project (extending dropdown control functionality)

i am trying to search video tutorial for other 2 types .please help me.

Composite control: How to bubble a textbox's TextChanged event?


I've created a composite control that contains several controls, including a textbox. I'm trying to expose the TextChanged event of the textbox as an event on the composite control. I understand that events can be bubbled up the control hierarchy and handled at a higher level, which I've attempted to do, but I can't get the bubbled event to fire. When I drop the control on an aspx I can see the TextChanged event, I can subscribe to the event, but nothing ever happens. Any suggestions? Here is what I think is the relevant code:

// My event
private static readonly object EventTextChanged = new object();

//Handle the bubbled event
EventHandler textChangedHandler = (EventHandler)Events[EventTextChanged];

protected override bool OnBubbleEvent(object source, EventArgs e) 
    bool handled = false;

Localization not working in class library (composite control)



I have a class library called WEM.portal which used Resource files to localise text in my composite controls.

I store my resource files (eg MyResourceFile1.resx) in App_GlobalResources folder and then refer to them using

MyLabel1.text = My.Resources.MyResourceFile1.MyResourceKey1

This is all working ok until I create seperate files for each language such as MyResourceFile1.FR-fr.resx.

I have implemented this throughout my other web applications but the Class Library doesnt seem to want to work the same way

When I load the page it correctly showes the resourced keys which I have done through the web application BUT the resource keys in the composite controls does not seem to pick up the culture code.

Am I missing something stupid. Ive tried

  • changing the Build Action on the resource file to Content and Custom tool to GlobalResourceProxyGenerator
  • Creating a resourceManager but to no avail


User Control as Composite Control Property


I have a composite control (Called Dialog) which has a property "ContentControl"

At design time, I'd like this property to bind to a user control that is on the page.

When I add the items in the designer, the designer loads as expected.

However, when I try to run the web page, I get the following error:

Parser Error Message: Cannot create an object of type 'System.Web.UI.UserControl' from its string representation 'EditTerm1' for the 'ContentControl' property.

Please let me know if there is another way to bind a user control as a property of a composite control.


Designer Code:


	<cc1:Dialog ID="Dialog1" runat="server" Buttons="SaveCancel" 
Title="Edit Term" ContentControl="EditTerm1" />

Composite Control: Load Script at bottom?

Is there a way to have an embedded .js file load at the bottom of my page?....I can load it into the header quite easily, but I want it at the bottom :)Regards,Steve

ScriptManager control in user control

Hi, I have a user control (.ascx) in which I am calling web service through javascript. For that i have to add ScriptManager control in .ascx. But if I use this control on a same page more than once, I get the exception 'Only one instance of ScriptManager control can be added on page'. This is obvoius as 'ScriptManager' control will be loaded multiple times. So my query is : Can we add ScriptManager dynamically in .ascx by checking if its alredy exists on page? Thanks.

ScriptManager control

MSDN documentation says that the ScriptManager class is part of the System.Web.UI namespace and I see that I can create a ScriptManager object programmatically. However, I don't see the ScriptManager control on the front-end. Do I need to reference the Ajax Control Toolkit dll in order to have access to this control?

Anyone know about DataPager in a composite control




I'm trying to use a datapager inside a composite control which references a listview inside the same composite control. Does anyone have experience with doing this as I believe I've set everything up but its not being displayed and not affecting the listView

A composite control with a listbox


hello friends,

I need to create a composite control with a listbox.The selected item should be displayed on a textbox and need to edit and delete that selected item by clicking on 2 buttons edit and delete.Also another button to add item to the listbox.Items will be binded from the database as reqiured for the application.

How will create this composite control using asp.net server control?please tell me the code in C#. 

Composite control in Visual Studio Toolbox


Hi Friends,

I have developed a composite control in framework 2.0. I want when I add reference assembly(.dll) of composite control in any other project, it should automatically be added into visual studio toolbox so that I can drag-n-drop it any time. Currently I need to manually add control from Visual Studio > Toolbox > Choose Items.

Any solution?


Page Life Cycle and custom composite server control life cycle



We are creating a composite server control. It will have few other controls. I am confused where exactly to write the code ie in which event. Is page life cycle and control life cycle follow the same event order?

Could any one please suggest or post articles on this.

Thank You

How to set default Height/Width property value of Composite control?

This is my code:

class Regi : CompositeControl
private TextBox nameTextBox;    

[DefaultValue(typeof(Unit), "400px")]
public override Unit Width
return base.Width;

Composite Control, File Uploader with 3 image buttons one image button fires but the other two don'


Hi, I've been trying to develop my own custom controls to save me having to write all the bumf of code. I've successfully done all the easy ones but am stuck on this one. I have a file uploader that has a submit image button a view uploaded file button and delete uploaded file button. The control works and will successfully upload the file. however the view button and delete button do not.

here's the code...

[DefaultProperty("Text"), ToolboxData("<{0}:AdminFileUpload runat=\"server\"> </{0}:AdminFileUpload>")]
    public class AdminFileUpload : CompositeControl, INamingContainer
        protected Label lbl;
        protected FileUpload fu;
        protected ImageButton upload; 
        protected ImageButton downloadCurrent;
        protected ImageButton deleteButton;

        [Bindable(true), Category("Miscellaneous"), DefaultValue(""), Localizable(true)]
        public string LabelText
            get { EnsureChildControls(); return lbl.Text; }
            set { EnsureChildControls(); lbl.Text = value; }

        [Bindable(true), Category("Miscellaneous"), DefaultValue(""), Localizable(true)]
        public string FileName
                string s = (string)Vi

Composite control get/set problem


      public string Value
              return _TxtDate.Text;

composite control


Hi to all,

I am creating a composite control. On the selection of item in the dropdownlist, the result should be shown. But its mismatching the result. Here is the code for the control:

public class FormExtenderControl : CompositeControl
        //private static readonly object EventSubmitKey = new object();
        private workspaceEntities entity = new workspaceEntities();
        public string Text
                String s = (String)ViewState["Text"];
                return ((s == null) ? "[" + this.ID + "]" : s);

                ViewState["Text"] = value;

        public virtual string entityid
                string s = (string)ViewState["entityid"];
                return (s == null) ? string.Empty : s;
                ViewState["entityid"] = value;

        protected override void CreateChildControls()
            int entityID = int.Parse(entityid);

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend