Showing posts with label named. Show all posts
Showing posts with label named. Show all posts

Monday, March 26, 2012

newbie: Problems in the code... again

hey

asp.net 2.0

On my webpage have I placed a LoginView (named lvSidebar). On this
loginview's loggedInTemplate I placed a menu (mnuSidebar) and the datasource
to the menu is SiteMapDataSource1.

My Problem is that I cannot access the SiteMapDataSource1 object from the
code:
lvSidebar.LoggedInTemplate.SiteMapDataSource.Start ingNodeUrl =
"Default.aspx";
don't compile:
System.Web.UI.ITemplate' does not contain a definition for
'SiteMapDataSource1'

Any ideas what I should do to solve this?

JeffThe LoggedInTemplate property of the LoginView control does not have a
property called SiteMapDataSource which is what is causing the error. If you
want to prograamatically set the StratingNodeURL property of
SiteMapDataSource1 simply use the following code

SiteMapDataSource1.StartingNodeUrl = "Default.aspx";

The LoginView has nothing to do with it.

"Jeff" wrote:

Quote:

Originally Posted by

hey
>
asp.net 2.0
>
On my webpage have I placed a LoginView (named lvSidebar). On this
loginview's loggedInTemplate I placed a menu (mnuSidebar) and the datasource
to the menu is SiteMapDataSource1.
>
My Problem is that I cannot access the SiteMapDataSource1 object from the
code:
lvSidebar.LoggedInTemplate.SiteMapDataSource.Start ingNodeUrl =
"Default.aspx";
don't compile:
System.Web.UI.ITemplate' does not contain a definition for
'SiteMapDataSource1'
>
Any ideas what I should do to solve this?
>
Jeff
>
>
>


hmm when I in the code start to type "SiteM" the SiteMapDataSource1 isn't
shown in the type-ahead list... this happens if I try to access the
SiteMapDataSource like this SiteMapDataSource1.StartingNodeUrl =
"Default.aspx"; or
lvSidebar.LoggedInTemplate.SiteMapDataSource.Start ingNodeUrl

Another thing is that my webpage has 2 SiteMapDataSource1 controls (yes they
have the same name, but they exist in their own LoginView, lvSidebar and
lvMenu).

Any more suggestions?

Jeff

"clickon" <clickon@.discussions.microsoft.comwrote in message
news:258E83E3-C3EC-4948-93FC-E30DC3F811FD@.microsoft.com...

Quote:

Originally Posted by

The LoggedInTemplate property of the LoginView control does not have a
property called SiteMapDataSource which is what is causing the error. If
you
want to prograamatically set the StratingNodeURL property of
SiteMapDataSource1 simply use the following code
>
SiteMapDataSource1.StartingNodeUrl = "Default.aspx";
>
The LoginView has nothing to do with it.
>
"Jeff" wrote:
>

Quote:

Originally Posted by

>hey
>>
>asp.net 2.0
>>
>On my webpage have I placed a LoginView (named lvSidebar). On this
>loginview's loggedInTemplate I placed a menu (mnuSidebar) and the
>datasource
>to the menu is SiteMapDataSource1.
>>
>My Problem is that I cannot access the SiteMapDataSource1 object from the
>code:
>lvSidebar.LoggedInTemplate.SiteMapDataSource.Start ingNodeUrl =
>"Default.aspx";
>don't compile:
>System.Web.UI.ITemplate' does not contain a definition for
>'SiteMapDataSource1'
>>
>Any ideas what I should do to solve this?
>>
>Jeff
>>
>>
>>


If you want to access a control that is within another control you need to
use the following syntax:

ParentControl.FindControl("ChildControlID")

This will return a reference to the child control. You will also need to
cast it to the correct type.

In your case you would use something like the below C# code

SiteMapDataSource MySiteMapDataSource = (SiteMapDataSource)
lvSidebar.FindControl("SiteMapDataSource1");
MySiteMapDataSource.StartingNodeUrl = "Default.aspx";

"Jeff" wrote:

Quote:

Originally Posted by

hmm when I in the code start to type "SiteM" the SiteMapDataSource1 isn't
shown in the type-ahead list... this happens if I try to access the
SiteMapDataSource like this SiteMapDataSource1.StartingNodeUrl =
"Default.aspx"; or
lvSidebar.LoggedInTemplate.SiteMapDataSource.Start ingNodeUrl
>
Another thing is that my webpage has 2 SiteMapDataSource1 controls (yes they
have the same name, but they exist in their own LoginView, lvSidebar and
lvMenu).
>
Any more suggestions?
>
Jeff
>
>
>
"clickon" <clickon@.discussions.microsoft.comwrote in message
news:258E83E3-C3EC-4948-93FC-E30DC3F811FD@.microsoft.com...

