Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
173 views
Hi,

I want my editor to also behave in "AppendOnly" mode. When you save text in editor for the first time it act normally and save data. But when I load this editor, then I want to load previous text in read only format and user can only add / append text below the old text.

In this append only mode ,the editor is not readonly but already saved text is readonly. How can I load editor with edit enabled and  editor text as read only ?

I only want to give option to user to append more text at the bottom, they can't edit or delete previously saved text. Thus, I am looking for something similar to RichTextBox properties of SelProtectedSelStart , and SelLength in RadEditor.

Please let me know how to achieve this.

Thanks
Rumen
Telerik team
 answered on 16 Mar 2010
5 answers
147 views
I've a grid with scrolling and static headers enabled.

When I add a 'wide' table the grid scrolls horizontally. If I add a detail table the horizontal scrolling disables itself.

Is there a magic spell I'm missing?

FYI, below is a listing of the test page I created which uses the Northwind DB...
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm6.aspx.cs" Inherits="WebApplication1.WebForm6" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"
    <title></title
</head> 
<body> 
    <form id="form1" runat="server"
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
    </telerik:RadScriptManager> 
     
    <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" GridLines="None" Skin="WebBlue" Width="100%"
<MasterTableView DataSourceID="SqlDataSource1" CommandItemDisplay="Top" DataKeyNames="OrderID"
<RowIndicatorColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</RowIndicatorColumn> 
 
    <DetailTables> 
      <telerik:GridTableView runat="server" AutoGenerateColumns="True" DataSourceID="SqlDataSource2"
        <ParentTableRelation> 
          <telerik:GridRelationFields DetailKeyField="OrderId" MasterKeyField="OrderId" /> 
        </ParentTableRelation> 
        <RowIndicatorColumn> 
          <HeaderStyle Width="20px" /> 
        </RowIndicatorColumn> 
        <ExpandCollapseColumn> 
          <HeaderStyle Width="20px" /> 
        </ExpandCollapseColumn> 
      </telerik:GridTableView> 
    </DetailTables> 
 
<ExpandCollapseColumn Visible="True"
</ExpandCollapseColumn> 
  <Columns> 
    <telerik:GridBoundColumn DataField="OrderID" DataType="System.Int32" HeaderText="OrderID" ReadOnly="True" SortExpression="OrderID" UniqueName="OrderID"
    </telerik:GridBoundColumn> 
    <telerik:GridBoundColumn DataField="CustomerID" HeaderText="CustomerID" SortExpression="CustomerID" UniqueName="CustomerID"
    </telerik:GridBoundColumn> 
    <telerik:GridBoundColumn DataField="EmployeeID" DataType="System.Int32" HeaderText="EmployeeID" SortExpression="EmployeeID" UniqueName="EmployeeID"
    </telerik:GridBoundColumn> 
    <telerik:GridBoundColumn DataField="OrderDate" DataType="System.DateTime" HeaderText="OrderDate" SortExpression="OrderDate" UniqueName="OrderDate"
    </telerik:GridBoundColumn> 
    <telerik:GridBoundColumn DataField="RequiredDate" DataType="System.DateTime" HeaderText="RequiredDate" SortExpression="RequiredDate" UniqueName="RequiredDate"
    </telerik:GridBoundColumn> 
    <telerik:GridBoundColumn DataField="ShippedDate" DataType="System.DateTime" HeaderText="ShippedDate" SortExpression="ShippedDate" UniqueName="ShippedDate"
    </telerik:GridBoundColumn> 
    <telerik:GridBoundColumn DataField="ShipVia" DataType="System.Int32" HeaderText="ShipVia" SortExpression="ShipVia" UniqueName="ShipVia"
    </telerik:GridBoundColumn> 
    <telerik:GridBoundColumn DataField="Freight" DataType="System.Decimal" HeaderText="Freight" SortExpression="Freight" UniqueName="Freight"
    </telerik:GridBoundColumn> 
    <telerik:GridBoundColumn DataField="ShipName" HeaderText="ShipName" SortExpression="ShipName" UniqueName="ShipName"
    </telerik:GridBoundColumn> 
    <telerik:GridBoundColumn DataField="ShipAddress" HeaderText="ShipAddress" SortExpression="ShipAddress" UniqueName="ShipAddress"
    </telerik:GridBoundColumn> 
    <telerik:GridBoundColumn DataField="ShipCity" HeaderText="ShipCity" SortExpression="ShipCity" UniqueName="ShipCity"
    </telerik:GridBoundColumn> 
    <telerik:GridBoundColumn DataField="ShipRegion" HeaderText="ShipRegion" SortExpression="ShipRegion" UniqueName="ShipRegion"
    </telerik:GridBoundColumn> 
    <telerik:GridBoundColumn DataField="ShipPostalCode" HeaderText="ShipPostalCode" SortExpression="ShipPostalCode" UniqueName="ShipPostalCode"
    </telerik:GridBoundColumn> 
    <telerik:GridBoundColumn DataField="ShipCountry" HeaderText="ShipCountry" SortExpression="ShipCountry" UniqueName="ShipCountry"
    </telerik:GridBoundColumn> 
  </Columns> 
