PDA

View Full Version : [CLOSED] Issue using UserControlLoader



amitpareek
Sep 12, 2012, 10:53 AM
Hi,
When I use usercontrolloader inside a page, it works fine. But when I use it inside a control to add another control, I get following error :

Unable to cast object of type 'Ext.Net.UserControlLoader' to type 'Ext.Net.AbstractContainer'

Can you help?

Thanks,

Vladimir
Sep 12, 2012, 11:48 AM
But when I use it inside a control to add another control, I get following error :

Can you demonstrate it? I am not sure that clear understood the scenario

amitpareek
Sep 12, 2012, 1:34 PM
Resolved.

There was an issue with my code.

Thanks,

amitpareek
Sep 12, 2012, 6:44 PM
Hi,
I have another issue with User Control Loader.

When I try to call DirectMethod I get the following error :
The ajax instance method 'FollowSavedSearch' is absent!

Vladimir
Sep 12, 2012, 6:52 PM
Please provide test sample

amitpareek
Sep 12, 2012, 7:04 PM
I am trying to reproduce it.

amitpareek
Sep 12, 2012, 7:45 PM
The issue occured because I had ID and UserConrolID both having same ID in ext:usercontrolloader. Having both unique resolved the issue. May be it could throw compilation error or a more relevant error.

Daniil
Sep 13, 2012, 8:31 AM
Hi @amitpareek,

Please clarify do you mean something like this?

Example

<ext:UserControlLoader
ID="SomeID"
runat="server"
UserControlID="SomeID"
Path="TestUC.ascx" />

amitpareek
Sep 13, 2012, 8:49 AM
Yes. If you have both id's same, it cant find the method, because it tries to search for the method in UserControlLoader class instance.

Try having DirectMethod in TestUC.ascx and try to access it, you will know what I am talking abt.

Daniil
Sep 13, 2012, 9:09 AM
Ok, here is my sample. I am getting this Exception.

Multiple controls with the same ID 'SomeID' were found.
FindControl requires that controls have unique IDs.

Please provide your test case.

Example Page

<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<!DOCTYPE html>

<html>
<head runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />

<ext:UserControlLoader
ID="SomeID"
runat="server"
UserControlID="SomeID"
Path="TestUC.ascx" />
</form>
</body>
</html>


Example User Control

<%@ Control Language="C#" %>

<script runat="server">
[DirectMethod]
public void TestDirectMethod()
{
X.Msg.Alert("DirectMethod", "Hello from User Control!").Show();
}
</script>

<ext:Button runat="server" Text="Call DirectMethod">
<Listeners>
<Click Handler="#{DirectMethods}.TestDirectMethod()" />
</Listeners>
</ext:Button>