Quote:

Originally Posted by

The LoggedInTemplate property of the LoginView control does not have a
property called SiteMapDataSource which is what is causing the error. If
you
want to prograamatically set the StratingNodeURL property of
SiteMapDataSource1 simply use the following code

SiteMapDataSource1.StartingNodeUrl = "Default.aspx";

The LoginView has nothing to do with it.

"Jeff" wrote:

Quote:

Originally Posted by

hey
>
asp.net 2.0
>
On my webpage have I placed a LoginView (named lvSidebar). On this
loginview's loggedInTemplate I placed a menu (mnuSidebar) and the
datasource
to the menu is SiteMapDataSource1.
>
My Problem is that I cannot access the SiteMapDataSource1 object from the
code:
lvSidebar.LoggedInTemplate.SiteMapDataSource.Start ingNodeUrl =
"Default.aspx";
don't compile:
System.Web.UI.ITemplate' does not contain a definition for
'SiteMapDataSource1'
>
Any ideas what I should do to solve this?
>
Jeff
>
>
>


>
>
>


thanks, it solved my problem

"clickon" <clickon@.discussions.microsoft.comwrote in message
news:97D21DB6-ED33-4E35-9702-0F9FB54C24ED@.microsoft.com...

Quote:

Originally Posted by

If you want to access a control that is within another control you need to
use the following syntax:
>
ParentControl.FindControl("ChildControlID")
>
This will return a reference to the child control. You will also need to
cast it to the correct type.
>
In your case you would use something like the below C# code
>
SiteMapDataSource MySiteMapDataSource = (SiteMapDataSource)
lvSidebar.FindControl("SiteMapDataSource1");
MySiteMapDataSource.StartingNodeUrl = "Default.aspx";
>
>
"Jeff" wrote:
>

Quote:

Originally Posted by

>hmm when I in the code start to type "SiteM" the SiteMapDataSource1 isn't
>shown in the type-ahead list... this happens if I try to access the
>SiteMapDataSource like this SiteMapDataSource1.StartingNodeUrl =
>"Default.aspx"; or
>lvSidebar.LoggedInTemplate.SiteMapDataSource.Start ingNodeUrl
>>
>Another thing is that my webpage has 2 SiteMapDataSource1 controls (yes
>they
>have the same name, but they exist in their own LoginView, lvSidebar and
>lvMenu).
>>
>Any more suggestions?
>>
>Jeff
>>
>>
>>
>"clickon" <clickon@.discussions.microsoft.comwrote in message
>news:258E83E3-C3EC-4948-93FC-E30DC3F811FD@.microsoft.com...

Quote:

Originally Posted by

The LoggedInTemplate property of the LoginView control does not have a
property called SiteMapDataSource which is what is causing the error.
If
you
want to prograamatically set the StratingNodeURL property of
SiteMapDataSource1 simply use the following code
>
SiteMapDataSource1.StartingNodeUrl = "Default.aspx";
>
The LoginView has nothing to do with it.
>
"Jeff" wrote:
>
>hey
>>
>asp.net 2.0
>>
>On my webpage have I placed a LoginView (named lvSidebar). On this
>loginview's loggedInTemplate I placed a menu (mnuSidebar) and the
>datasource
>to the menu is SiteMapDataSource1.
>>
>My Problem is that I cannot access the SiteMapDataSource1 object from
>the
>code:
>lvSidebar.LoggedInTemplate.SiteMapDataSource.Start ingNodeUrl =
>"Default.aspx";
>don't compile:
>System.Web.UI.ITemplate' does not contain a definition for
>'SiteMapDataSource1'
>>
>Any ideas what I should do to solve this?
>>
>Jeff
>>
>>
>>


>>
>>
>>

Saturday, March 24, 2012

newbie: this is a strange phenomenon

hey

asp.net 2.0

I've created a master page with 2 ContentPlaceHolders (named "sidebar" and
"content"):
<table style="z-index: 100; left: 12px; width: 100%; position: absolute;
top: 113px;">
<tr>
<td rowspan="3" style="width: 158px" valign="top">
<asp:ContentPlaceHolder ID="sidebar" runat="server">
</asp:ContentPlaceHolder>
</td>
<td style="width: 688px" bgcolor="#f7f6f3" valign="top" >
<asp:ContentPlaceHolder ID="content" runat="server">
</asp:ContentPlaceHolder>
</td>
<td style="width: 223px">
</td>
</tr>
</table>

Then I've created a webpage based on this master page...

Now I start to add a label control to the default.aspx webpage (based on the
master mention above). I select the Label control in the toolbox and drag it
over to the content (ContentPlaceHolder). I see that the border arround the
content control flashes a blue color telling that this control will be
dropped on this content place holder... But when I dropp this control on
this contentplaceholder (default.aspx) the control appear on the other
contentPlaceHolder (sidebar)