</MasterTableView> 
      <ClientSettings> 
        <Selecting AllowRowSelect="True" /> 
        <Scrolling AllowScroll="True" UseStaticHeaders="True" /> 
      </ClientSettings> 
    </telerik:RadGrid> 
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NORTHWIND.MDFConnectionString %>" SelectCommand="SELECT * FROM [Orders]"></asp:SqlDataSource> 
 
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:NORTHWIND.MDFConnectionString %>" SelectCommand="SELECT * FROM [Order Details]"></asp:SqlDataSource> 
 
    </form> 
</body> 
</html> 
 

--
Stuart
Veli
Telerik team
 answered on 16 Mar 2010
2 answers
129 views
Hello,
I have a tab call 'products' which contains a user control with left and right radpane in a radmultipage, the left pane is a products panel bar. Each prduct will generate a panel and the childitem (set with productParentID) will generate as items. When clicking on the item, the right pane can display the user control with configurated detailview base on the selected item value (id). Now, How does user save this product link, such as adding it to his favorite? In my mind, I can check if the url link contains a query string call "page=product&id=1", then I will set the tab selected id, the panel bar selected id and the detailview with which of product id. But it would give out a logical bug if user goes to another page by clicking other link or tab, then it will come back to product page again...
Please advice, thx!

Yana
Telerik team
 answered on 16 Mar 2010
1 answer
87 views

Hi Support team,

This query is just to get an information about multicolumn radCombo...
Is it possible to create a RadCombo, multicolumn RadCombo , without <ul><li> tags?

If so how can it be done, can u help me by providing a sample project for the same?
How data can be bound to Combo from server-side?
Please explain me the details....


-Liji Jose
Kalina
Telerik team
 answered on 16 Mar 2010
7 answers
233 views
Hi,
I populate TreeView nodes programmatically as below:
dtModule = LoadModule(strMandatory)
        If (dtModule.Rows.Count > 0) Then
            For Each drRow In dtModule.Rows
                If tnNode.Nodes.FindNodeByText(drRow(0).ToString) Is Nothing Then
                    tnModule = New Telerik.Web.UI.RadTreeNode
                    tnModule.Text = drRow(0).ToString
                    tnModule.Value = drRow(0).ToString
                    tnModule.ToolTip = drRow(1).ToString
                    tnNode.Nodes.Add(tnModule)
                End If
            Next
        End If

How can i put a link beside the text of the node? For example:
tnModule.Text = "something"
then at the TreeNode display i would like to have
Something Click here to go yahoo

Pls advise!
Thanks!
Yana
Telerik team
 answered on 16 Mar 2010
1 answer
79 views
Hi!   I have a RadSlider that is in a repeater along with a check box.  When the check box is checked the RadSlider is enable otherwise it is disabled.  This all happens via Ajax and is working fine.  The problem I have is the left arrow on the slider does not work also if I click the slider to the left of the value indicator nothing happens.  So, the only way to decrease the value of the slider is to click the value indicator and drag it left.  The right arrow and clicking on the right side of the value indicator work as expected.  Anyone have any idea why this happens or how to fix it?


Thanks in Advance!

Susan
Tsvetie
Telerik team
 answered on 16 Mar 2010
1 answer
439 views
Hi i have problem:

RadStyleSheetManager requires a HttpHandler registration in web.config.

This error doesnť appear on PC with installed ASP.NET Development server from Visual studio. But error appear when using IIS. Can you please help us?

Code in webconfig:
<httpHandlers> 
      <remove verb="*" path="*.asmx"/> 
      <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> 
      <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> 
      <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/> 
      <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false"/> 
      <add path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" validate="false"/> 
    </httpHandlers> 

T. Tsonev
Telerik team
 answered on 16 Mar 2010
