Hello,
I've search high and low for help on what I am trying to do, which seems pretty simple.
Basically, I want to create a number of RadDocks depending upon how many rows I have in a table which holds photos and data associated with them. I am trying to add a few buttons to the RadDock that will do stuff, like delete a photo.
Here is what I have so far:
How do I wire up a simple Button inside the RadDock to an Event Handler?
I've search high and low for help on what I am trying to do, which seems pretty simple.
Basically, I want to create a number of RadDocks depending upon how many rows I have in a table which holds photos and data associated with them. I am trying to add a few buttons to the RadDock that will do stuff, like delete a photo.
Here is what I have so far:
DataTable dtPhotos = GetAllByGalleryID(ID);
if
(dtPhotos.Rows.Count > 0)
{
foreach
(DataRow dr
in
dtPhotos.Rows)
{
RadDock dock =
new
RadDock();
dock.ID =
"rd"
+ dr[
"ID"
].ToString();
dock.Title =
"<div style=\"position:relative; top:7px; height:70px;\"><img class=\"galleryPhoto\" src=\"/properties/images/"
+ dr[
"ImgName"
].ToString() +
"\" /></div>"
;
dock.EnableDrag =
true
;
dock.DockMode = DockMode.Docked;
dock.UniqueName = Guid.NewGuid().ToString();
dock.EnableEmbeddedSkins =
false
;
dock.Width = Unit.Pixel(100);
dock.Height = Unit.Pixel(75);
dock.DefaultCommands = Telerik.Web.UI.Dock.DefaultCommands.Close;
dock.ContentContainer.CssClass =
"photoButtons"
;
Button delete =
new
Button();
delete.Text =
"Delete"
;
delete.CssClass =
"deleteButton"
;
delete.Command +=
new
DockCommandEventHandler(DeletePhoto);
delete.CommandArgument = dr[
"ID"
].ToString();
delete.CommandName =
"DeletePhoto"
;
delete.OnClientClick =
"return confirm('Are you sure you want to delete this photo?')"
;
dock.ContentContainer.Controls.Add(delete);
RadDockLayout1.Controls.Add(dock);
dock.Dock(rdz1);
}
}
How do I wire up a simple Button inside the RadDock to an Event Handler?