Default Console Object

Default Console Object

Post by Dura » Fri, 07 Jan 2005 07:53:30


Is there a way to access the default console object in a
template's code behind? I've noticed that when I drag a
default console on a template page it doens't create an
object reference in the code behind for the object. For
example
Microsoft.ContentManagement.WebControls.ConsoleControls.De
faultConsole...

Is there a way to get to that object?

Thanks!
 
 
 

Default Console Object

Post by Mei Ying [ » Fri, 07 Jan 2005 12:57:40

Yes, there is - here's some code that may help:

protected
Microsoft.ContentManagement.WebControls.ConsoleControls.Con
sole DefaultConsole1;

private void Page_Load(object sender,
System.EventArgs e)
{
//accessing the console's
properties
string clientID = DefaultConsole1.ClientID;
}

regards
Mei Ying
---
Blog: http://www.yqcomputer.com/
Contact: XXXX@XXXXX.COM
---

 
 
 

Default Console Object

Post by Dura » Sat, 08 Jan 2005 08:11:40

Thanks,
One more question, I get an error when I do that
declaration...

Parser Error
Description: An error occurred during the parsing of a
resource required to service this request. Please review
the following specific parse error details and modify
your source file appropriately.

Parser Error Message: The base class includes the
field 'DefaultConsole1', but its type
(Microsoft.ContentManagement.WebControls.ConsoleControls.C
onsole) is not compatible with the type of control
(ASP.DefaultConsole_ascx).

Source Error

Any Ideas?

Thanks!


on
a
a
For
De
 
 
 

Default Console Object

Post by Mei Ying [ » Sat, 08 Jan 2005 10:50:37

You're absolutely right, I didn't test the code I posted
earlier, so it's completely rubbish. My apologies...

Here's the corrected, tested and working code:

protected MyNamespace.Console.DefaultConsole
DefaultConsole1;

private void Page_Load(object sender,
System.EventArgs e)
{
// Put user code to initialize the
page here
Response.Write
(DefaultConsole1.ClientID);
}

Replace "MyNamespace" with the namespace of your
application.

regards
Mei Ying
---
Blog: http://www.yqcomputer.com/
Contact: XXXX@XXXXX.COM
---