P
Patrik Lindholm
Hi!
I'm fiddling around with CodeDom and codegenration.
I've looked at some samples which adds comments
and a methodcall but I want to do more.
I´ve created a control with a linkbuttoncollection where
you can add and remove linkbuttons as you like,
change properties in the collectioneditor for
each linkbutton. There is a custom property
which I've called "RedirectToPage" where
you can select a page to redirect to when you
click the linkbutton.
The control also have an event called "ItemClick"
which i want to add code for when I drop the control
onto a webform.
The code shoul look something like the code below except for the comments
// Code sample
// In InitializeComponent
MyMenuControl myMenuControl1
myMenuControl1.ItemClick += new
ItemClickHandler(this.myMenuControl_ItemClick);
// End InitializeComponent
// Eventhandler
private void myMenuControl_ItemClick(object sender, EventArgs e)
{
if("MyMenuControlItem" = = sender.GetType().ToString())
{
MyMenuControlItem mItem = (MyMenuControlItem)sender;
Response.Redirect(mItem.RedirectToPage);
}
}
Is it possible to do this.
Thank you in advance.
// Patrik
I'm fiddling around with CodeDom and codegenration.
I've looked at some samples which adds comments
and a methodcall but I want to do more.
I´ve created a control with a linkbuttoncollection where
you can add and remove linkbuttons as you like,
change properties in the collectioneditor for
each linkbutton. There is a custom property
which I've called "RedirectToPage" where
you can select a page to redirect to when you
click the linkbutton.
The control also have an event called "ItemClick"
which i want to add code for when I drop the control
onto a webform.
The code shoul look something like the code below except for the comments
// Code sample
// In InitializeComponent
MyMenuControl myMenuControl1
myMenuControl1.ItemClick += new
ItemClickHandler(this.myMenuControl_ItemClick);
// End InitializeComponent
// Eventhandler
private void myMenuControl_ItemClick(object sender, EventArgs e)
{
if("MyMenuControlItem" = = sender.GetType().ToString())
{
MyMenuControlItem mItem = (MyMenuControlItem)sender;
Response.Redirect(mItem.RedirectToPage);
}
}
Is it possible to do this.
Thank you in advance.
// Patrik