Rectangle 27 67

When adding a namespace, I've found I also need the assembly. If your assembly is also myApplication do this in web.config:

<add tagPrefix="one" namespace="myApplication.Controls" assembly="myApplication"/>

Then, just clean and rebuild and it should all work. Once this is in your web.config, you don't need to add it to your page unless you're using this in a control in the same directory, then you'll need the reference at the top of the web form. But, I recommend against using custom server controls in the same directory as user controls.

That's so strange that it requires the assembly, even though the control is within the app. Thank you for your help.

c# - ASP.NET Custom Control - Unknown server tag - Stack Overflow

c# asp.net custom-controls
Rectangle 27 12

Step 1: Create a custom control

a nice challenge indeed. As @DaveAlperovich has commented, you can't use the DrawingManager to retrieve this piece of information; While drawing, you don't have any access to the circle; You have to wait for the DrawingManager to trigger the circlecomplete event to get a reference to this circle.

Nevertheless, if you can't have a real manager, just fake it. See the snippet and the description right below.

var FakeDrawer = function(controlDiv, map) {
  var self = this;

  /* Initialization, some styling ... */
  self._map = map;
  self.initControls(controlDiv);

  /* Setup the click event listener: drawingmode for the circle control */
  google.maps.event.addDomListener(self._controls.circle, 'click', function() {
    /* Ensure consistency */
    self.reset();

    /* Bind the drawing mode */
    self._map.setOptions({
      draggableCursor: "crosshair"
    });
    self._drawListener = self._map.addListener('mousedown', self.drawingMode(self));
  });

  /* Just reset things for the stop controls */
  google.maps.event.addDomListener(self._controls.stop, 'click', function() {
    self.reset();
  });
};

FakeDrawer.prototype.drawingMode = function(self) {
  return function(center) {
    /* Let's freeze the map during drawing */
    self._map.setOptions({
      draggable: false
    });

    /* Create a new circle which will be manually scaled */
    var circle = new google.maps.Circle({
      fillColor: '#000',
      fillOpacity: 0.3,
      strokeWeight: 2,
      clickable: false,
      editable: false,
      map: self._map,
      radius: 1,
      center: center.latLng,
      zIndex: 1
    });

    /* Update the radius on each mouse move */
    var onMouseMove = self._map.addListener('mousemove', function(border) {
      var radius = 1000 * self.distanceBetweenPoints(center.latLng, border.latLng);
      circle.setRadius(radius);

      /* Here is the feature, know the radius while drawing */
      google.maps.event.trigger(self, 'drawing_radius_changed', circle);
    });

    /* The user has finished its drawing */
    google.maps.event.addListenerOnce(self._map, 'mouseup', function() {
      /* Remove all listeners as they are no more required */
      google.maps.event.removeListener(onMouseMove);

      circle.setEditable(true);

      /* Restore some options to keep a consistent behavior */
      self.reset();

      /* Notify listener with the final circle */
      google.maps.event.trigger(self, 'circlecomplete', circle);
    });
  };
};

FakeDrawer.prototype.reset = function() {
  var self = this;

  self._map.setOptions({
    draggableCursor: "",
    draggable: "true"
  });

  /* Remove any applied listener */
  if (self._drawListener) {
    google.maps.event.removeListener(self._drawListener);
  }
};

