I have created two web parts for moss 2007 in asp.net c#.In First web part ,I am using Telerik Rad Rotator inside user control and loading it through RadAjaxPanel Dynamically.I am using Telerik 2009.3.1208.20 version of dlls.I have created some link button dynamically below in rotator.When i click on those link button , SetInaitialItemIndex event will call and this event will set related index image in rad rotator.I am binding rad rotator with sharepoint picture library.
In second web part I have created Menu web part.I am using Telerik Menu control in user control in web part.I am binding this web part with sharepoint custom list.My Problem is when i added this menu web part in master page(default.master), My Rotator web part is working slow , when i click on link button of rotator it is taking 20 seconds of time for setting initial item index and set related images.When i romove menu web part from default.master , Rotator web part's link button is showing fast behaviour as expected.
One more thing, in default.master i need to add script manager tag manually for manu web part, even i added script manager programatically in menu web part. Why menu web part is affecting the performance of rotator web part?? I have attached one screen shot of my web part page , it will give you clear idea.
Thanks in advance.
Menu web part code
-------------------------------
user control.(UC_MasterMenu.ascx) code
<%
@ Control Language="C#" AutoEventWireup="true" CodeBehind="UC_MasterMenu.ascx.cs" Inherits="OptimusBT.Framework.MasterMenu.UC_MasterMenu" %>
<%
@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%
@ Register Assembly="Telerik.Web.UI, Version=2009.3.1208.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<
style type="text/css">
.RadMenu_Custom
{
font-family :Arial, Helvetica, sans-serif;
font-size:12px;
line-height:28px;
background-color : #e2e1dd !important;
padding-left:11px;
border-bottom-width:9px;
border-bottom-style: solid;
border-bottom-color : #08296e !important;
font-weight:bold;
z-index: 10 !important;
}
.RadMenu_Custom
.rmRootGroup .rmLink
{
color : black !important;
}
.RadMenu_Custom
.rmRootGroup .rmLink:hover,
.RadMenu_Custom
.rmRootGroup .rmExpanded
{
background-image: url('/_LAYOUTS/1033/IMAGES/Smithsonian Images/TopMenu/main_nav_bg_current.gif');
background-repeat: repeat-x;
background-position:left bottom;
color : white !important;
border:0px;
cursor: hand;
}
.RadMenu_Custom
.rmGroup .rmLink
{
color
: white !important;
}
.RadMenu_Custom
.rmGroup
{
font-family:Arial, Helvetica, sans-serif;
color: #FFFFFF !important;
text-decoration: none;
font-size:12px;
font-weight: bold;
padding-left:10px;
background-image:url('/_LAYOUTS/1033/IMAGES/Smithsonian Images/TopMenu/submenu_bg.jpg');
background-position:left top;
background-repeat:repeat-x;
background-color:#037ABC;
}
.RadMenu_Custom
.rmGroup .rmExpandRight,
.RadMenu_Custom
.rmGroup .rmExpandDown,
.RadMenu_Custom
.rmGroup .rmItem .rmDisabled .rmExpandRight,
.RadMenu_Custom
.rmGroup .rmItem .rmDisabled .rmExpandDown,
.RadMenu_Custom
.rmGroup .rmItem .rmDisabled:hover .rmExpandRight,
.RadMenu_Custom
.rmGroup .rmItem .rmDisabled:hover .rmExpandDown
{
background-image: url('/_LAYOUTS/1033/IMAGES/Smithsonian Images/TopMenu/arrow_white.gif');
background-position:center right;
background-repeat:no-repeat;
color : white !important;
}
.RadMenu_Custom
.rmGroup .rmLink:hover .rmExpandRight,
.RadMenu_Custom
.rmGroup .rmFocused .rmExpandRight,
.RadMenu_Custom
.rmGroup .rmExpanded .rmExpandRight,
.RadMenu_Custom
.rmGroup .rmLink:hover .rmExpandDown,
.RadMenu_Custom
.rmGroup .rmFocused .rmExpandDown,
.RadMenu_Custom
.rmGroup .rmExpanded .rmExpandDown
{
background-image: url('/_LAYOUTS/1033/IMAGES/Smithsonian Images/TopMenu/arrow_blk.gif');
background-position: center right;
background-repeat:no-repeat;
color : black !important;
}
.RadMenu_Custom
.rmHorizontal .rmItem
{
border-right: 1px solid #08296e;
}
.RadMenu_Custom
.rmVertical .rmItem
{
border-left: 1px solid #08296e;
}
.RadMenu_Custom
.rmGroup .rmRightArrow
{
color : #043473 !important;
}
.RadMenu_Custom
.rmGroup .rmLink:hover,
.RadMenu_Custom
.rmGroup .rmFocused,
.RadMenu_Custom
.rmGroup .rmExpanded
{
border-right: 1px solid #f6eaae;
background-color:#f6eaae;
background-image:none;
border-right-width:0px;
color : #043473 !important;
cursor: hand;
}
.RadMenu_Custom
.rmHorizontal .rmSeparator
{
height: 20px;
width: 1px;
line-height: 20px;
background-color : #aad199;
border: 0;
}
.RadMenu_Custom
.rmVertical .rmSeparator
{
height: 1px;
margin: 2px 0;
border: 0;
background-color: #aad199;
line-height: 1px;
}
</
style>
<
asp:Label ID="lblmsg" runat="server" Visible="false" ></asp:Label>
<
table width="981" border="0" align="center" cellpadding="0" cellspacing="0">
<
tr><td>
<telerik:RadMenu EnableEmbeddedSkins="false"
style="width:981px;" ID="RadMenu1"
runat="server" OnItemDataBound="RadMenu1_ItemDataBound" ExpandDelay="0" ExpandAnimation-Duration="1" CollapseAnimation-Duration="1" CollapseDelay="0">
</telerik:RadMenu>
</
td></tr></table>
menu code behind of user control.(UC_MasterMenu.ascx.cs)
-----------------------------------------------------------------------
using
System;
using
System.Data;
using
System.Configuration;
using
System.Collections;
using
System.Web;
using
System.Web.Security;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
System.Web.UI.HtmlControls;
using
Microsoft.SharePoint;
using
System.Collections.Generic;
using
Microsoft.SharePoint.WebControls;
using
Microsoft.SharePoint.WebPartPages;
using
Microsoft.SharePoint.Utilities;
using
Microsoft.SharePoint.Administration;
using
Telerik.Web.UI;
using
System.Web.Services.Description;
using
System.ComponentModel;
namespace
OptimusBT.Framework.MasterMenu
{
public partial class UC_MasterMenu : System.Web.UI.UserControl
{
string url;
protected void Page_Load(object sender, EventArgs e)
{
try
{
RadMenu1.ClickToOpen =
false;
RadMenu1.EnableEmbeddedSkins =
false;
RadMenu1.Flow = (
ItemFlow)Enum.Parse(typeof(ItemFlow), "Horizontal", true);
RadMenu1.DataSource = CreateTestTable1();
RadMenu1.DataFieldID =
"ID";
RadMenu1.DataFieldParentID =
"ParentID";
RadMenu1.DataTextField =
"Title";
RadMenu1.DataValueField =
"ID";
RadMenu1.DataNavigateUrlField =
"URL";
RadMenu1.DataBind();
RadMenu1.CssClass =
"RadMenu_Custom";
}
catch (Exception Ex)
{
// HttpContext.Current.Response.Write("Page Load : " + Ex.Message);
}
}
public DataTable CreateTestTable1()
{
DataTable dt = new DataTable();
DataRow dr;
string parentid;
DataColumn dc = new DataColumn();
dc.ColumnName =
"ID";
dt.Columns.Add(dc);
dc =
new DataColumn();
dc.ColumnName =
"ParentID";
dt.Columns.Add(dc);
dc =
new DataColumn();
dc.ColumnName =
"Title";
dt.Columns.Add(dc);
dc =
new DataColumn();
dc.ColumnName =
"URL";
dt.Columns.Add(dc);
dc =
new DataColumn();
dc.ColumnName =
"Tooltip";
dt.Columns.Add(dc);
dc =
new DataColumn();
dc.ColumnName =
"Display Order";
dt.Columns.Add(dc);
dc =
new DataColumn();
dc.ColumnName =
"Open link in new window";
dt.Columns.Add(dc);
int cnt;
try
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPList oList;
string connectionInfo = System.Configuration.ConfigurationManager.AppSettings["SetWebAppIndex"];
using (SPSite oSite = new SPSite(connectionInfo))
{
////int WebAppIndex = int.Parse(connectionInfo);
//SPWebApplication webApplication = oSite.WebApplication;
//SPSite oRootSite = webApplication.Sites[connectionInfo];
using (SPWeb oWeb = oSite.OpenWeb())
{
oWeb.AllowUnsafeUpdates =
true;
oList = oWeb.Lists[
"Smithsonian Navigation"];
SPQuery oQuery = new SPQuery();
oQuery.Query =
"<OrderBy><FieldRef Name='ID'/></OrderBy>";
SPListItemCollection oItems = oList.GetItems(oQuery);
cnt = oItems.Count;
foreach (SPListItem oItem in oItems)
{
dr = dt.NewRow();
dr[
"ID"] = Convert.ToString(oItem["ID"]);
parentid =
Convert.ToString(oItem["ParentID"]);
if (parentid == "0")
{
dr[
"ParentID"] = null;
}
else
{
dr[
"ParentID"] = Convert.ToString(oItem["ParentID"]);
}
dr[
"Title"] = Convert.ToString(oItem["Title"]);
dr[
"URL"] = Convert.ToString(oItem["URL"]);
dr[
"Tooltip"] = Convert.ToString(oItem["Tooltip"]);
dr[
"Display Order"] = Convert.ToString(oItem["Display Order"]);
dr[
"Open link in new window"] = Convert.ToString(oItem["Open link in new window"]);
dt.Rows.Add(dr);
}
}
}
});
}
catch (Exception Ex)
{
//HttpContext.Current.Response.Write("Navigation Data List : " + Ex.Message);
}
dt.DefaultView.Sort =
"Display Order ASC";
return dt;
}
protected void RadMenu1_ItemDataBound(object sender, RadMenuEventArgs e)
{
try
{
string connectionInfo = System.Configuration.ConfigurationManager.AppSettings["SetWebAppIndex"];
e.Item.Style.Add(
"text-decoration", "none");
SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPList oList;
using (SPSite oSite = new SPSite(connectionInfo))
{
url =
SPContext.Current.Site.Url;
string[] sitelist = url.Split(new Char[] { '/' });
//int WebAppIndex = int.Parse(connectionInfo);
// SPWebApplication webApplication = oSite.WebApplication;
// SPSite oRootSite = webApplication.Sites[connectionInfo];
using (SPWeb oWeb = oSite.OpenWeb())
{
oWeb.AllowUnsafeUpdates =
true;
oList = oWeb.Lists[
"Smithsonian Navigation"];
SPQuery oQuery = new SPQuery();
oQuery.Query =
"<OrderBy><FieldRef Name='ID'/></OrderBy>";
SPListItemCollection oItems = oList.GetItems(oQuery);
for (int i = 0; i < sitelist.Length; i++)
{
foreach (SPListItem oItem in oItems)
{
for (int k = 0; k < sitelist.Length; k++)
{
if (Convert.ToString(oItem["Open link in new window"]).Trim() == "Yes")
{
if (e.Item.Text == Convert.ToString(oItem["Title"]))
{
e.Item.Target =
"_blank";
}
}
if (Convert.ToString(oItem["SiteCollection"]).ToLower() == sitelist[i].ToString().ToLower())
{
if (e.Item.Text == Convert.ToString(oItem["Title"]))
{
if (e.Item.Level == 0)
{
e.Item.Style.Add(
"background-image", "url('/_LAYOUTS/1033/IMAGES/Smithsonian Images/TopMenu/main_nav_bg_current.gif')");
e.Item.Style.Add(
"background-repeat", "repeat-x");
e.Item.Style.Add(
"color", "white !important");
e.Item.Style.Add(
"background-position", "left bottom");
e.Item.Style.Add(
"border", "0px");
}
}
}
//else
//{
// if (url.ToLower() == webApplication.Sites[WebAppIndex].Url.ToLower())
// {
// if (Convert.ToString(e.Item.Value) == "1")
// {
// e.Item.Style.Add("background-image", "url('/_LAYOUTS/1033/IMAGES/Smithsonian Images/TopMenu/main_nav_bg_current.gif')");
// e.Item.Style.Add("background-repeat", "repeat-x");
// e.Item.Style.Add("color", "white !important");
// e.Item.Style.Add("background-position", "left bottom");
// e.Item.Style.Add("border", "0px");
// }
// }
//}
}
}
}
}
}
});
}
catch (Exception Ex)
{
//HttpContext.Current.Response.Write("Item Data Bound : " + Ex.Message);
}
}
}
}
Menu Main class file.(MasterMenu.cs) code
-----------------------------------------------------------------
using
System;
using
System.Data;
using
System.Configuration;
using
System.Web;
using
System.Web.Security;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
System.Web.UI.HtmlControls;
using
Microsoft.SharePoint.WebPartPages;
using
Telerik.Web.UI;
namespace
OptimusBT.Framework.MasterMenu
{
public class MasterMenu : Microsoft.SharePoint.WebPartPages.WebPart
{
protected override void CreateChildControls()
{
try
{
UC_MasterMenu ucMenu = (UC_MasterMenu)this.Page.LoadControl(@"~/_CONTROLTEMPLATES/Smithsonian Controls/UC_MasterMenu.ascx");
ucMenu.ID =
"ucMenu";
this.Controls.Add(ucMenu);
}
catch (Exception oEx)
{
HttpContext.Current.Response.Write("Create child control: " + oEx.Message);
}
}
protected override void OnInit(EventArgs e)
{
try
{
base.OnInit(e);
ScriptManager.RegisterStartupScript(this, typeof(MasterMenu), "UpdatePanelFixup", "_spOriginalFormAction = document.forms[0].action; _spSuppressFormOnSubmitWrapper=true;", true);
ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page);
if (scriptManager == null)
{
scriptManager =
new RadScriptManager();
this.Page.Form.Controls.AddAt(0, scriptManager);
}
}
catch (Exception oEx)
{
HttpContext.Current.Response.Write("Script Manager: " + oEx.Message);
}
}
}
}
========================================================================================================
Rad Rotator web part code
---------------------------------------
Rotator user control code (UC_Rotator.ascx)
------------------------------------------------------
<%
@ Control Language="C#" AutoEventWireup="true" Codebehind="UC_Rotator.ascx.cs"
Inherits="OptimusBT.Rotator.UC_Rotator" %>
<%
@ Register Assembly="Telerik.Web.UI, Version=2009.3.1208.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<
link href="/_LAYOUTS/1033/STYLES/Smithsonian CSS/Feature Content CSS/banner_style.css"
type="text/css" rel="stylesheet" />
<
asp:Label ID="lblmsg" runat="server" ForeColor="black" Font-Bold="true"></asp:Label>
<
asp:Panel runat="server" ID="demo">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td align="left" valign="top" scope="col">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top" scope="col" class="prismbannerTopleft">
</td>
<td align="left" valign="top" scope="col" class="prism_bannerTopMiddle">
</td>
<td align="left" valign="top" scope="col" class="prismbannerTopRight">
</td>
</tr>
<tr>
<td align="left" valign="top" scope="col" class="prism_bannerMiddleleft">
</td>
<td align="left" valign="top" scope="col">
<telerik:RadRotator ID="rrMonths" runat="server" OnItemDataBound="rrMonths_ItemDataBound">
<ItemTemplate>
<table>
<tr>
<asp:Panel runat="server" id="pnlleft">
<td valign="top" >
<asp:Label ID="lblleft" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"LeftText")%>'></asp:Label>
</td>
<td style="width:11px"></td>
</asp:Panel>
<td valign ="top" align="right">
<asp:Image AlternateText="IMAGE" ID="Image1" runat="server" ImageUrl='<%#DataBinder.Eval(Container.DataItem,"Image1")%>' Height="195" Width ="300"/>
<asp:Image AlternateText="IMAGE" ID="Image2" runat="server" ImageUrl='<%#DataBinder.Eval(Container.DataItem,"Image2")%>' Height="175" Width ="140"/>
<asp:Image AlternateText="IMAGE" ID="Image3" runat="server" ImageUrl='<%#DataBinder.Eval(Container.DataItem,"Image3")%>' Height="146" Width ="127" />
</td>
<asp:Panel runat="server" id="pnl">
<td style="width:11px"></td>
<td valign="top" >
<asp:Label ID="lblright" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"RightText")%>'></asp:Label>
</td>
</asp:Panel>
</tr>
</table>
</ItemTemplate>
</telerik:RadRotator>
</td>
<td align="left" valign="top" scope="col" class="prism_bannerMiddleRight">
</td>
</tr>
<tr>
<td align="left" valign="top" scope="col" class="prism_bannerBottomleft">
</td>
<td align="left" valign="middle" scope="col" class="prismbannerBottomtext">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="72%" height="30" align="right" valign="middle" scope="col">
<asp:Panel runat="server" ID="PanelNumber" Width="200" HorizontalAlign="Right">
</asp:Panel>
</td>
</tr>
</table>
</td>
<td align="left" valign="top" scope="col" class="prism_bannerBottomRight">
</td>
</tr>
</table>
</td>
</tr>
</table>
</
asp:Panel>
Rotator user control code behind (UC_Rotator.ascx.cs)
-----------------------------------------------------------------------------------------
using
System;
using
System.Data;
using
System.Configuration;
using
System.Collections;
using
System.Web;
using
System.Web.Security;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
System.Web.UI.HtmlControls;
using
Telerik.Web.UI;
using
System.Threading;
using
System.IO;
using
System.Reflection;
using
System.Text;
using
System.Collections.Generic;
using
Microsoft.SharePoint;
using
Microsoft.SharePoint.WebControls;
using
Microsoft.SharePoint.WebPartPages;
using
Microsoft.SharePoint.Utilities;
using
Microsoft.SharePoint.Administration;
namespace
OptimusBT.Rotator
{
/// <summary>
/// **** Created By Divya ******
/// ***** Language used asp.net 2.0, C# *********
/// ***** Feature Content Module for Prism Site *******
/// *****Used sharepoint Picture Library for Publishing content on webpart ********
/// ***** This solution used Rad Rotator Control,asp.net control,Ajax Control ********
/// </summary>
public partial class UC_Rotator : System.Web.UI.UserControl
{
#region
properties
//Set n Get properties to provide data geather from Tool Part.
string ListName;
private string _Home;
public string Home
{
get
{
return _Home;
}
set
{
_Home =
value;
}
}
private string _Rheight;
public string Rheight
{
get
{
return _Rheight;
}
set
{
_Rheight =
value;
}
}
private string _Rwidth;
public string Rwidth
{
get
{
return _Rwidth;
}
set
{
_Rwidth =
value;
}
}
private string _Itemheight;
public string Itemheight
{
get
{
return _Itemheight;
}
set
{
_Itemheight =
value;
}
}
private string _Itemwidth;
public string Itemwidth
{
get
{
return _Itemwidth;
}
set
{
_Itemwidth =
value;
}
}
private string _FrameSize;
public string FrameSize
{
get
{
return _FrameSize;
}
set
{
_FrameSize =
value;
}
}
private string _Duration;
public string Duration
{
get
{
return _Duration;
}
set
{
_Duration =
value;
}
}
/// <summary>
///Some Variable Declaration
/// </summary>
string finalPic = "";
string AdminId = "";
string Txt = "";
string dir = "";
int cnt = 0;
string id;
ArrayList AdminData = new ArrayList();
int TotalItemCount = 0;
LinkButton lnk;
#endregion
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (FrameSize == null)
{
lblmsg.Text =
"Configure Tool Part Properties";
demo.Visible =
false;
}
else
{
demo.Visible =
true;
if (Home == "True")
{
rrMonths.RotatorType = Telerik.Web.UI.
RotatorType.AutomaticAdvance;
}
else
{
rrMonths.RotatorType = Telerik.Web.UI.
RotatorType.FromCode;
}
ListName =
"Feature Content Media Gallary";// Picture Library contains images and text.
rrMonths.DataSource = GetPicDataTable();
rrMonths.DataBind();
DynamicCreateLinkButton();
// calling method to create link button dynamically on web part.
if (FrameSize != null)
{
if (FrameSize == "Large")// setting frame size of rotator
{
demo.Width = 652;
rrMonths.Width = 652 - 41;
rrMonths.ItemWidth = 652 - 41;
rrMonths.Height = 220;
rrMonths.ItemHeight = 220;
}
else if (FrameSize == "Medium")
{
demo.Width = 376;
rrMonths.Width = 376 - 41;
rrMonths.ItemWidth = 376 - 41;
rrMonths.Height = 200;
rrMonths.ItemHeight = 200;
}
else if (FrameSize == "Small")
{
demo.Width = 300;
rrMonths.Width = 300 - 41;
rrMonths.Height = 175;
rrMonths.ItemWidth = 300 - 41;
rrMonths.ItemHeight = 175;
}
}
if (Duration != "-- Select --")
{
rrMonths.ScrollDuration =
int.Parse(Duration);
}
else
{
rrMonths.ScrollDuration = 500;
}
}
}
catch (Exception oEx)
{
// HttpContext.Current.Response.Write("Page Load :" + oEx.Message);
}
}
/// <summary>
/// This Method for setting initial index of Rad Rotator.
/// </summary>
protected void SetInaitialItemIndex(object sender, EventArgs e)
{
try
{
LinkButton senderControl = sender as LinkButton;
string indexAsString = senderControl.Text; // Get the value - it should be a number;
int initialIndex = int.Parse(senderControl.Text);// Parse to int
initialIndex = initialIndex - 1;
rrMonths.InitialItemIndex = initialIndex;
// Assign the new value ;
if (initialIndex > 4)
{
SetNode(indexAsString);
}
else
{
SetInNode(indexAsString);
}
}
catch (Exception oEx)
{
// HttpContext.Current.Response.Write("Set Inaitial Item Index :" + oEx.Message);
}
}
/// <summary>
/// This methos to create Link buttons and image button dynamically on webpart.
/// </summary>
///
public void DynamicCreateLinkButton()
{
try
{
ImageButton imgleft = new ImageButton();
imgleft.ImageUrl =
"/_LAYOUTS/1033/IMAGES/Smithsonian Images/Feature Content/prism_left_arrow.jpg";
imgleft.ImageAlign = System.Web.UI.WebControls.
ImageAlign.Middle;
imgleft.Click +=
new System.Web.UI.ImageClickEventHandler(SetInVisible);
PanelNumber.Controls.Add(imgleft);
imgleft.Visible =
false;
Label lbldemo = new Label();
lbldemo.Text =
" ";
PanelNumber.Controls.Add(lbldemo);
for (int i = 1; i <= TotalItemCount; i++)
{
lnk =
new LinkButton();
lnk.ID =
"LinkButton" + i.ToString();
lnk.Text = i.ToString();
lnk.BorderWidth = 1;
lnk.Style.Add(
"text-decoration", "none");
lnk.ForeColor = System.Drawing.
Color.White;
lnk.Style.Add(
"margin-right", "3");
lnk.Style.Add(
"margin-left", "3");
lnk.CssClass =
"prismimagelink";
lnk.Click +=
new EventHandler(SetInaitialItemIndex);
PanelNumber.Controls.Add(lnk);
if (i > 5)
{
lnk.Visible =
false;
}
if (i > 10)
{
lnk.Visible =
false;
}
}
Label lbldemo1 = new Label();
lbldemo1.Text =
" ";
PanelNumber.Controls.Add(lbldemo1);
// ********* new code ****************************************************
for (int i = 1; i <= 5; i++)
{
if (i == 1)
{
LinkButton LnkFirst = new LinkButton();
LnkFirst = (
LinkButton)PanelNumber.FindControl("LinkButton" + Convert.ToString(i));
LnkFirst.CssClass =
"prismimagelinkSelected";
}
else
{
LinkButton LnkBtn = new LinkButton();
LnkBtn = (
LinkButton)PanelNumber.FindControl("LinkButton" + Convert.ToString(i));
LnkBtn.CssClass =
"prismimagelink";
}
}
// ********* new code ****************************************************
ImageButton imgright = new ImageButton();
imgright.ImageUrl =
"/_LAYOUTS/1033/IMAGES/Smithsonian Images/Feature Content/prism_right_arrow.jpg";
imgright.Style.Add(
"vertical-align", "left");
imgright.ImageAlign = System.Web.UI.WebControls.
ImageAlign.Middle;
PanelNumber.Controls.Add(imgright);
imgright.Visible =
false;
imgright.Click +=
new System.Web.UI.ImageClickEventHandler(SetVisible);
}
catch (Exception oEx)
{
// HttpContext.Current.Response.Write("Dynamic Create Link Button :" + oEx.Message);
}
}
/// <summary>
/// SetVisible,SetInVisible,SetNode,SetInNode
/// all four methods used to make link button visible n invisible dynamically.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
///
protected void SetVisible(object sender, EventArgs e)
{
try
{
if (TotalItemCount >= 5)
{
if (TotalItemCount < 10)
{
int i = 6;
while (i <= TotalItemCount)
{
PanelNumber.FindControl(
"LinkButton" + i.ToString()).Visible = true;
i++;
for (int j = 1; j <= 5; j++)
{
PanelNumber.FindControl(
"LinkButton" + j.ToString()).Visible = false;
}
}
}
else if (TotalItemCount >= 10)
{
int i = 6;
while (i <= 10)
{
PanelNumber.FindControl(
"LinkButton" + i.ToString()).Visible = true;
i++;
for (int j = 1; j <= 5; j++)
{
PanelNumber.FindControl(
"LinkButton" + j.ToString()).Visible = false;
}
}
}
}
}
catch (Exception oEx)
{
//HttpContext.Current.Response.Write("Set Visible :" + oEx.Message);
}
}
protected void SetInVisible(object sender, EventArgs e)
{
try
{
if (TotalItemCount >= 5)
{
if (TotalItemCount < 10)
{
for (int i = 6; i <= TotalItemCount; i++)
{
PanelNumber.FindControl(
"LinkButton" + i.ToString()).Visible = false;
}
for (int j = 1; j <= 5; j++)
{
PanelNumber.FindControl(
"LinkButton" + j.ToString()).Visible = true;
}
}
else if (TotalItemCount >= 10)
{
for (int i = 6; i <= 10; i++)
{
PanelNumber.FindControl(
"LinkButton" + i.ToString()).Visible = false;
}
for (int j = 1; j <= 5; j++)
{
PanelNumber.FindControl(
"LinkButton" + j.ToString()).Visible = true;
}
}
}
}
catch (Exception oEx)
{
//HttpContext.Current.Response.Write("Set In Visible:" + oEx.Message);
}
}
private void SetNode(string Lnktext)
{
try
{
if (TotalItemCount >= 5)
{
if (TotalItemCount < 10)
{
int i = 6;
while (i <= TotalItemCount)
{
PanelNumber.FindControl(
"LinkButton" + i.ToString()).Visible = true;
lnk = (
LinkButton)PanelNumber.FindControl("LinkButton" + i.ToString());
if (Lnktext == lnk.Text)
lnk.CssClass =
"prismimagelinkSelected";
else
lnk.CssClass =
"prismimagelink";
for (int j = 1; j <= 5; j++)
{
PanelNumber.FindControl(
"LinkButton" + j.ToString()).Visible = false;
}
i++;
}
}
else if (TotalItemCount >= 10)
{
int i = 6;
while (i <= 10)
{
PanelNumber.FindControl(
"LinkButton" + i.ToString()).Visible = true;
lnk = (
LinkButton)PanelNumber.FindControl("LinkButton" + i.ToString());
if (Lnktext == lnk.Text)
lnk.CssClass =
"prismimagelinkSelected";
else
lnk.CssClass =
"prismimagelink";
i++;
for (int j = 1; j <= 5; j++)
{
PanelNumber.FindControl(
"LinkButton" + j.ToString()).Visible = false;
}
}
}
}
}
catch (Exception oEx)
{
// HttpContext.Current.Response.Write("Set Node :" + oEx.Message);
}
}
private void SetInNode(string Lnktext)
{
try
{
if (TotalItemCount >= 5)
{
if (TotalItemCount < 10)
{
for (int i = 6; i <= TotalItemCount; i++)
{
PanelNumber.FindControl(
"LinkButton" + i.ToString()).Visible = false;
}
for (int j = 1; j <= 5; j++)
{
PanelNumber.FindControl(
"LinkButton" + j.ToString()).Visible = true;
lnk = (
LinkButton)PanelNumber.FindControl("LinkButton" + j.ToString());
if (Lnktext == lnk.Text)
lnk.CssClass =
"prismimagelinkSelected";
else
lnk.CssClass =
"prismimagelink";
}
}
else if (TotalItemCount >= 10)
{
for (int i = 6; i <= 10; i++)
{
PanelNumber.FindControl(
"LinkButton" + i.ToString()).Visible = false;
}
for (int j = 1; j <= 5; j++)
{
PanelNumber.FindControl(
"LinkButton" + j.ToString()).Visible = true;
lnk = (
LinkButton)PanelNumber.FindControl("LinkButton" + j.ToString());
if (Lnktext == lnk.Text)
lnk.CssClass =
"prismimagelinkSelected";
else
lnk.CssClass =
"prismimagelink";
}
}
}
else
{
for (int k = 1; k <= TotalItemCount; k++)
{
PanelNumber.FindControl(
"LinkButton" + k.ToString()).Visible = true;
lnk = (
LinkButton)PanelNumber.FindControl("LinkButton" + k.ToString());
if (Lnktext == lnk.Text)
lnk.CssClass =
"prismimagelinkSelected";
else
lnk.CssClass =
"prismimagelink";
}
}
}
catch (Exception oEx)
{
//HttpContext.Current.Response.Write("Set In Node :" + oEx.Message);
}
}
string Direction;
/// <summary>
/// This GetPicDataTable() method is to bind data to rad rotator control.
/// </summary>
/// <returns></returns>
///
private DataTable GetPicDataTable()
{
DataTable dt = new DataTable();
DataRow dr;
DataColumn dc = new DataColumn();
dc.ColumnName =
"Image1";
dt.Columns.Add(dc);
dc =
new DataColumn();
dc.ColumnName =
"Image2";
dt.Columns.Add(dc);
dc =
new DataColumn();
dc.ColumnName =
"Image3";
dt.Columns.Add(dc);
dc =
new DataColumn();
dc.ColumnName =
"Id";
dt.Columns.Add(dc);
dc =
new DataColumn();
dc.ColumnName =
"LeftText";
dt.Columns.Add(dc);
dc =
new DataColumn();
dc.ColumnName =
"RightText";
dt.Columns.Add(dc);
try
{
SPList oList;
SPSite tmpSite1 = SPContext.Current.Site;
string connectionInfo = System.Configuration.ConfigurationManager.AppSettings["SetWebAppIndex"];//app setting of web config ,key taken from web config.
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite oSite = new SPSite(SPContext.Current.Web.Url))
{
using (SPWeb oWeb = oSite.OpenWeb())
{
oWeb.AllowUnsafeUpdates =
true;
oList =
SPContext.Current.Web.Lists[ListName];
SPQuery oQuery = new SPQuery();
if ((connectionInfo.ToLower().Contains(SPContext.Current.Web.Url.ToLower())))
{
oQuery.Query =
"<Where><Eq><FieldRef Name='HomeImag' /><Value Type='WorkflowStatus'>16</Value></Eq></Where>";
}
else
{
oQuery.Query =
"<OrderBy><FieldRef Name='ID' /></OrderBy>";
}
SPListItemCollection oItems = oList.GetItems(oQuery);
cnt = oItems.Count;
TotalItemCount = oItems.Count;
foreach (SPListItem oItem in oItems)
{
oItem[
"Preview"] = oWeb.Url + @"/" + oItem.File.ToString();
string temp = Convert.ToString(oItem["Preview"]);
finalPic = finalPic +
"," + temp;
string ids = Convert.ToString(oItem["ID"]);
AdminId = AdminId +
"," + ids;
string temptxt = Convert.ToString(oItem["Message"]);
Txt = Txt +
"^" + temptxt;
Direction =
Convert.ToString(oItem["Content Direction"]);
dir = dir +
"," + Direction;
}
string[] stringList = new string[cnt];
string[] IdList = new string[cnt];
char mychar = ',';
char mychar1 = '^';
string NewfinalString = finalPic.TrimStart(mychar);
string[] batchlist = NewfinalString.Split(new Char[] { ',' });
string NewfinalStringid = AdminId.TrimStart(mychar);
string[] AdminIdList = NewfinalStringid.Split(new Char[] { ',' });
string NewfinalText = Txt.TrimStart(mychar1);
string[] TextList = NewfinalText.Split(new Char[] { '^' });
string NewfinalDir = dir.TrimStart(mychar);
string[] DirList = NewfinalDir.Split(new Char[] { ',' });
for (int i = 0; i < cnt; i++)
{
dr = dt.NewRow();
if (FrameSize != null)
{
if (FrameSize == "Large")
{
dr[
"Image1"] = (batchlist[i] + "");
dr[
"Image2"] = "/_LAYOUTS/1033/IMAGES/Smithsonian Images/Feature Content/arrow_white.gif";
dr[
"Image3"] = "/_LAYOUTS/1033/IMAGES/Smithsonian Images/Feature Content/arrow_white.gif";
}
else if (FrameSize == "Medium")
{
dr[
"Image1"] = "/_LAYOUTS/1033/IMAGES/Smithsonian Images/Feature Content/arrow_white.gif";
dr[
"Image2"] = (batchlist[i] + "");
dr[
"Image3"] = "/_LAYOUTS/1033/IMAGES/Smithsonian Images/Feature Content/arrow_white.gif";
}
else if (FrameSize == "Small")
{
dr[
"Image3"] = (batchlist[i] + "");
dr[
"Image1"] = "/_LAYOUTS/1033/IMAGES/Smithsonian Images/Feature Content/arrow_white.gif";
dr[
"Image2"] = "/_LAYOUTS/1033/IMAGES/Smithsonian Images/Feature Content/arrow_white.gif";
}
}
dr[
"Id"] = (AdminIdList[i] + "");
if ((DirList[i].ToString()) == "Left")
{
dr[
"LeftText"] = (TextList[i] + "");
dr[
"RightText"] = "";
}
else
{
dr[
"LeftText"] = "";
dr[
"RightText"] = (TextList[i] + "");
}
dt.Rows.Add(dr);
}
}
//}
}
});
}
catch (Exception oEx)
{
//HttpContext.Current.Response.Write("Get Pic Data Table :" + oEx.Message);
}
return dt;
}
// Following method for setting,
//Banner Image size Dynamically according to frame size small,medium,large.
//and displaying Message,Text to right or left side on webpart ,given by user.
protected void rrMonths_ItemDataBound(object sender, RadRotatorEventArgs e)
{
try
{
Label lbl = (Label)e.Item.FindControl("lblright");
Label lblleft = (Label)e.Item.FindControl("lblleft");
Panel pnl = (Panel)e.Item.FindControl("pnl");
Panel pnlleft = (Panel)e.Item.FindControl("pnlleft");
if (FrameSize != null)
{
if (FrameSize == "Small")
{
Image img1 = (Image)e.Item.FindControl("Image1");
img1.Visible =
false;
Image img2 = (Image)e.Item.FindControl("Image2");
img2.Visible =
false;
if (lbl.Text == string.Empty)
{
pnl.Visible =
false;
}
else
{
pnl.Visible =
true;
}
if (lblleft.Text == string.Empty)
{
pnlleft.Visible =
false;
}
else
{
pnlleft.Visible =
true;
}
}
else if (FrameSize == "Medium")
{
Image img1 = (Image)e.Item.FindControl("Image1");
img1.Visible =
false;
Image img3 = (Image)e.Item.FindControl("Image3");
img3.Visible =
false;
if (lbl.Text == string.Empty)
{
pnl.Visible =
false;
}
else
{
pnl.Visible =
true;
}
if (lblleft.Text == string.Empty)
{
pnlleft.Visible =
false;
}
else
{
pnlleft.Visible =
true;
}
}
else if (FrameSize == "Large")
{
Image img2 = (Image)e.Item.FindControl("Image2");
img2.Visible =
false;
Image img3 = (Image)e.Item.FindControl("Image3");
img3.Visible =
false;
if (lbl.Text == string.Empty)
{
pnl.Visible =
false;
}
else
{
pnl.Visible =
true;
}
if (lblleft.Text == string.Empty)
{
pnlleft.Visible =
false;
}
else
{
pnlleft.Visible =
true;
}
}
}
DataRowView currentRow = (DataRowView)e.Item.DataItem;
}
catch (Exception oEx)
{
// HttpContext.Current.Response.Write(oEx.Message);
}
}
protected override void Render(HtmlTextWriter writer)
{
base.Render(writer);
writer.WriteLine(
"<link href=/_LAYOUTS/1033/STYLES/Smithsonian CSS/Feature Content CSS/banner_style.css' type='text/css' rel='stylesheet'>");
}
}
}
Main Rotator.cs file----------------------------
using
System;
using
System.Data;
using
System.Configuration;
using
System.Web;
using
System.Web.Security;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
System.Web.UI.HtmlControls;
using
Microsoft.SharePoint.WebPartPages;
using
Telerik.Web.UI;
namespace
OptimusBT.Rotator
{
public class Rotator : Microsoft.SharePoint.WebPartPages.WebPart
{
UC_Rotator UCRotator;
private string _Rheight;
public string Rheight
{
get
{
return _Rheight;
}
set
{
_Rheight =
value;
}
}
private string _Rwidth;
public string Rwidth
{
get
{
return _Rwidth;
}
set
{
_Rwidth =
value;
}
}
private string _Itemheight;
public string Itemheight
{
get
{
return _Itemheight;
}
set
{
_Itemheight =
value;
}
}
private string _Itemwidth;
public string Itemwidth
{
get
{
return _Itemwidth;
}
set
{
_Itemwidth =
value;
}
}
private string _Home;
public string Home
{
get
{
return _Home;
}
set
{
_Home =
value;
}
}
private string _FrameSize;
public string FrameSize
{
get
{
return _FrameSize;
}
set
{
_FrameSize =
value;
}
}
private string _Duration;
public string Duration
{
get
{
return _Duration;
}
set
{
_Duration =
value;
}
}
protected override void OnLoad(EventArgs e)
{
RadAjaxPanel updatePanelRotator=new RadAjaxPanel();
try
{
base.OnLoad(e);
updatePanelRotator.ID =
"updatePanelRotator";
this.Controls.Add(updatePanelRotator);
Panel pnlsearch = (Panel)UCRotator.FindControl("demo");
updatePanelRotator.Controls.Add(pnlsearch);
}
catch (Exception ex)
{
}
}
protected override void CreateChildControls()
{
try
{
base.CreateChildControls();
UCRotator = (
UC_Rotator)this.Page.LoadControl(@"~/_CONTROLTEMPLATES/Smithsonian Controls/UC_Rotator.ascx");
UCRotator.ID =
"UCRotator";
UCRotator.Rheight =
this.Rheight;
UCRotator.Rwidth =
this.Rwidth;
UCRotator.Itemheight =
this.Itemheight;
UCRotator.Itemwidth =
this.Itemwidth;
UCRotator.Home =
this.Home;
UCRotator.FrameSize =
this.FrameSize;
UCRotator.Duration =
this.Duration;
this.Controls.Add(UCRotator);
}
catch (Exception oEx)
{
// throw oEx;
}
finally
{
}
}
/// Tool Part, used to load custom tool part.
///
public override ToolPart[] GetToolParts()
{
try
{
ToolPart[] toolparts = new ToolPart[10];
WebPartToolPart oToolpart = new WebPartToolPart();
toolpart.
ToolpartSettings oConfigure = new toolpart.ToolpartSettings();
//Adding the default toolpart
toolparts[0] = oToolpart;
//Adding the custom toolpart
toolparts[1] = oConfigure;
return toolparts;
}
catch (Exception oEx)
{
//HttpContext.Current.Response.Write("Render: " + oEx.Message);
}
return base.GetToolParts();
}
protected override void OnInit(EventArgs e)
{
try
{
base.OnInit(e);
ScriptManager.RegisterStartupScript(this, typeof(Rotator), "UpdatePanelFixup", "_spOriginalFormAction = document.forms[0].action; _spSuppressFormOnSubmitWrapper=true;", true);
ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page);
if (scriptManager == null)
{
scriptManager =
new RadScriptManager();
this.Page.Form.Controls.AddAt(0, scriptManager);
}
}
catch (Exception oEx)
{
// HttpContext.Current.Response.Write("Script Manager: " + oEx.Message);
}
}
protected override void Render(HtmlTextWriter writer)
{
try
{
base.Render(writer);
}
catch (Exception oEx)
{
HttpContext.Current.Response.Write("Render: " + oEx.Message);
}
}
}
}
Rad Rotator web part Toolpart Settings.cs file code
--------------------------------------------------------------------------
using
System;
using
System.Data;
using
System.Configuration;
using
System.Web;
using
System.Web.Security;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
System.Web.UI.HtmlControls;
using
System.Collections;
using
Microsoft.SharePoint;
using
Telerik.Web.UI;
namespace
toolpart
{
public class ToolpartSettings:Microsoft.SharePoint.WebPartPages.ToolPart
{
OptimusBT.Rotator.
Rotator oAdminPic;
PlaceHolder phConfiguration;
Table tblConfigure;
Label oSetFrame;
Label oFrameHeight;
Label oFrameWidth;
DropDownList ddlFrameSize;
TextBox txtFrameHeight;
TextBox txtFrameWidth;
CheckBox chkApprovedHome;
Label lblscrollduration;
Label lblscrollinfo;
DropDownList ddlduration;
/// <summary>
/// Constructor, used to set the tool part properties
/// </summary>
public ToolpartSettings()
{
this.Title = "Configuration Settings";
}
protected override void CreateChildControls()
{
try
{
oAdminPic = (OptimusBT.Rotator.
Rotator)this.ParentToolPane.SelectedWebPart;
phConfiguration = CreateControls();
this.Controls.Add(phConfiguration);
}
catch (Exception oEx)
{
// HttpContext.Current.Response.Write("Create Child Controls :" + oEx.Message);
}
}
/// <summary>
/// Procedure used to save the changes of Tool Part.
/// </summary>
public override void ApplyChanges()
{
try
{
oAdminPic.FrameSize = ddlFrameSize.SelectedItem.Text;
oAdminPic.Duration = ddlduration.SelectedItem.Text;
if ((txtFrameHeight.Text != string.Empty) || (txtFrameHeight.Text != null))
{
oAdminPic.Rheight = txtFrameHeight.Text;
}
if ((txtFrameWidth.Text != string.Empty) || (txtFrameWidth.Text !=null))
{
oAdminPic.Rwidth = txtFrameWidth.Text;
}
if (chkApprovedHome.Checked == true)
{
oAdminPic.Home =
"True";
}
else
{
oAdminPic.Home =
"False";
}
if (ViewState["state"] != null)
{
//HttpContext.Current.Response.Write("<script language=javascript>window.location = '/default.aspx';</script>");
HttpContext.Current.Response.Write("<script language=javascript>var cururl=document.location.href;window.location =cururl;</script>");
}
else
{
ViewState[
"state"] = "ss";
}
}
catch (Exception oEx)
{
// HttpContext.Current.Response.Write("Apply Changes :" + oEx.Message);
}
}
/// <summary>
/// Procedure used to create the controls in Tool Part.
/// </summary>
private PlaceHolder CreateControls()
{
phConfiguration =
new PlaceHolder();
try
{
tblConfigure =
new Table();
oSetFrame =
new Label();
oSetFrame.Text =
"Set Rotator Frame Size";
tblConfigure.Rows.Add(
new TableRow());
tblConfigure.Rows[0].Cells.Add(
new TableCell());
tblConfigure.Rows[0].Cells[0].Controls.Add(oSetFrame);
ddlFrameSize =
new DropDownList();
ddlFrameSize.Items.Add(
"Large");
ddlFrameSize.Items.Add(
"Medium");
ddlFrameSize.Items.Add(
"Small");
tblConfigure.Rows.Add(
new TableRow());
tblConfigure.Rows[1].Cells.Add(
new TableCell());
tblConfigure.Rows[1].Cells[0].Controls.Add(ddlFrameSize);
oFrameHeight =
new Label();
oFrameHeight.Visible =
false;
oFrameHeight.Text =
"Height ";
tblConfigure.Rows.Add(
new TableRow());
tblConfigure.Rows[2].Cells.Add(
new TableCell());
tblConfigure.Rows[2].Cells[0].Controls.Add(oFrameHeight);
txtFrameHeight =
new TextBox();
txtFrameHeight.Visible =
false;
txtFrameHeight.Width = 40;
tblConfigure.Rows.Add(
new TableRow());
tblConfigure.Rows[2].Cells.Add(
new TableCell());
tblConfigure.Rows[2].Cells[0].Controls.Add(txtFrameHeight);
oFrameWidth =
new Label();
oFrameWidth.Visible =
false;
oFrameWidth.Text =
"Width ";
tblConfigure.Rows.Add(
new TableRow());
tblConfigure.Rows[2].Cells.Add(
new TableCell());
tblConfigure.Rows[2].Cells[0].Controls.Add(oFrameWidth);
txtFrameWidth =
new TextBox();
txtFrameWidth.Visible =
false;
txtFrameWidth.Width = 40;
tblConfigure.Rows.Add(
new TableRow());
tblConfigure.Rows[2].Cells.Add(
new TableCell());
tblConfigure.Rows[2].Cells[0].Controls.Add(txtFrameWidth);
chkApprovedHome =
new CheckBox();
chkApprovedHome.AutoPostBack =
true;
chkApprovedHome.Checked =
false;
chkApprovedHome.Text =
"Allow Image Rotation";
chkApprovedHome.CheckedChanged +=
new EventHandler(chkApproveHome_CheckedChanged);
tblConfigure.Rows.Add(
new TableRow());
tblConfigure.Rows[4].Cells.Add(
new TableCell());
tblConfigure.Rows[4].Cells[0].Controls.Add(chkApprovedHome);
lblscrollduration =
new Label();
lblscrollduration.Text =
"Scroll Duration";
tblConfigure.Rows.Add(
new TableRow());
tblConfigure.Rows[5].Cells.Add(
new TableCell());
tblConfigure.Rows[5].Cells[0].Controls.Add(lblscrollduration);
lblscrollinfo =
new Label();
lblscrollinfo.Text =
"(In milliseconds,Default value 500)";
tblConfigure.Rows.Add(
new TableRow());
tblConfigure.Rows[6].Cells.Add(
new TableCell());
tblConfigure.Rows[6].Cells[0].Controls.Add(lblscrollinfo);
ddlduration =
new DropDownList();
ddlduration.AutoPostBack =
false;
ddlduration.Enabled =
false;
ddlduration.Items.Add(
"-- Select --");
ddlduration.Items.Add(
"10");
ddlduration.Items.Add(
"50");
ddlduration.Items.Add(
"100");
ddlduration.Items.Add(
"500");
ddlduration.Items.Add(
"800");
ddlduration.Items.Add(
"1000");
ddlduration.Items.Add(
"1500");
ddlduration.Items.Add(
"2000");
ddlduration.Items.Add(
"3500");
ddlduration.Items.Add(
"4000");
ddlduration.Items.Add(
"5000");
ddlduration.Items.Add(
"8000");
ddlduration.Items.Add(
"10000");
ddlduration.Items.Add(
"15000");
ddlduration.Items.Add(
"20000");
ddlduration.Items.Add(
"25000");
ddlduration.Items.Add(
"30000");
ddlduration.Items.Add(
"50000");
ddlduration.Items.Add(
"70000");
ddlduration.Items.Add(
"90000");
ddlduration.Items.Add(
"100000");
ddlduration.Items.Add(
"200000");
ddlduration.Items.Add(
"400000");
ddlduration.Items.Add(
"500000");
ddlduration.Items.Add(
"1000000");
tblConfigure.Rows.Add(
new TableRow());
tblConfigure.Rows[7].Cells.Add(
new TableCell());
tblConfigure.Rows[7].Cells[0].Controls.Add(ddlduration);
phConfiguration.Controls.Add(tblConfigure);
if (oAdminPic.Rwidth != string.Empty)
txtFrameWidth.Text = oAdminPic.Rwidth;
if (oAdminPic.Rheight != string.Empty)
txtFrameHeight.Text = oAdminPic.Rheight;
if (oAdminPic.Home == "True")
{
chkApprovedHome.Checked =
true;
}
else
{
chkApprovedHome.Checked =
false;
}
if (oAdminPic.FrameSize != null)
{
if (oAdminPic.FrameSize != string.Empty)
{
ddlFrameSize.SelectedIndex = ddlFrameSize.Items.IndexOf(ddlFrameSize.Items.FindByText(oAdminPic.FrameSize.Trim()));
}
}
if (oAdminPic.Duration != null)
{
if (oAdminPic.Duration != string.Empty)
{
// ddlFrameSize.SelectedIndex = ddlFrameSize.Items.IndexOf(ddlFrameSize.Items.FindByText(oAdminPic.FrameSize.Trim()));
ddlduration.SelectedIndex = ddlduration.Items.IndexOf(ddlduration.Items.FindByText(oAdminPic.Duration.Trim()));
}
}
}
catch (Exception oEx)
{
//HttpContext.Current.Response.Write("CreateControls :" + oEx.Message);
}
return phConfiguration;
}
protected void chkApproveHome_CheckedChanged(object sender, EventArgs e)
{
if (chkApprovedHome.Checked == true)
{
ddlduration.Enabled =
true;
}
else
{
ddlduration.Enabled =
false;
}
}
protected override void RenderToolPart(HtmlTextWriter output)
{
base.RenderToolPart(output);
}
}
}