10 answers
242 views
Hello ,
       I have created custom web part in asp.net for moss 2007 site.I am using RadRotator inside user control and loading it through RadAjaxPanel dynamically.It is working only in IE browser, It is not working in FF,crome 3.0 and safari 4.0.
       I am using Telerik 2009.3.1208.20 version of dlls.

Following code using for user control:

<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">
                            &nbsp;</td>
                        <td align="left" valign="top" scope="col">
                            
                               <telerik:RadRotator ID="rrMonths" runat="server" AutoPostBack="false" OnItemDataBound="rrMonths_ItemDataBound"
                                ScrollDuration="2000">
                                
                                 <ItemTemplate>
                                    <table>
                                        <tr>
                                            <td valign="top">                                     
                                                <asp:Label ID="lblleft" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"LeftText")%>'></asp:Label>
                                            </td>
                                            <td style="width:7px">
                                            </td>
                                            <td valign="top">
                                             
                                                <asp:Image AlternateText="IMAGE" ID="Image1" runat="server" ImageUrl='<%#DataBinder.Eval(Container.DataItem,"Image1")%>' Height="200" Width ="300"/>
                                               <asp:Image AlternateText="IMAGE" ID="Image2" runat="server" ImageUrl='<%#DataBinder.Eval(Container.DataItem,"Image2")%>' Height="100" Width ="150"/>
                                              <asp:Image AlternateText="IMAGE" ID="Image3" runat="server" ImageUrl='<%#DataBinder.Eval(Container.DataItem,"Image3")%>' Height="90" Width ="130"/>
                                                <asp:HiddenField ID="hdnid" runat="server" Value='<%#DataBinder.Eval(Container.DataItem,"Id")%>'/>
                                            </td>
                                            
                                            <td style="width:7px" >
                                            </td>
                                            <td valign="top">
                                                <asp:Label ID="lblright" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"RightText")%>'></asp:Label></td>
                                        </tr>
                                    </table>
                                </ItemTemplate>
                               
                               
                            </telerik:RadRotator>
                        </td>
                        <td align="left" valign="top" scope="col" class="prism_bannerMiddleRight">
                            &nbsp;</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>

Code behind (rotator.cs)
        UC_Rotator UCRotator;
        RadAjaxPanel _updatePanel;
protected override void OnInit(EventArgs e)
        { 
            base.OnInit(e);
            if (ScriptManager.GetCurrent(this.Page) == null)
            {
                ScriptManager managers = new RadScriptManager();
                this.Page.Form.Controls.AddAt(0, managers);
            }
            
        }
        protected override void OnLoad(EventArgs e)
        {
            try
            {
                base.OnLoad(e);
                _updatePanel = new RadAjaxPanel();
                _updatePanel.ID = "UpdatePanel1";
                this.Controls.Add(_updatePanel);
               Panel pnlsearch = (Panel)UCRotator.FindControl("demo");
                     _updatePanel.Controls.Add(pnlsearch);
               }
            catch (Exception ex)
            {
                 HttpContext.Current.Response.Write("Error :" + ex.Message);
            }
        }
private void EnsureUpdatePanelFixups()
        {
            if (this.Page.Form != null)
            {
                String fixupScript = @"_spBodyOnLoadFunctionNames.push(""_initFormActionAjax"");
                 function _initFormActionAjax()
                 {
                   if (_spEscapedFormAction == document.forms[0].action)
                   {
                     document.forms[0]._initialAction = 
                     document.forms[0].action;
                   }
                 }
                 var RestoreToOriginalFormActionCore = 
                   RestoreToOriginalFormAction;
                 RestoreToOriginalFormAction = function()
                 {
                   if (_spOriginalFormAction != null)
                   {
                     RestoreToOriginalFormActionCore();
                     document.forms[0]._initialAction = 
                     document.forms[0].action;
                   }
                 }";
                ScriptManager.RegisterStartupScript(this, typeof(Rotator), "UpdatePanelFixup", fixupScript, true);
            }
        }
        protected override void CreateChildControls()
        {
            try
            {
                if (BrowserDesignMode)
                {
                    //nothing
                }
                else
                {
                    base.CreateChildControls();
                    this.EnsureUpdatePanelFixups();
                    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;
                    this.Controls.Add(UCRotator);
                    ViewState["demo"] = "true";
                    
                }
            }
            catch (Exception oEx)
            {
                throw oEx;
            }
            finally
            {

            }
        }


