Click here to Skip to main content
16,006,440 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Ajax.NET vs Atlas Pin
eggie531-May-07 19:03
eggie531-May-07 19:03 
QuestionSpreadsheet Control Pin
Revant Jain31-May-07 9:29
Revant Jain31-May-07 9:29 
AnswerRe: Spreadsheet Control Pin
Christian Graus31-May-07 10:26
protectorChristian Graus31-May-07 10:26 
GeneralRe: Spreadsheet Control Pin
Revant Jain31-May-07 10:33
Revant Jain31-May-07 10:33 
GeneralRe: Spreadsheet Control Pin
Christian Graus31-May-07 14:00
protectorChristian Graus31-May-07 14:00 
Questionincompatibility between IE6 and IE7 / Mozilla Firefox Pin
DKalepu31-May-07 6:28
DKalepu31-May-07 6:28 
AnswerRe: incompatibility between IE6 and IE7 / Mozilla Firefox Pin
DKalepu31-May-07 18:31
DKalepu31-May-07 18:31 
QuestionClientID's ???? Pin
steffw31-May-07 5:27
steffw31-May-07 5:27 
Hello!

I'm quite new to the ASP.NET world and I'm trying to build a menu with sub menu items, I know that their is a pre-build Menu control but I still want to create my own. I'm only facing the last problem. The clientID's?

I've this recursive function:
<code>
private Panel GetMenu(int ParentID)
{
stefw.Database.Page objPage = new stefw.Database.Page();

Panel pnlBox = new Panel();
DataTable dtItems = objPage.GetChildPages(ParentID);

foreach (DataRow drItem in dtItems.Rows)
{
string url = "Default.aspx?Page=" + drItem["PageID"].ToString();
string name = drItem["Name"].ToString();
string link = "<a href=\"" + url + "\">" + name + "</a>";
Panel pnlItem = new Panel();

pnlItem.ID = "Item" + drItem["PageID"].ToString();
pnlItem.Controls.Add(new LiteralControl(link));
pnlItem.CssClass = "Item";

if (drItem["HasChildren"].ToString() == "1")
{
Panel child = GetMenu(int.Parse(drItem["PageID"].ToString()));
pnlBox.Attributes.Add("onMouseOver", "document.getElementByID('" + child.ClientID + "').style.overflow='visible'");

pnlItem.Controls.Add(child);
}
pnlBox.Controls.Add(pnlItem);
}

if (ParentID == -1)
pnlBox.CssClass = "MainItem";
else
pnlBox.CssClass = "Box";

pnlBox.ID = "Box" + ParentID.ToString();

return pnlBox;
}

</code>

and it gives this output:
<code>

<div id="ctl00_ctl00_Box-1" class="MainItem" onMouseOver="document.getElementByID('Box1').style.overflow='visible'">
<div id="ctl00_ctl00_Item1" class="Item">
<a href="Default.aspx?Page=1">Home</a><div id="ctl00_ctl00_Box1" class="Box">
<div id="ctl00_ctl00_Item3" class="Item">
<a href="Default.aspx?Page=3">Informatie</a>

</div>
</div>
</div><div id="ctl00_ctl00_Item2" class="Item">
<a href="Default.aspx?Page=2">Beheer</a>
</div>
</div>
</div>

</div>
</code>

You can see that it goes wrong at this line:
[document.getElementByID('Box1').style.overflow='visible'"]
and here
[pnlBox.Attributes.Add("onMouseOver", "document.getElementByID('" + child.ClientID + "').style.overflow='visible'");]

What am I doing wrong? Frown | :( Can anyone give me some advice? Thanks in advance!!!!! Cool | :cool:

Stef
AnswerRe: ClientID's ???? Pin
eggsovereasy31-May-07 5:49
eggsovereasy31-May-07 5:49 
QuestionSend email to multiple users with matching ID's (Asp.Net2 C#) Pin
AdamskiR31-May-07 4:38
AdamskiR31-May-07 4:38 
AnswerRe: Send email to multiple users with matching ID's (Asp.Net2 C#) Pin
Not Active31-May-07 5:28
mentorNot Active31-May-07 5:28 
GeneralRe: Send email to multiple users with matching ID's (Asp.Net2 C#) Pin
AdamskiR31-May-07 22:06
AdamskiR31-May-07 22:06 
Questioncalendar control in frames. Pin
Rajiya31-May-07 4:36
Rajiya31-May-07 4:36 
AnswerRe: calendar control in frames. Pin
Not Active31-May-07 5:35
mentorNot Active31-May-07 5:35 
GeneralRe: calendar control in frames. Pin
Rajiya31-May-07 5:54
Rajiya31-May-07 5:54 
GeneralRe: calendar control in frames. Pin
Not Active31-May-07 6:53
mentorNot Active31-May-07 6:53 
QuestionCreating Virtual Dir through C# - Security Exception Pin
Blumen31-May-07 4:24
Blumen31-May-07 4:24 
QuestionDealing with command in GridView [asp.net 2.0] Pin
Amr M. K.31-May-07 4:08
Amr M. K.31-May-07 4:08 
AnswerRe: Dealing with command in GridView [asp.net 2.0] Pin
kubben31-May-07 5:04
kubben31-May-07 5:04 
QuestionIntellisense breaks on Enum in App_Code Pin
gantww31-May-07 3:48
gantww31-May-07 3:48 
AnswerRe: Intellisense breaks on Enum in App_Code Pin
Joseph Guadagno31-May-07 10:29
Joseph Guadagno31-May-07 10:29 
GeneralRe: Intellisense breaks on Enum in App_Code Pin
gantww31-May-07 10:40
gantww31-May-07 10:40 
Questiontravese in tree Pin
kvijayajyothy31-May-07 3:11
kvijayajyothy31-May-07 3:11 
AnswerRe: travese in tree Pin
Sathesh Sakthivel31-May-07 3:30
Sathesh Sakthivel31-May-07 3:30 
AnswerRe: travese in tree Pin
scottgp31-May-07 4:59
professionalscottgp31-May-07 4:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.