Any ideas what I'm doing wrong here?

JeffHi Jeff,

Is it because you're using absolute positioning in the master page and not
in the content page?

Ken
Microsoft MVP [ASP.NET]

"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:er%23%23Cz1pGHA.4408@.TK2MSFTNGP04.phx.gbl...

Quote:

Originally Posted by

hey
>
asp.net 2.0
>
I've created a master page with 2 ContentPlaceHolders (named "sidebar" and
"content"):
<table style="z-index: 100; left: 12px; width: 100%; position: absolute;
top: 113px;">
<tr>
<td rowspan="3" style="width: 158px" valign="top">
<asp:ContentPlaceHolder ID="sidebar" runat="server">
</asp:ContentPlaceHolder>
</td>
<td style="width: 688px" bgcolor="#f7f6f3" valign="top" >
<asp:ContentPlaceHolder ID="content" runat="server">
</asp:ContentPlaceHolder>
</td>
<td style="width: 223px">
</td>
</tr>
</table>
>
>
Then I've created a webpage based on this master page...
>
Now I start to add a label control to the default.aspx webpage (based on
the master mention above). I select the Label control in the toolbox and
drag it over to the content (ContentPlaceHolder). I see that the border
arround the content control flashes a blue color telling that this control
will be dropped on this content place holder... But when I dropp this
control on this contentplaceholder (default.aspx) the control appear on
the other contentPlaceHolder (sidebar)
>
Any ideas what I'm doing wrong here?
>
Jeff
>
>

Thursday, March 22, 2012

newboe: how to get the user name?

OS: XP pro
IDE VS 2005 .NET
ASP.NET 2.0
System.Security.AccessControl.SecurityInfos.Owner.ToString() returns
domain\username...if the domain is named "TEST" and username is "per" then
this statement returns TEST\per...
But what code must I do if I went to the fullname of the user?
JeffAsk the user to put it into a form. ;-)
Seriously, though, if the user is logged in to Active Directory, you should
be able to use the System.DirectoryServices namespace and classes to query
the Active Directory for this information.
HTH,
Kevin Spencer
Microsoft MVP
Professional Numbskull
Hard work is a medication for which
there is no placebo.
"Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
news:un2nKgZeGHA.564@.TK2MSFTNGP02.phx.gbl...
> OS: XP pro
> IDE VS 2005 .NET
> ASP.NET 2.0
> System.Security.AccessControl.SecurityInfos.Owner.ToString() returns
> domain\username...if the domain is named "TEST" and username is "per" then
> this statement returns TEST\per...
> But what code must I do if I went to the fullname of the user?
> Jeff
>
Thanks, I'm looking into it now:
System.DirectoryServices.DirectoryEntry de = new
System.DirectoryServices.DirectoryEntry();
string fullname = de.Properties["displayName"].Value.ToString();
This code isn't working because I need to set the de.Path property before
executing the last line.. I'm not sure how to get the domain name the user
is logged into...Any tips would be great...
I've tryed, with out luck using this statment:
string domain = de.Properties["defaultNamingContext"][0];
This statement gives me an error message saying "This domain do not exist"
(or something like that, the error message I get on my computer is in
Norwegian and I translated it into English... I'm a native Norwegian)
What am I doing wrong here?
Any tips would be received with great appreciation!
Jeff
"Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
news:uKn1CxZeGHA.5012@.TK2MSFTNGP05.phx.gbl...
> Ask the user to put it into a form. ;-)
> Seriously, though, if the user is logged in to Active Directory, you
> should be able to use the System.DirectoryServices namespace and classes
> to query the Active Directory for this information.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> Professional Numbskull
> Hard work is a medication for which
> there is no placebo.
> "Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
> news:un2nKgZeGHA.564@.TK2MSFTNGP02.phx.gbl...
>
Your app will only be able to get AD information about the domain it belongs
to.
HTH,
Kevin Spencer
Microsoft MVP
Professional Numbskull
Hard work is a medication for which
there is no placebo.
"Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
news:%23hChlzaeGHA.3888@.TK2MSFTNGP02.phx.gbl...
> Thanks, I'm looking into it now:
> System.DirectoryServices.DirectoryEntry de = new
> System.DirectoryServices.DirectoryEntry();
> string fullname = de.Properties["displayName"].Value.ToString();
> This code isn't working because I need to set the de.Path property before
> executing the last line.. I'm not sure how to get the domain name the user
> is logged into...Any tips would be great...
> I've tryed, with out luck using this statment:
> string domain = de.Properties["defaultNamingContext"][0];
> This statement gives me an error message saying "This domain do not exist"
> (or something like that, the error message I get on my computer is in
> Norwegian and I translated it into English... I'm a native Norwegian)
> What am I doing wrong here?
> Any tips would be received with great appreciation!
> Jeff
>
> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
> news:uKn1CxZeGHA.5012@.TK2MSFTNGP05.phx.gbl...
>

newboe: how to get the user name?

OS: XP pro
IDE VS 2005 .NET
ASP.NET 2.0

System.Security.AccessControl.SecurityInfos.Owner. ToString() returns
domain\username...if the domain is named "TEST" and username is "per" then
this statement returns TEST\per...

But what code must I do if I went to the fullname of the user?

JeffAsk the user to put it into a form. ;-)