User control code behind(UC_rotator.ascx.cs)

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";
                    rrMonths.DataSource = GetPicDataTable();
                    rrMonths.DataBind();

                    DynamicCreateLinkButton();


                    if (FrameSize != null)
                    {
                        if (FrameSize == "Large")
                        {
                            demo.Width = 652;
                            rrMonths.Width = 652 - 41;
                            rrMonths.ItemWidth = 652 - 41;
                            rrMonths.Height = 220;
                            rrMonths.ItemHeight = 220;

                        }
                        else if (FrameSize == "Medium")
                        {
                            demo.Width = 406;
                            rrMonths.Width = 406 - 41;
                            rrMonths.ItemWidth = 406 - 41;
                            rrMonths.Height = 220;
                            rrMonths.ItemHeight = 220;

                        }
                        else if (FrameSize == "Small")
                        {
                            demo.Width = 376;
                            rrMonths.Width = 376 - 41;
                            rrMonths.Height = 220;
                            rrMonths.ItemWidth = 376 - 41;
                            rrMonths.ItemHeight = 220;
                        }
                    }
                   


                }
            }
           catch (Exception oEx)
            {
               HttpContext.Current.Response.Write("Page Load :" + oEx.Message);
            }
        }
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;
                   SPSecurity.RunWithElevatedPrivileges(delegate()
                  {
                      using (SPSite oSite = new SPSite(SPContext.Current.Web.Url))
                      {
                          SPWebApplication webApplication = oSite.WebApplication;
                          string connectionInfo = System.Configuration.ConfigurationManager.AppSettings["SetWebAppIndex"];
                          int WebAppIndex = int.Parse(connectionInfo);
                          string TopLevelSiteUrl = webApplication.Sites[WebAppIndex].Url;
                          using (SPWeb oWeb = oSite.OpenWeb())
                          {
                              oWeb.AllowUnsafeUpdates = true;
                              
                                  oList = SPContext.Current.Web.Lists[ListName];
                                  SPQuery oQuery = new SPQuery();
                                  if ((TopLevelSiteUrl) == (SPContext.Current.Web.Url))
                                  {
                                     // oQuery.Query = "<Where><Eq><FieldRef Name='ApprovalStatus' /><Value Type='Choice'>Approved</Value></Eq></Where>";
                                      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;
                                      string Direction = Convert.ToString(oItem["Content Direction"]);
                                      dir = dir + "," + Direction;

                                  }
                              
                                  string[] stringList = new string[cnt];
                                  string[] IdList = new string[cnt];
                                 // string[] TextList = 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] + "");
                                      }
                                     // dr["Text"] = (TextList[i] + "");
                                      dt.Rows.Add(dr);
                                 }
                           }
                      }
                   });
         
            }
            catch (Exception oEx)
            {
                HttpContext.Current.Response.Write("Get Pic Data Table :" + oEx.Message);
            }
            return dt;
        }

protected void SetInaitialItemIndex(object sender, EventArgs e)
        {
            try
            {
                LinkButton senderControl = sender as LinkButton;
              // senderControl.CssClass = "prismimagelinkSelected";
                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);
            }
       }
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);
                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);
               
                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.Click += new System.Web.UI.ImageClickEventHandler(SetVisible);
            }
            catch (Exception oEx)
            {
                HttpContext.Current.Response.Write("Dynamic Create Link Button :" + oEx.Message);
            }
   }
        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);
            }
  }

please help me ASAP.
THANKS IN ADVANCE.
Lini
Telerik team
 answered on 16 Mar 2010
1 answer
120 views
Hello,

I am using RadGrid and also enable the scollbar. Though there is only one row, Grid size does not change and shows a  lot of blank space below that row. How can I define the height of the Grid according to the no of rows in it.

I am suing this code behind for autoscroll enable.
gridBillToSearchResult.Width = Unit.Percentage(98)  
gridBillToSearchResult.ClientSettings.Scrolling.UseStaticHeaders = True 
gridBillToSearchResult.ClientSettings.Scrolling.AllowScroll = True 
 

-Prayag
Pavlina
Telerik team
 answered on 16 Mar 2010
1 answer
89 views
Hello all,

I want to give my users some other options for my radgrid, than the options given by the default headercontextmenu, and have instead choosen to use a radcontextmenu. This contextmenu can I unfortunately not attach to the header only, but only to the full grid. What should I do to set only the header as target, since I want different menues for the header and for the item-row.

Cheers,
Kenneth
Shinu
Top achievements
Rank 2
 answered on 16 Mar 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?