/* Create views and associated css */
FakeDrawer.prototype.initControls = function(controlDiv) {
  var self = this;

  function createControlUI(title, image) {
    var controlUI = document.createElement('div');
    controlUI.style.backgroundColor = '#fff';
    controlUI.style.border = '1px solid rgba(0, 0, 0, .15)';
    controlUI.style.boxShadow = '1 4px -1px rgba(0, 0, 0, .3)';
    controlUI.style.marginTop = '10px';
    controlUI.style.textAlign = 'center';
    controlUI.style.width = '25px';
    controlUI.style.height = '25px';
    controlUI.style.display = 'inline-block';
    controlUI.title = title;
    if (image == "circle") {
      controlUI.style.borderLeft = "none";
    }

    var controlImgWrapper = document.createElement('div');
    controlImgWrapper.style.width = '16px';
    controlImgWrapper.style.height = '16px';
    controlImgWrapper.style.overflow = 'hidden';
    controlImgWrapper.style.display = 'inline-block';
    controlImgWrapper.style.marginTop = '4px';
    controlUI.appendChild(controlImgWrapper);

    var imageOffset = {
      "circle": 0,
      "openhand": -9 * 16
    }[image];

    var controlImg = document.createElement('img');
    controlImg.src = 'https://maps.gstatic.com/mapfiles/drawing.png';
    controlImg.style.marginTop = imageOffset + "px";
    controlImgWrapper.appendChild(controlImg);

    var focusBackground = function() {
      controlUI.style.backgroundColor = '#eee';
    };

    var unfocusBackground = function() {
      controlUI.style.backgroundColor = "#fff";
    };

    controlImg.addEventListener('mouseenter', focusBackground);
    controlImg.addEventListener('mouseout', unfocusBackground);
    controlUI.addEventListener('mouseenter', focusBackground);
    controlUI.addEventListener('mouseout', unfocusBackground);

    return controlUI;
  }

  self._controls = {
    circle: createControlUI("Draw a circle", "circle"),
    stop: createControlUI("Stop drawing", "openhand"),
  };

  controlDiv.appendChild(self._controls.stop);
  controlDiv.appendChild(self._controls.circle);
};

FakeDrawer.prototype.distanceBetweenPoints = function(p1, p2) {
  if (!p1 || !p2) {
    return 0;
  }
  var R = 6371;
  var dLat = (p2.lat() - p1.lat()) * Math.PI / 180;
  var dLon = (p2.lng() - p1.lng()) * Math.PI / 180;
  var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(p1.lat() * Math.PI / 180) * Math.cos(p2.lat() * Math.PI / 180) * Math.sin(dLon / 2) * Math.sin(dLon / 2);
  var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
  var d = R * c;
  return d;
};





function InitializeMap() {
  var latlng = new google.maps.LatLng(29.760193, -95.36939);
  var myOptions = {
    zoom: 12,
    center: latlng,
    zoomControl: true,
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    disableDefaultUI: true
  };
  var map = new google.maps.Map(document.getElementById("map"), myOptions);

  /* Add a custom control */
  var fakeDrawerDiv = document.createElement('div');
  var fakeDrawer = new FakeDrawer(fakeDrawerDiv, map);

  fakeDrawerDiv.index = 1;
  map.controls[google.maps.ControlPosition.TOP_CENTER].push(fakeDrawerDiv);


  var updateInfo = function(circle) {
    document.getElementById("info").innerHTML = "Radius: " + circle.getRadius();
  };

  google.maps.event.addListener(fakeDrawer, 'drawing_radius_changed', updateInfo);
  google.maps.event.addListener(fakeDrawer, 'circlecomplete', function(circle) {
    google.maps.event.addListener(circle, 'radius_changed', function() {
      updateInfo(circle);
    });
  });
}


google.maps.event.addDomListener(window, 'load', InitializeMap);
html,
body {
  height: 100%;
  margin: 0px;
  padding: 0px
}
#map {
  height: 80%;
  width: 100%;
}
<script src="https://maps.googleapis.com/maps/api/js?v=3&libraries=drawing&ext=.js"></script>
<div id="map"></div>
<div id="info"></div>

Somewhere in the file or as an external library:

This are functions that we may use; Highly inspired from your JsFiddle :)

FakeDrawer.prototype.reset = function () {
    var self = this;
    self._map.setOptions({
        draggableCursor: "",
        draggable: "true"
    });

    /* Remove any applied listener */
    if (self._drawListener) { google.maps.event.removeListener(self._drawListener) ; }
};

And, a distance computer:

FakeDrawer.prototype.distanceBetweenPoints = function (p1, p2) {
    if (!p1 || !p2) {
        return 0;
    }
    var R = 6371;
    var dLat = (p2.lat() - p1.lat()) * Math.PI / 180;
    var dLon = (p2.lng() - p1.lng()) * Math.PI / 180;
    var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(p1.lat() * Math.PI / 180) * Math.cos(p2.lat() * Math.PI / 180) * Math.sin(dLon / 2) * Math.sin(dLon / 2);
    var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
    var d = R * c;
    return d;
};

Now that we have some controls, we have to define their behavior. The stop control is straightforward; Let's have a look to the circle control.

