Hello!
I have a question regarding programmatically created RadDock controls. I can't figure out how to wire them with server-side Command event. On creating RadDock custom controls are loaded and they do postback on click but they don't fire Command event. The problem is also that on postback custom control disappears so one more thing is how to avoid that behavior.
This is my code:
private RadDock CreateRadDock()
{
int docksCount = CurrentDockStates.Count;
int idTicket = Convert.ToInt32(rcbTicketi.SelectedValue);
Ticket ticket = db.Ticket.SingleOrDefault(t => t.idTicket == idTicket);
RadDock dock = new RadDock();
dock.DockMode = DockMode.Docked;
dock.UniqueName = Guid.NewGuid().ToString().Replace("-", "a");
dock.ID = string.Format("RadDock{0}", dock.UniqueName);
dock.Title = ticket.idNadredeniTicket + "-" + ticket.RedniBroj + " (" + ticket.Firma.Naziv + ")";
dock.Text = ticket.Opis;
dock.Width = Unit.Pixel(500);
dock.Command += new DockCommandEventHandler(RadDock_Command);
DockCommand close = new DockCommand();
close.AutoPostBack = true;
close.Text = "Zatvori incident";
close.Name = "Zatvori";
DockCloseCommand hide = new DockCloseCommand();
close.AutoPostBack = true;
close.Text = "Sakrij";
dock.Commands.Add(hide);
dock.Commands.Add(new DockExpandCollapseCommand());
dock.Commands.Add(close);
return dock;
}
protected void RadDock_Command(object sender, Telerik.Web.UI.DockCommandEventArgs e)
{
string naziv = e.Command.Name;
if (e.Command.Name == "Zatvori")
{
Response.Redirect("www.google.hr");
}
else if (e.Command.Name == "Close")
{
Response.Redirect(Request.RawUrl + "?id=1");
}
}
There is also one more thing that bothers me. How could I get the ID of the RadDock on fired event?
Regards,
Hrvoje
I have a question regarding programmatically created RadDock controls. I can't figure out how to wire them with server-side Command event. On creating RadDock custom controls are loaded and they do postback on click but they don't fire Command event. The problem is also that on postback custom control disappears so one more thing is how to avoid that behavior.
This is my code:
{
int docksCount = CurrentDockStates.Count;
int idTicket = Convert.ToInt32(rcbTicketi.SelectedValue);
Ticket ticket = db.Ticket.SingleOrDefault(t => t.idTicket == idTicket);
RadDock dock = new RadDock();
dock.DockMode = DockMode.Docked;
dock.UniqueName = Guid.NewGuid().ToString().Replace("-", "a");
dock.ID = string.Format("RadDock{0}", dock.UniqueName);
dock.Title = ticket.idNadredeniTicket + "-" + ticket.RedniBroj + " (" + ticket.Firma.Naziv + ")";
dock.Text = ticket.Opis;
dock.Width = Unit.Pixel(500);
dock.Command += new DockCommandEventHandler(RadDock_Command);
DockCommand close = new DockCommand();
close.AutoPostBack = true;
close.Text = "Zatvori incident";
close.Name = "Zatvori";
DockCloseCommand hide = new DockCloseCommand();
close.AutoPostBack = true;
close.Text = "Sakrij";
dock.Commands.Add(hide);
dock.Commands.Add(new DockExpandCollapseCommand());
dock.Commands.Add(close);
return dock;
}
protected void RadDock_Command(object sender, Telerik.Web.UI.DockCommandEventArgs e)
{
string naziv = e.Command.Name;
if (e.Command.Name == "Zatvori")
{
Response.Redirect("www.google.hr");
}
else if (e.Command.Name == "Close")
{
Response.Redirect(Request.RawUrl + "?id=1");
}
}
There is also one more thing that bothers me. How could I get the ID of the RadDock on fired event?
Regards,
Hrvoje