C1 Community
ComponentOne Community is a free source for developers and help authors to collaborate and communicate.

Menu items added in code do not fire itemClick event

rated by 0 users
This post has 0 Replies | 1 Follower

Top 200 Contributor
Posts 26
troygerton Posted: Sat, Jun 27 2009 11:01 AM

Hello,

This has got to be something simple that I am missing.

I can get items that I add in code to fire the menu itemClick event. 

Also, is there a way to get items added in code to persist their viewstate without reloading the list on every postback?

I really want to use this control, but I can't seem to get the basics to function as expected.

Any help would be most appreciated.  Thanks...Troy

Here is the simple code snippets I am testing with:

protected void Page_Load(object sender, EventArgs e)

{

if (!IsPostBack)

{

}

LoadInitialNodes();

}

private void LoadInitialNodes()

{

//this.mnuNodes.AutoPostBack = true;

for (int x = 1; x < 10; x++)

{

C1MenuItem c1item = new C1MenuItem("item " + x.ToString());

c1item.ID = "item" + x.ToString();

c1item.Value = "a string|with some stuffed|elementes";this.mnuNodes.Items.Add(c1item);

}

this.mnuNodes.ItemClick += new C1MenuEventHandler(mnuNodes_ItemClick);

}

protected void mnuNodes_ItemClick(object sender, C1MenuEventArgs e)

{

int test = 1;

}

<cc1:C1Menu ID="mnuNodes" runat="server" Height="200px" o

onitemclick="mnuNodes_ItemClick" Orientation="Vertical"

VisualStylePath="~/C1WebControls/VisualStyles" Width="160px">

<Items>

<cc1:C1MenuItem runat="server" Text="LinkItem1" Value="1">

</cc1:C1MenuItem>

<cc1:C1MenuItem runat="server" Text="LinkItem2" Value="2">

</cc1:C1MenuItem>

<cc1:C1MenuItem runat="server" Text="LinkItem3" Value="3">

</cc1:C1MenuItem>

</Items>

<ScrollSettings ScrollMode="ScrollBar" ScrollOrientation="Vertical">

</ScrollSettings>

</cc1:C1Menu>

Page 1 of 1 (1 items) | RSS
Contact ComponentOne: 1.800.858.2739 ©1987-2010 ComponentOne LLC All Rights Reserved.