FakeDrawer.prototype.drawingMode = function (self) {
    return function (center) {
        /* Let's freeze the map during drawing */
        self._map.setOptions({draggable: false});

        /* Create a new circle which will be manually scaled */
        var circle = new google.maps.Circle({
            fillColor: '#000',
            fillOpacity: 0.3,
            strokeWeight: 2,
            clickable: false,
            editable: false,
            map: self._map,
            radius: 1,
            center: center.latLng,
            zIndex: 1
        });

        /* Update the radius on each mouse move */
        var onMouseMove = self._map.addListener('mousemove', function (border) {
            var radius = 1000 * self.distanceBetweenPoints(center.latLng, border.latLng);
            circle.setRadius(radius);

            /* Here is the feature, know the radius while drawing */
            google.maps.event.trigger(self, 'drawing_radius_changed', circle);
        });

        /* The user has finished its drawing */
        google.maps.event.addListenerOnce(self._map, 'mouseup', function () {
            /* Remove all listeners as they are no more required */
            google.maps.event.removeListener(onMouseMove);

            circle.setEditable(true);

            /* Restore some options to keep a consistent behavior */
            self.reset();

            /* Notify listener with the final circle */
            google.maps.event.trigger(self, 'circlecomplete', circle);
        });
    };
};

Now that everything is okay, let's add some listeners to the initial version of the constructor so that each control has a corresponding action when clicked.

var FakeDrawer = function (controlDiv, map) {
    var self = this;

    /* Initialization, some styling ... */
    self._map = map;
    self.initControls(controlDiv);

    /* Setup the click event listeners: drawingmode */
    google.maps.event.addDomListener(self._controls.circle, 'click', function() {
        /* Ensure consistency */
        self.reset();

        /* Only drawingmode */
        self._map.setOptions({draggableCursor: "crosshair"});
        self._drawListener = self._map.addListener('mousedown', self.drawingMode(self));
    });

    google.maps.event.addDomListener(self._controls.stop, 'click', function () {
        self.reset();
    });
};
var fakeDrawerDiv = document.createElement('div');
var fakeDrawer = new FakeDrawer(fakeDrawerDiv, map);

fakeDrawerDiv.index = 1;
map.controls[google.maps.ControlPosition.TOP_CENTER].push(fakeDrawerDiv);

var updateInfo = function (circle) {
    document.getElementById("info").innerHTML = "Radius: " + circle.getRadius();
};

google.maps.event.addListener(fakeDrawer, 'drawing_radius_changed', updateInfo);
google.maps.event.addListener(fakeDrawer, 'circlecomplete', function (circle) {
    google.maps.event.addListener(circle, 'radius_changed', function () {
        updateInfo(circle);
    });
});

Thanks for your answer. Really nice.. I have two doubts. 1. Can i have CircleComplete and MouseOver listener on it. 2. Can I have Polygon tool on it and will it behave like same Drawing manager tool ?

I want to update the radius even after circle complete event

Hey! 1/ The current module gives you back a google.maps.Circle object from a circlecomplete; It's up to you to bind events on it. Look at the last part of my answer. 2/ You can integrate a classic DrawingManager with just the polygon feature (can set that in manager's options). We'll need some fix with the css to make the whole thing pretty. 3/ Echoes point 1.

javascript - How to know radius while drawing a circle on Google Maps ...

javascript google-maps google-maps-api-3 circle
Rectangle 27 19

The Razor syntax does not support the notion of Controls at all. If you want to use controls you will have to use the ASPX (WebForms) syntax.

However, the recomended MVC pattern is to use html helper functions or partial views. In Razor you can also use the @helper syntax for quick helper functions.

I think it is important to note that "ASPX syntax" can be misleading here. I've seen questions of people asking how to use server controls on ASP.NET MVC using ASPX view engine. But yes, your answer is correct!

Custom controls with ASP.NET MVC Razor - Stack Overflow

asp.net-mvc asp.net-mvc-3 razor
Rectangle 27 5

I say go ahead with the custom rendered control. I find that in most cases the composite can be easier done and used in a UserControl, but anything beyond that and you'd need to have a finer degree of control (pun unintended) to merit your own rendering strategy.

There maybe controls that are simple enough to merit a composite (e.g., a textbox combined with a javascript/dhtml based datepicker, for example) but beyond that one example, it looks like custom rendered controls are the way to go.

c# - ASP.NET Custom Controls - Composites - Stack Overflow

c# .net asp.net user-controls controls
Rectangle 27 10