Seriously, though, if the user is logged in to Active Directory, you should
be able to use the System.DirectoryServices namespace and classes to query
the Active Directory for this information.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.

"Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
news:un2nKgZeGHA.564@.TK2MSFTNGP02.phx.gbl...
> OS: XP pro
> IDE VS 2005 .NET
> ASP.NET 2.0
> System.Security.AccessControl.SecurityInfos.Owner. ToString() returns
> domain\username...if the domain is named "TEST" and username is "per" then
> this statement returns TEST\per...
> But what code must I do if I went to the fullname of the user?
> Jeff
Thanks, I'm looking into it now:

System.DirectoryServices.DirectoryEntry de = new
System.DirectoryServices.DirectoryEntry();
string fullname = de.Properties["displayName"].Value.ToString();

This code isn't working because I need to set the de.Path property before
executing the last line.. I'm not sure how to get the domain name the user
is logged into...Any tips would be great...

I've tryed, with out luck using this statment:
string domain = de.Properties["defaultNamingContext"][0];
This statement gives me an error message saying "This domain do not exist"
(or something like that, the error message I get on my computer is in
Norwegian and I translated it into English... I'm a native Norwegian)

What am I doing wrong here?

Any tips would be received with great appreciation!

Jeff

"Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
news:uKn1CxZeGHA.5012@.TK2MSFTNGP05.phx.gbl...
> Ask the user to put it into a form. ;-)
> Seriously, though, if the user is logged in to Active Directory, you
> should be able to use the System.DirectoryServices namespace and classes
> to query the Active Directory for this information.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> Professional Numbskull
> Hard work is a medication for which
> there is no placebo.
> "Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
> news:un2nKgZeGHA.564@.TK2MSFTNGP02.phx.gbl...
>> OS: XP pro
>> IDE VS 2005 .NET
>> ASP.NET 2.0
>>
>> System.Security.AccessControl.SecurityInfos.Owner. ToString() returns
>> domain\username...if the domain is named "TEST" and username is "per"
>> then this statement returns TEST\per...
>>
>> But what code must I do if I went to the fullname of the user?
>>
>> Jeff
>>
Your app will only be able to get AD information about the domain it belongs
to.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.

"Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
news:%23hChlzaeGHA.3888@.TK2MSFTNGP02.phx.gbl...
> Thanks, I'm looking into it now:
> System.DirectoryServices.DirectoryEntry de = new
> System.DirectoryServices.DirectoryEntry();
> string fullname = de.Properties["displayName"].Value.ToString();
> This code isn't working because I need to set the de.Path property before
> executing the last line.. I'm not sure how to get the domain name the user
> is logged into...Any tips would be great...
> I've tryed, with out luck using this statment:
> string domain = de.Properties["defaultNamingContext"][0];
> This statement gives me an error message saying "This domain do not exist"
> (or something like that, the error message I get on my computer is in
> Norwegian and I translated it into English... I'm a native Norwegian)
> What am I doing wrong here?
> Any tips would be received with great appreciation!
> Jeff
>
> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
> news:uKn1CxZeGHA.5012@.TK2MSFTNGP05.phx.gbl...
>> Ask the user to put it into a form. ;-)
>>
>> Seriously, though, if the user is logged in to Active Directory, you
>> should be able to use the System.DirectoryServices namespace and classes
>> to query the Active Directory for this information.
>>
>> --
>> HTH,
>>
>> Kevin Spencer
>> Microsoft MVP
>> Professional Numbskull
>>
>> Hard work is a medication for which
>> there is no placebo.
>>
>> "Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
>> news:un2nKgZeGHA.564@.TK2MSFTNGP02.phx.gbl...
>>> OS: XP pro
>>> IDE VS 2005 .NET
>>> ASP.NET 2.0
>>>
>>> System.Security.AccessControl.SecurityInfos.Owner. ToString() returns
>>> domain\username...if the domain is named "TEST" and username is "per"
>>> then this statement returns TEST\per...
>>>
>>> But what code must I do if I went to the fullname of the user?
>>>
>>> Jeff
>>>
>>
>>