I'm creating various Rad Dock objects dynamically and i'm binding it to the Rad Zone based on the Zoneid (Custom defined value). Here i present the piece of code .. This is working fine .. binding the Rad Dock objects at the runtime .. but the problem is whenever i move the Rad dock to diffrent zone . it is posting back .. which is not the best way to implement it ..
Kindly assit me to get the functionality that i'm looking for .. (No postback when the Rad Dock object is moved to different Rad Zone)
Sample Code:
aspx page:
<radDk:RadDockingManager ID="RadDockingManager1" runat="server" />
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<table width="100%" style="height: 100%" cellpadding="0" cellspacing="0" id="trMinis">
<tr>
<telerik:RadDockLayout ID="RadDockLayout1" runat="server" OnLoadDockLayout="RadDockLayout1_LoadDockLayout"
OnSaveDockLayout="RadDockLayout1_SaveDockLayout">
<td valign="top" style="width: 33%">
<table width="100%">
<tr>
<td>
<telerik:RadDockZone ID="RadDockZone1" runat="server" BorderStyle="None" BorderWidth="0px">
</telerik:RadDockZone>
<radG:RadGrid ID="RadGrid1" runat="server">
</radG:RadGrid>
</td>
</tr>
</table>
</td>
<td valign="top" style="width: 33%">
<table width="100%">
<tr>
<td>
<telerik:RadDockZone ID="RadDockZone2" runat="server" BorderStyle="None" BorderWidth="0px">
</telerik:RadDockZone>
</td>
</tr>
</table>
</td>
<td valign="top" style="width: 33%">
<table width="100%">
<tr>
<td align="right" width="100%">
<telerik:RadDockZone ID="RadDockZone3" runat="server" BorderStyle="None" BorderWidth="0px">
</telerik:RadDockZone>
</td>
</tr>
</table>
</td>
</telerik:RadDockLayout>
</tr>
</table>
aspx.cs page
protected void Page_Load(object sender, EventArgs e)
{
try
{
int intClientid = 68;
}
catch (Exception objExp)
{
ErrorLog.WriteError(objExp, "View Minis", strLogin);
}
}
protected void Page_Init(object sender, EventArgs e)
{
obj_hm.ClientID = 68;// intClientid;
objds = obj_hm.Minis_Get(); // A Stored Procedure which will return a Table ...
Session["objtbl"] = objds.Tables["Minis"];
int zoneid = 1;
for (int st = 0; st < objds.Tables["Minis"].Rows.Count; st++)
{
string id, text, title;
id = objds.Tables["Minis"].Rows[st]["MiniID"].ToString();
title = objds.Tables["Minis"].Rows[st]["Heading"].ToString();
text = objds.Tables["Minis"].Rows[st]["MiniImage"].ToString();
RadDock dock = CreateRadDock(id, title, text);
if (zoneid == 1)
{
RadDockZone1.Controls.Add(dock);
zoneid = zoneid + 1;
}
else if (zoneid == 2)
{
RadDockZone2.Controls.Add(dock);
zoneid = zoneid + 1;
}
else if (zoneid == 3)
{
RadDockZone3.Controls.Add(dock);
zoneid = 1;
}
}
}
private RadDock CreateRadDock(string Number, string Title, string Text)
{
rg = new RadGrid();
rg.ID = Number;
rg.DataSource = (DataTable)Session["objtbl"];
//rg.Rebind();
RadDock radDock = new RadDock();
radDock.ID = Number;
radDock.Title = Title;
//radDock.Text = "<img src='.." + Text + "' alt=''/>";
radDock.ContentContainer.Controls.Add(rg);
radDock.AutoPostBack = true;
radDock.DockMode = DockMode.Docked;
return radDock;
}
protected void RadDockLayout1_SaveDockLayout(object sender, Telerik.Web.UI.DockLayoutEventArgs e)
{
JavaScriptSerializer serializer = new JavaScriptSerializer();
string serializedPositions = serializer.Serialize(e.Positions);
string serializedIndices = serializer.Serialize(e.Indices);
HttpCookie positionsCookie = new HttpCookie("DockLayout",
serializer.Serialize(new string[] { serializedPositions, serializedIndices }));
positionsCookie.Expires = DateTime.Now.AddDays(1);
if (Session["Login"] != null)
{
Response.Cookies.Add(positionsCookie);
}
else
{
positionsCookie = new HttpCookie("DockLayout", "");
Response.Cookies.Add(positionsCookie);
}
}
protected void RadDockLayout1_LoadDockLayout(object sender, Telerik.Web.UI.DockLayoutEventArgs e)
{
HttpCookie positionsCookie = Request.Cookies["DockLayout"];
if (!Object.Equals(positionsCookie, null))
{
string serializedPositionsAndIndices = positionsCookie.Value;
if (!string.IsNullOrEmpty(serializedPositionsAndIndices))
{
JavaScriptSerializer serializer = new JavaScriptSerializer();
string[] positionsAndIndices = serializer.Deserialize<string[]>(serializedPositionsAndIndices);
e.Positions = serializer.Deserialize<Dictionary<string, string>>(positionsAndIndices[0]);
e.Indices = serializer.Deserialize<Dictionary<string, int>>(positionsAndIndices[1]);
}
}
}
Here i have used a Rad Grid, which will be binded to the Rad Dock dynamically .. No need to use the same control .. U can give me some other sample .. but it should not post back when i move the Rad dock object across the Various Zones ..
Help me to fix this out ... Thanks in Advance
Regards,
Sam