In ASP.NET MVC custom server controls should be avoided. Most of them rely on ViewState and PostBack which are notions that no longer exist in MVC. You should prefer using templates, HTML helpers to implement some reusable functionality. Another problem with controls is most of them encapsulate some business logic which fetches data from somewhere and renders it which is an anti-MVC pattern. In MVC it is the controller responsibility to manipulate the model and fetch data and pass a view model to the view which simply should display it.

I know that, but I'm going to use controls derived from MvcControls, only for trivial ui stuffs.

I mean to implement controls derived from class MvcControl in namespace Microsoft.Web.Mvc.Controls from MvcFutures assembly.

@Fabrizio even if you have good enough reasons to want to use controls in MVC, they simply will not work with Razor because the page model it uses was not designed to work with controls. Regardless of your feelings on the use of controls, they are near impossible to use in Razor.

Custom controls with ASP.NET MVC Razor - Stack Overflow

asp.net-mvc asp.net-mvc-3 razor
Rectangle 27 6

MVC uses partial views rather than custom controls, and they can be used in two ways that cover pretty much everything a custom control can do

  • RenderPartial which renders data already retrieved by the page controller
  • RenderAction which is similar but has its own controller action so can get data independently

The only scenario I can think of where it would be worth putting a custom control on an mvc view is if you are working on a partially migrated webforms project, and I doubt that would work with anything other than the WebFormsViewEngine.

Custom controls with ASP.NET MVC Razor - Stack Overflow

asp.net-mvc asp.net-mvc-3 razor
Rectangle 27 4

Any page with a MasterPage, whether it is in SharePoint or not, is a Content Page. These pages only support content contained in Content controls. Attempting to add an HTML tag or ASP.NET control directly to the page is not supported.

sharepoint - Add Custom Control in Asp.net - Stack Overflow

asp.net sharepoint controls
Rectangle 27 3

public static void WriteControls
        (this HtmlTextWriter o, string format, params object[] args)
 { 
    const string delimiter = "<2E01A260-BD39-47d0-8C5E-0DF814FDF9DC>";
    var controls  = new Dictionary<string,Control>();

    for(int i =0; i < args.Length; ++i)
    { 
       var c = args[i] as Control; 
       if (c==null) continue;
       var guid = Guid.NewGuid().ToString();
       controls[guid] = c;
       args[i] = delimiter+guid+delimiter;
    }

    var _strings = string.Format(format, args)
                         .Split(new string[]{delimiter},
                                StringSplitOptions.None);
    foreach(var s in _strings)
    { 
       if (controls.ContainsKey(s)) 
           controls[s].RenderControl(o);
       else 
           o.Write(s);
    }
}

Then, to render a custom composite in the RenderContents() method I write this:

protected override void RenderContents(HtmlTextWriter o)
{ 
    o.WriteControls
         (@"<table>
               <tr>
                    <td>{0}</td>
                    <td>{1}</td>
               </tr>
             </table>"
            ,Text
            ,control1);
 }

c# - ASP.NET Custom Controls - Composites - Stack Overflow

c# .net asp.net user-controls controls
Rectangle 27 2

Rob, you are right. The approach I mentioned is kind of a hybrid. The advantage of having ascx files around is that on every project I've seen, designers would feel most comfortable with editing actual markup and with the ascx you and a designer can work separately. If you don't plan on actual CSS/markup/design changes on the controls themselves later, you can go with a custom rendered control. As I said, my approach is only relevant for more complicated scenarios (and these are probably where you need a designer :))

c# - ASP.NET Custom Controls - Composites - Stack Overflow

c# .net asp.net user-controls controls
Rectangle 27 3

This happens because at any given moment a control can only belong to one parent. When you add a control from one collection into another, it is removed from the first one automatically. In your case:

for (int i = 0; i < Controls.Count; i++)
{
   //obtain a reference
   Control control = Controls[i];
   //The control is removed from Controls collection 
   //and added to content.Controls. All remaining controls get shifted left.
   //This means that next control will get skipped.
   content.Controls.Add(control);
}

Consider doing following (by the way, you probably don't need to use base in this case):

Control[] controls = new Control[Controls.Count];
for (int i = Controls.Count - 1; i >= 0; i--) //walk backwards
    controls[i] = Controls[i];

for (int i = 0; i < controls.Length; i++)
    content.Controls.Add(controls[i]);

I'm so stupid :) I should have recognized that my controls collection gets modified (at least when I got a compiler error at runtime when using the foreach loop). Thanks for the hint!

Custom ASP.net Server Controls - Rendering - Stack Overflow

asp.net controls
Rectangle 27 3

You can turn a user control into a custom control that is in a standalone .dll, but it loses the ability of being updateable via markup.

In other words, you can build an .ascx file using markup and code, and then turn it into something similar to a control that was built exclusively with code.

You have to understand that user controls are just a convenience for reusable content though - ultimately, the markup does get processed and compiled. Custom controls are really the only way to distribute a web control. IF you have to distribute controls as a library, I would concentrate on making them CSS friendly for your devs with just a few layout controlling properties, rather than messing around with .ascx.

When you use the mentioned technique, the naming of the DLL files is terrible. To fix that, use aspnet_merge <yourdeploydir> from the commandline without options. This will turn each directory into one DLL with all ASCX under it: msdn.microsoft.com/en-us/library/bb397866.aspx

c# - Creating Custom Controls with .ascx files - Stack Overflow

c# asp.net controls
Rectangle 27 1

Using custom composite controls has a point in a situation where you have a large web application and want to reuse large chunks in many places. Then you would only add child controls of the ones you are developing instead of repeating yourself. On a large project I've worked recently what we did is the following:

  • Every composite control has a template. An ascx file (without the <%Control%> directive) which only contains the markup for the template.
  • The container (being a control in itself) is initialized from the template.
  • The container exposes properties for all other controls in the template.
  • You only use this.Controls.Add([the_container]) in your composite control.

In fact you need a base class that would take care of initializing a container with the specified template and also throw exceptions when a control is not found in the template. Of course this is likely to be an overkill in a small application. If you don't have reused code and markup and only want to write simple controls, you're better off using User Controls.

c# - ASP.NET Custom Controls - Composites - Stack Overflow

c# .net asp.net user-controls controls
Rectangle 27 1

I often use composite controls. Instead of overriding Render or RenderContents, just assign each Control a CssClass and use stylesheets. For multiple Controls.Add, I use an extension method:

//Controls.Add(c1, c2, c3)
static void Add(this ControlCollection coll, params Control[] controls)
 { foreach(Control control in controls) coll.Add(control);
 }
writer.Render(@"<table>
                   <tr><td>{0}</td></tr>
                   <tr>
                       <td>", Text);
control1.RenderControl(writer);
writer.Render("</td></tr></table>");
childControl = new Control {  ID="Foo"
                            , CssClass="class1"
                            , CausesValidation=true;
                           };

c# - ASP.NET Custom Controls - Composites - Stack Overflow

c# .net asp.net user-controls controls
Rectangle 27 2

You can use two Panels as parents of your two control collections (and they would provide grouping and improved readability). Add your controls from each collection to the Controls collection of respective panel, and in the Render method just call Render methods of each panel. Panels will automatically render their children, and will provide them with their own namespace, so, you can have controls with similar IDs in different panels.

c# - Render multiple control collections in ASP.NET custom control - S...

c# asp.net custom-controls rendering controlcollection
Rectangle 27 9

Hi it sounds to me like you are bit confused over what the various properties of the radio button control do and how to generate the radio button correctly.

The ID property is key here.

You should set the ID property to a unique string that you then use to access the control on postback.

The GroupName is just an alias for the standard name property of a radio button and is used so when a user clicks on a radio button in a group only one radio button can be selected.

//add list to radio button list
RadioButton radioButton = new RadioButton();
radioButton.GroupName = "radioGroup";
radioButton.Text = singleType.appTypeID.ToString();
radioButton.ID = singleType.appTypeName;

radioArea.Controls.Add(radioButton);

Label label = new Label();
label.Text = "<br />";
radioArea.Controls.Add(label);

In the above example I've assigned singleType.appTypeName as the ID, assuming that this is unique.

Then to retrive the value on postback do this, assumnig that singleType.appTypeName = "mySuperApp":

RadioButton radioButton = (RadioButton) radioArea.FindControl("mySuperApp");

Now you can access the radioButton variable to check which GroupName it has, get it's value and check that it is checked.

You will need to loop over the radio buttons to find out which one is checked. An easy way of doing this is looping over the child controls of the radioArea and checking eack control to see if it is a radio button and if it is checked. Another options is to give each ID a prefix i.e. ID="RAD_"+singleType.appTypeName and loop over the Request object and match each one with the correct suffix.

'System.Web.UI.WebControls.RadioButton' does not contain a definition for 'Value'

Corrected my brain and fingers not in sync error

surely if there all part of the same group i can just retreive the checked value rather than having to loop through loads of radio controls?

I'm afraid not. The GroupName attribute is just an alias for the normal name attribute on the radiobutton. The only way of doing what you would like is to use the RadioButtonList control. Otherwise it's just a case of looping through the controls to find the checked one.

Accessing value of dynamically created controls c# asp.net - Stack Ove...

c# asp.net controls dynamic
Rectangle 27 3

Search (User Control which fires the event)

Note: Here is the demo. You might want to rename delegates and methods which make sense to your scenario.

Finally, GridSql.ascx receives the search text.

<%@ Control Language="C#" AutoEventWireup="true" 
    CodeBehind="GridSql.ascx.cs" Inherits="DemoWebForm.GridSql" %>
<asp:Label runat="server" ID="SearchTextLabel"/>

public partial class GridSql : System.Web.UI.UserControl
{
    public void SearchTextMethod(string searchText)
    {
        SearchTextLabel.Text = searchText;
    }
}
<%@ Page Language="C#" AutoEventWireup="true" 
    CodeBehind="Parent.aspx.cs" Inherits="DemoWebForm.Parent" %>

<%@ Register src="~/Search.ascx" tagname="Search" tagprefix="uc1" %>
<%@ Register src="~/GridSql.ascx" tagname="GridSql" tagprefix="uc2" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <uc1:Search ID="Search1" runat="server" />
        <uc2:GridSql ID="GridSql1" runat="server" />
    </form>
</body>
</html>

public partial class Parent : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Search1.SearchText += m => GridSql1.SearchTextMethod(m);
    }
}

Thank you very much. Someone also just recommended to pass the data into querystring and then read it on the control pages. Is that a valid option as well(obviously small amount and non sensitive data)? He says it is in case they refresh, it will still display same data.

querystring is for passing one page to another page. It is not a good approach for your scenario, because you need to reload the entire page in order for a control to receive a message from other control.

c# - How to communicate between user controls in Asp.Net - Stack Overf...

c# asp.net user-controls
Rectangle 27 2

I don't see you adding your controls to the Controls collection anywhere, which would explain why they can't access the Page (since they've never been officially placed on the page).

Child Control Initialization in Custom Composite in ASP.NET - Stack Ov...

asp.net controls custom-server-controls
Rectangle 27 1

I had the same demand. Wanted to use custom webcontrol from Razor/MVC page. One should not do that with controls, that is handling postback. You don't have the eventcycle to support that, but if your only demand is to use a 'rendering control', you could instantiate it in razor, and control where the rendering takes place:

@{
  var myControl = new mycontrols.something();
  myControl.myattribute = Model.MyVar;
  mycontrol.RenderControl(new HtmlTextWriter(this.Output));
}

Custom controls with ASP.NET MVC Razor - Stack Overflow

asp.net-mvc asp.net-mvc-3 razor
Rectangle 27 1

Problem with control-relative file paths

You are probably having problems with relative paths to your JS file. You are specifying relative path to your custom control. You should probably write user control. Anyway. Your JS file is relative path to your custom control, but not relative to the containing page, so your JS file actually never loads. That's why your event handlers are undefined.

The easiest way would be to use absolute paths. Since you're working with user controls you can easily prepend application root folder.

Thanks, but I've not had much luck. I may be misunderstanding. I posted a detailed update to hopefully clarify anything. If you have any ideas, input is appreciated.

Including Javascript with a custom control in an ASP.Net website - Sta...

asp.net javascript custom-controls
Rectangle 27 1

If the controls are separate, they should probably not be communicating directly. After all - most other .NET controls don't communicate directly either. I can only think of two exceptions - child/parent controls sometimes communicate basic information; and data-bound controls sometimes communicate directly with a DataSource. But that's largely it.

If you need to hook up two adjacent controls then the "normal" way of doing it is that their container takes care of it. Like, if a button click affects the text on the label, it is the Page (container for them both) that handles the Click event and sets the Text property.

Alternatively you could also give your ListControl a property called FindControl and assign it in Page_Init or something. But if the coupling is so tight, you might wonder if it would not be better to merge the controls too.

How to communicate between ASP.net custom controls - Stack Overflow

asp.net user-controls