Telerik Forums
UI for ASP.NET AJAX Forum
7 answers
619 views
1. i have one radtextbox and radbutton. i want to make this radbutton visible when people start typing. if there is no values in the radtextbox radbutton should be hidden. so when started entering the letters radbutton should be visible and when they delete or backspace completely then radbutton should be hidden?
i tried so many ways to achieve this task from client side.

what is the java script code for this one. it should support all browsers. i tried onkeypress. but didnt get the result i want.


2. i want when user remove selected files from radasyncupload then radbutton should be hidden. when they start selecting files to upload then radbutton should b visible.
 when i selected removeselectedfiles option, button become hidden immedieately remove just one file itself. hwo to check the number of files selected in radasyncupload from client side ?

3. is there any textboxlist control in telerik for email text field? i want like to see as iphone, facebook and all. how to do that?


Shinu
Top achievements
Rank 2
 answered on 11 Mar 2014
1 answer
122 views
Team,

I am having one major issue i radgrid.

In grid i m selecting 2 rows and now filter with some values then i am select 3 rows. Now i need to click  on add button which is outside of grid. But in result grid only 3 rows will be added. Expected result grid should be  add all selected rows i.e. 5 rows.


Please help urgent.
Shinu
Top achievements
Rank 2
 answered on 11 Mar 2014
4 answers
353 views
I've already looked at:
http://www.telerik.com/help/aspnet-ajax/grid-appearance-customize-gridtemplatecolumn.html

Which used a template for the header and data sections.  To my eyes its a really crude solution, and doesn't look very good.

Is there a better way to do this that reflects a polished product?

Thanks
Shinu
Top achievements
Rank 2
 answered on 11 Mar 2014
3 answers
199 views
I have this aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="SPAC.Web.Paginas.test" %>
 
<!DOCTYPE html>
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <Scripts>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js">
                </asp:ScriptReference>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js">
                </asp:ScriptReference>
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js">
                </asp:ScriptReference>
            </Scripts>
        </telerik:RadScriptManager>
        <telerik:RadAjaxManager runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="btn">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="lbl" UpdatePanelCssClass="" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
    <div>
        <telerik:RadAjaxPanel runat="server" HorizontalAlign="NotSet" ID="pnl">
            <asp:Button runat="server" Text="test" ID="btn" OnClick="btn_OnClick"/>
            <asp:Label runat="server" Text="test" ID="lbl"></asp:Label>
        </telerik:RadAjaxPanel>
    </div>
    </form>
</body>
</html>
 And my code behind is like:
protected void btn_OnClick(object sender, EventArgs e)
        {
            lbl.Text = "nada";
        }

When I click on the button, the label "lbl" disappears (it should change the text of the label). Should I use two panels? or how can I ajaxify the asp controls?

Thanks in advance
Princy
Top achievements
Rank 2
 answered on 11 Mar 2014
0 answers
176 views
Hopefully this is a simple issue/rookie mistake. We have a RadGrid where our header row is not showing at all. I don't know why, but it appears that the css class "rgHeader" is not attached to the th. Any thoughts on how to fix this or where to even start troubleshooting? We have this code working as part of a larger project on other machines (where the header correctly gets the rgheader class). We can't rule out that it's a machine issue or that something is missing that was included in the larger project. Image of missing header row attached (note we purposefully loaded two empty rows of data, so we know all the data is loading correctly) as well as grid definition and rendered html.

Grid:
<telerik:RadGrid ID="AXXRadGrid" runat="server" GridLines="None" AllowAutomaticUpdates="True"
                OnItemCommand="AXXRadGrid_ItemCommand" OnItemDataBound="AXXRadGrid_ItemDataBound"
                AutoGenerateColumns="false" OnSortCommand="AXXRadGrid_SortCommand" AllowMultiRowSelection="true"
                OnItemCreated="AXXRadGrid_ItemCreated" DataSourceID="RequestMasterDataSource"
                OnHTMLExporting="AXXRadGrid_HTMLExporting" OnExportCellFormatting="AXXRadGrid_ExcelExportCellFormatting">
                <ExportSettings HideStructureColumns="true" />
                <MasterTableView TableLayout="Auto" RetrieveDataTypeFromFirstItem="true" CommandItemDisplay="Top">
                    <CommandItemSettings ShowExportToExcelButton="false" ShowAddNewRecordButton="false"
                        ShowRefreshButton="false" />
                </MasterTableView>
                <ClientSettings>
                    <Selecting AllowRowSelect="True"></Selecting>
                    <Scrolling AllowScroll="false"></Scrolling>
                    <Resizing ResizeGridOnColumnResize="True" AllowRowResize="True" AllowColumnResize="True" />
                    <ClientMessages DragToGroupOrReorder="Drag to group" />
                </ClientSettings>
                <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
                </HeaderContextMenu>
            </telerik:RadGrid>


Rendering:
<table class="rgMasterTable" border="0" id="ctl00_m_g_b8cf9c0d_003b_4572_a197_c425836f7d6f_ctl00_AXXRadGrid_ctl00" style="width:100%;table-layout:auto;empty-cells:show;">
    <colgroup>
        <col style="width:60px">
        <col style="width:60px">
        <col style="width:60px">
        <col style="width:60px">
        <col style="width:60px">
        <col style="width:60px">
        <col style="width:60px">
        <col style="width:60px">
        <col style="width:60px">
        <col style="width:60px">
        <col style="width:60px">
        <col style="width:60px">
        <col style="width:60px">
    </colgroup>
<thead>
        <tr style="background-color:#EF5D63;display:none;">
            <th scope="col"><a title="Click here to sort" href="javascript:__doPostBack('ctl00$m$g_b8cf9c0d_003b_4572_a197_c425836f7d6f$ctl00$AXXRadGrid$ctl00$ctl02$ctl02$ctl00','')">SR Number</a></th><th scope="col"><a title="Click here to sort" href="javascript:__doPostBack('ctl00$m$g_b8cf9c0d_003b_4572_a197_c425836f7d6f$ctl00$AXXRadGrid$ctl00$ctl02$ctl02$ctl01','')">Client Name</a></th><th scope="col"><a title="Click here to sort" href="javascript:__doPostBack('ctl00$m$g_b8cf9c0d_003b_4572_a197_c425836f7d6f$ctl00$AXXRadGrid$ctl00$ctl02$ctl02$ctl02','')">Column 1</a></th><th scope="col"><a title="Click here to sort" href="javascript:__doPostBack('ctl00$m$g_b8cf9c0d_003b_4572_a197_c425836f7d6f$ctl00$AXXRadGrid$ctl00$ctl02$ctl02$ctl03','')">Column 2</a> <input type="button" name="ctl00$m$g_b8cf9c0d_003b_4572_a197_c425836f7d6f$ctl00$AXXRadGrid$ctl00$ctl02$ctl02$ctl04" value=" " onclick="javascript:__doPostBack('ctl00$m$g_b8cf9c0d_003b_4572_a197_c425836f7d6f$ctl00$AXXRadGrid$ctl00$ctl02$ctl02$ctl04','')"></th><th scope="col"><a title="Click here to sort" href="javascript:__doPostBack('ctl00$m$g_b8cf9c0d_003b_4572_a197_c425836f7d6f$ctl00$AXXRadGrid$ctl00$ctl02$ctl02$ctl05','')">Column 3</a></th><th scope="col"><a title="Click here to sort" href="javascript:__doPostBack('ctl00$m$g_b8cf9c0d_003b_4572_a197_c425836f7d6f$ctl00$AXXRadGrid$ctl00$ctl02$ctl02$ctl06','')">Column 4</a></th><th scope="col"><a title="Click here to sort" href="javascript:__doPostBack('ctl00$m$g_b8cf9c0d_003b_4572_a197_c425836f7d6f$ctl00$AXXRadGrid$ctl00$ctl02$ctl02$ctl07','')">Column 5</a></th><th scope="col"><a title="Click here to sort" href="javascript:__doPostBack('ctl00$m$g_b8cf9c0d_003b_4572_a197_c425836f7d6f$ctl00$AXXRadGrid$ctl00$ctl02$ctl02$ctl08','')">Column 6</a></th><th scope="col"><a title="Click here to sort" href="javascript:__doPostBack('ctl00$m$g_b8cf9c0d_003b_4572_a197_c425836f7d6f$ctl00$AXXRadGrid$ctl00$ctl02$ctl02$ctl09','')">Column 7</a></th><th scope="col"><a title="Click here to sort" href="javascript:__doPostBack('ctl00$m$g_b8cf9c0d_003b_4572_a197_c425836f7d6f$ctl00$AXXRadGrid$ctl00$ctl02$ctl02$ctl10','')">Column 8</a></th><th scope="col"><a title="Click here to sort" href="javascript:__doPostBack('ctl00$m$g_b8cf9c0d_003b_4572_a197_c425836f7d6f$ctl00$AXXRadGrid$ctl00$ctl02$ctl02$ctl11','')">Column 9</a></th><th scope="col"><a title="Click here to sort" href="javascript:__doPostBack('ctl00$m$g_b8cf9c0d_003b_4572_a197_c425836f7d6f$ctl00$AXXRadGrid$ctl00$ctl02$ctl02$ctl12','')">Column 10</a></th><th scope="col"><a title="Click here to sort" href="javascript:__doPostBack('ctl00$m$g_b8cf9c0d_003b_4572_a197_c425836f7d6f$ctl00$AXXRadGrid$ctl00$ctl02$ctl02$ctl13','')">Column 11</a></th>
        </tr>
    </thead><tfoot>
        <tr class=" rgPager">
            <td colspan="13"><table summary="Data pager which controls on which page is the RadGrid control." border="0" style="width:100%;border-spacing:0;">
                <caption>
                    <span style="display: none">Data pager</span>
                </caption><thead>
                    <tr>
                        <th scope="col"></th>
                    </tr>
                </thead><tbody>
                    <tr>
                        <td class="rgPagerCell NextPrev"><div class="rgWrap rgArrPart1">
                            Change page: <input type="button" name="ctl00$m$g_b8cf9c0d_003b_4572_a197_c425836f7d6f$ctl00$AXXRadGrid$ctl00$ctl03$ctl01$ctl02" value=" " onclick="return false;WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$m$g_b8cf9c0d_003b_4572_a197_c425836f7d6f$ctl00$AXXRadGrid$ctl00$ctl03$ctl01$ctl02", "", true, "", "", false, true))" title="First Page" class="rgPageFirst"> <input type="button" name="ctl00$m$g_b8cf9c0d_003b_4572_a197_c425836f7d6f$ctl00$AXXRadGrid$ctl00$ctl03$ctl01$ctl03" value=" " onclick="return false;WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$m$g_b8cf9c0d_003b_4572_a197_c425836f7d6f$ctl00$AXXRadGrid$ctl00$ctl03$ctl01$ctl03", "", true, "", "", false, true))" title="Previous Page" class="rgPagePrev"><input type="button" name="ctl00$m$g_b8cf9c0d_003b_4572_a197_c425836f7d6f$ctl00$AXXRadGrid$ctl00$ctl03$ctl01$ctl04" value=" " onclick="return false;WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$m$g_b8cf9c0d_003b_4572_a197_c425836f7d6f$ctl00$AXXRadGrid$ctl00$ctl03$ctl01$ctl04", "", true, "", "", false, true))" title="Next Page" class="rgPageNext">  <input type="button" name="ctl00$m$g_b8cf9c0d_003b_4572_a197_c425836f7d6f$ctl00$AXXRadGrid$ctl00$ctl03$ctl01$ctl05" value=" " onclick="return false;WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$m$g_b8cf9c0d_003b_4572_a197_c425836f7d6f$ctl00$AXXRadGrid$ctl00$ctl03$ctl01$ctl05", "", true, "", "", false, true))" title="Last Page" class="rgPageLast">
                        </div><div class="rgWrap rgInfoPart">
                              Page <strong>1</strong> of <strong>1</strong>, items <strong>0</strong> to <strong>0</strong> of <strong>0</strong>.
                        </div></td>
                    </tr>
                </tbody>
            </table></td>
        </tr>
    </tfoot><tbody>
    <tr class="rgNoRecords">
        <td colspan="13" style="text-align:left;"><div>No records to display.</div></td>
    </tr>
    </tbody>
 
</table>

Katie
Top achievements
Rank 1
 asked on 10 Mar 2014
2 answers
267 views
All Im trying to do is pass a default value to the bound EDICustomerID feild so that when a new code is created via the radgrids 'add new record' it gets the value from the querystring Which holds the EDICustomerID that all codes belong to. 
What is the cleanest / best practice way to get the default value to be a value from the querystring?

I tried the following but while it didn't throw an error, it didn't work, either:
ASPX:
<asp:ObjectDataSource ID="ods_EDICustomerCodes" runat="server"
  SelectMethod="SelectEDICustomerCode"
  InsertMethod="InsertEDICustomerCode"
  UpdateMethod="UpdateEDICustomerCode"
  DeleteMethod="DeleteEDICustomerCode"
  TypeName="App.BLLEDIIntegration.DS.EDICustomerCodeDS"
  DataObjectTypeName="App.BLLEDIIntegration.Models.EDICustomerCodeObj">
   <SelectParameters>
     <asp:QueryStringParameter DefaultValue="0" Name="EDICustomerID"
       QueryStringField="EDICustomerID" Type="Int32" />
     <asp:Parameter DefaultValue="1" Name="active" Type="Int32" />
   </SelectParameters>
</asp:ObjectDataSource>
 
<telerik:RadGrid ID="RadGrid1" AllowAutomaticDeletes="True" AllowAutomaticInserts="True"
  AllowAutomaticUpdates="True" OnItemInserted="ItemInserted" OnItemUpdated="ItemUpdated"
  OnItemDeleted="ItemDeleted" OnPreRender="PreRender" OnBatchEditCommand="BatchEdit"
  DataSourceID="ods_EDICustomerCodes" runat="server" AutoGenerateColumns="False"
  Skin="Windows7" GridLines="Both" AutoGenerateDeleteColumn="True" >
 
  <MasterTableView CommandItemDisplay="TopAndBottom" EditMode="Batch" DataKeyNames="EDICustomerCodeID"
    OverrideDataSourceControlSorting="true" DataSourceID="ods_EDICustomerCodes">
    <BatchEditingSettings EditType="Row" />
 
     <Columns>
       <telerik:GridBoundColumn DataField="EDICustomerCodeID"
         HeaderText="EDICustomerCodeID"
         UniqueName="EDICustomerCodeID" DataType="System.Int32" Display="false"
         ReadOnly="true">
       </telerik:GridBoundColumn>
       <telerik:GridBoundColumn DataField="EDICustomerID" DataType="System.Int32"
         HeaderText="EDICustomerID"
         UniqueName="EDICustomerID" Display="False" DefaultInsertValue='<%= Request["EDICustomerID"] %>'>
       </telerik:GridBoundColumn>
       <telerik:GridBoundColumn DataField="EDICustomerCode" 
         HeaderText="EDICustomerCode"
         UniqueName="EDICustomerCode">
       </telerik:GridBoundColumn>
       <telerik:GridBoundColumn DataField="Priority" DataType="System.Int32"
         HeaderText="Priority"
         UniqueName="Priority">
       </telerik:GridBoundColumn>
       <telerik:GridBoundColumn DataField="Active" DataType="System.Int32"
         Display="False" HeaderText="Active"
         UniqueName="Active">
       </telerik:GridBoundColumn>
    </Columns>
  </MasterTableView>
</telerik:RadGrid>

objectDataSource(c#):
namespace App.BLLEDIIntegration.DS {
  public class EDICustomerCodeDS {
 
    // Select
    public List<EDICustomerCodeObj> SelectEDICustomerCode( int EDICustomerID, int active ) {
      List<EDICustomerCodeObj> customerCodes = BLLData.RetrieveList<EDICustomerCodeObj>(                                   true"EDIIntegration!GetEDICustomerCodes",
        new BLLParameterList( "@EDICustomerID", EDICustomerID, "@Active", active ) );
      return customerCodes;
    }
 
    // Insert
    public void InsertEDICustomerCode(EDICustomerCodeObj cc){
      BLLData.SaveData( true, "EDIIntegration!AddCodeToEDICustomer",
        new BLLParameterList( "@EDICustomerID", cc.EDICustomerID,
              
"@EDICustomerCode", cc.EDICustomerCode,
              "@Priority", cc.Priority,
              "@Active", 1
          ) );
    }
 
    // Update
    public void UpdateEDICustomerCode(EDICustomerCodeObj cc) {
      BLLData.SaveData(true,"EDIIntegration!UpdateEDICustomerCode",
        new BLLParameterList("@EDICustomerCodeID", cc.EDICustomerCodeID,
          "@EDICustomerID", cc.EDICustomerID,
          "@EDICustomerCode", cc.EDICustomerCode,
          "@Priority", cc.Priority,
          "@Active", cc.Active
        ) );
    }
 
    // Delete
    public void DeleteEDICustomerCode(EDICustomerCodeObj cc) {
      BLLData.SaveData( true, "EDIIntegration!DeactivateEDICustomerCode",
        new BLLParameterList( "@EDICustomerCodeID", cc.EDICustomerCodeID ) );
    }
  }
}

And finally the object its self:
namespace App.BLLEDIIntegration.Models {
  [Serializable]
  public partial class EDICustomerCodeObj {
    public int EDICustomerCodeID { get; set; }
    public int EDICustomerID { get; set; }
    public string EDICustomerCode { get; set; }
    public int Priority { get; set; }
    public int Active { get; set; }
  }
}

Michael
Top achievements
Rank 1
 answered on 10 Mar 2014
1 answer
149 views
I have a screen where I have a treeview that loads 

 foreach (var user in allUsers)
            {
                var claims = db.AspNetUserClaims.Where(c => c.User_Id == user.Id);
                foreach (var claim in claims)
                {
                    if (claim.ClaimType == ClaimTypes.Role)
                    {
                        for (int i = 0; i < UserTree.Nodes.Count; i++)
                            if (claim.ClaimValue == UserTree.Nodes[i].Text)
                            {
                                var userNode = new RadTreeNode(user.UserName, user.Id);
                                UserTree.Nodes[i].Nodes.Add(userNode);
                            }
                    }
                }
            }

This loads fine when I click  + for the parent it expands to show the children.  This all works the issue is on the NodeClick event.  The very first time I click on a node it reloads the page and never runs the NodeClick Event.  After this one time event everything works properly.  I can expand and contract nodes and when I click on a node it rune the node click properly.  It is just the initial node click after the page loads that has this behavior.


Eric Klein
Top achievements
Rank 1
 answered on 10 Mar 2014
3 answers
176 views
Hi Gurus,

  I am dynamically calling a usercontrol,

  my issue is,when i click the paging button,the control is not loading (i need to use custom paging not built in paging)

Here is the code:

Default.aspx

------------------

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="DynamicControls._Default" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<asp:ScriptManager ID="Sc1" runat="server">
</asp:ScriptManager>
<table>
<tr>
<td>
<telerik:RadTabStrip runat="server" ID="rdTabMessages" Skin="MetroTouch" EnableEmbeddedSkins="False"
CssClass="Tabcontrols_left" MultiPageID="RadMultiPage1" Orientation="VerticalLeft"
SelectedIndex="0" OnTabClick="tabClick">
<Tabs>
<telerik:RadTab TabIndex="0" CssClass="appointments" Text="Control1">
</telerik:RadTab>
<telerik:RadTab TabIndex="1" CssClass="appointments" Text="Control2">
</telerik:RadTab>
<telerik:RadTab TabIndex="2" CssClass="appointments" Text="Control3">
</telerik:RadTab>
</Tabs>
</telerik:RadTabStrip>
</td>
<td>
<telerik:RadMultiPage runat="server" ID="RadMultiPage1" SelectedIndex="0" CssClass="Tacontrols_right">
<telerik:RadPageView runat="server" ID="RadPageView1">
<asp:Panel ID="pnlConfiguration" runat="server">
This is Control1
</asp:Panel>
</telerik:RadPageView>
<telerik:RadPageView runat="server" ID="RadPageView2">
<asp:Panel ID="pnlWebPages" runat="server">
This is Control2
</asp:Panel>
</telerik:RadPageView>
<telerik:RadPageView runat="server" ID="RadPageView3">
<asp:Panel ID="pnlTestimonial" runat="server">
</asp:Panel>
</telerik:RadPageView>
</telerik:RadMultiPage>
</td>
</tr>
</table>
</asp:Content>



CodeBehind

----------------

protected void tabClick(object sender, RadTabStripEventArgs e)
{
if (e.Tab.TabIndex == 0)
{
//e.Tab.Selected = true;
}
if (e.Tab.TabIndex == 1)
{

}
if (e.Tab.TabIndex == 2)
{

pnlTestimonial.Controls.Clear();
string controlPath = "~/Controls/RadSchedulerCS.ascx";
RadSchedulerCS uc = (RadSchedulerCS)LoadControl(controlPath);
uc.ID = "RadScheduler";
uc.BindGrid(1);
pnlTestimonial.Controls.Add(uc);

//if (uc != null)
//{
// DataList dlPager = (DataList)uc.FindControl("dlPager");
// if (dlPager != null)
// {
// LinkButton lnkPageNo = (LinkButton)dlPager.FindControl("lnkPageNo");
// dlPager.ItemCommand += new DataListCommandEventHandler(dlPager_ItemCommand);

// }
//}

}


}

protected void dlPager_ItemCommand(object source, DataListCommandEventArgs e)
{

pnlTestimonial.Controls.Clear();
string controlPath = "~/Controls/RadSchedulerCS.ascx";
RadSchedulerCS uc = (RadSchedulerCS)LoadControl(controlPath);
uc.ID = "RadScheduler";
uc.BindGrid(1);
pnlTestimonial.Controls.Add(uc);

}



RadSchedulerCS.ascx

---------------------------

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RadSchedulerCS.ascx.cs" Inherits="DynamicControls.Controls.RadSchedulerCS" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>



<asp:GridView ID="Gv1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField HeaderText="ID">
<ItemTemplate>
<asp:Label ID="lblID" runat="server" Text='<%#Eval("ID") %>' Visible="true"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Name">
<ItemTemplate>
<asp:Label ID="lblName" runat="server" Text='<%# Eval("FName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="DOB">
<ItemTemplate>
<asp:Label ID="lblDOB" runat="server" Text='<%# Eval("DOB") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>

</Columns>
</asp:GridView>
<asp:DataList CellPadding="5" RepeatDirection="Horizontal" runat="server" ID="dlPager"
OnItemCommand="dlPager_ItemCommand" >
<ItemTemplate>
<asp:LinkButton Enabled='<%#Eval("Enabled") %>' runat="server" ID="lnkPageNo" Text='<%#Eval("Text") %>'
CommandArgument='<%#Eval("Value") %>' CommandName="PageNo" CausesValidation="false"></asp:LinkButton>
</ItemTemplate>
</asp:DataList>



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace DynamicControls.Controls
{
public partial class RadSchedulerCS : System.Web.UI.UserControl
{
#region DECLRATIONS
public delegate void MyCustomHandler(object sender, EventArgs e); //This is for button click
public event MyCustomHandler SomethingClicked;

#endregion


protected void Page_PreRender(object sender, EventArgs e)
{
// Workaround to prevent clicking twice on the pager to have results displayed properly
this.Gv1.DataBind();
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindGrid(1);
}
}
public void BindGrid(int currentPage)
{
List<Employee> empList = new List<Employee>();
empList.Add(new Employee() { ID = 1, FName = "John", DOB = DateTime.Parse("12/11/1971") });
empList.Add(new Employee() { ID = 2, FName = "Mary", DOB = DateTime.Parse("01/17/1961") });
empList.Add(new Employee() { ID = 3, FName = "Amber", DOB = DateTime.Parse("12/23/1971") });
empList.Add(new Employee() { ID = 4, FName = "Kathy", DOB = DateTime.Parse("11/15/1976") });
empList.Add(new Employee() { ID = 5, FName = "Lena", DOB = DateTime.Parse("05/11/1978") });
empList.Add(new Employee() { ID = 6, FName = "John1", DOB = DateTime.Parse("12/11/1971") });
empList.Add(new Employee() { ID = 7, FName = "Mary1", DOB = DateTime.Parse("01/17/1961") });
empList.Add(new Employee() { ID = 8, FName = "Amber1", DOB = DateTime.Parse("12/23/1971") });
empList.Add(new Employee() { ID = 9, FName = "Kathy1", DOB = DateTime.Parse("11/15/1976") });
empList.Add(new Employee() { ID = 10, FName = "Lena1", DOB = DateTime.Parse("05/11/1978") });
empList.Add(new Employee() { ID = 11, FName = "John2", DOB = DateTime.Parse("12/11/1971") });

int TotalCount = empList.Count();

var pgNo = currentPage;
var pgRec = 10;
empList = empList.Skip((pgNo - 1) * pgRec).Take(pgRec).ToList();
Gv1.DataSource = empList;
Gv1.DataBind();
generatePager(TotalCount, pgRec, pgNo);
}



public void generatePager(int totalRowCount, int pageSize, int currentPage)
{
int totalLinkInPage = 3;
int totalPageCount = (int)Math.Ceiling((decimal)totalRowCount / pageSize);
int startPageLink = Math.Max(currentPage - (int)Math.Floor((decimal)totalLinkInPage / 2), 1);
int lastPageLink = Math.Min(startPageLink + totalLinkInPage - 1, totalPageCount);
if ((startPageLink + totalLinkInPage - 1) > totalPageCount)
{
lastPageLink = Math.Min(currentPage + (int)Math.Floor((decimal)totalLinkInPage / 2), totalPageCount);
startPageLink = Math.Max(lastPageLink - totalLinkInPage + 1, 1);
}
List<ListItem> pageLinkContainer = new List<ListItem>();

if (startPageLink != 1)
{
int prevcounts = currentPage - 1;
pageLinkContainer.Add(new ListItem("First", prevcounts.ToString(), currentPage != 1));
}
for (int i = startPageLink; i <= lastPageLink; i++)
{
pageLinkContainer.Add(new ListItem(i.ToString(), i.ToString(), currentPage != i));
}
if (lastPageLink != totalPageCount)
{
int Nextcounts = currentPage + 1;
pageLinkContainer.Add(new ListItem("Last", Nextcounts.ToString(), currentPage != totalPageCount));
}

dlPager.DataSource = pageLinkContainer;
dlPager.DataBind();
}
protected void dlPager_ItemCommand(object source, DataListCommandEventArgs e)
{

if (SomethingClicked != null)
{
SomethingClicked(source, e);
if (e.CommandName == "PageNo")
{
BindGrid(Convert.ToInt32(e.CommandArgument));
}
}

}
class Employee
{
public int ID { get; set; }
public string FName { get; set; }
public DateTime DOB { get; set; }
}

}
}





I need it urgent,how to accomplish this,is any possibilities by using Delegates or any wayz,if so how to do that.

Help me with this.



Thanks in Advance





Boyan Dimitrov
Telerik team
 answered on 10 Mar 2014
2 answers
60 views
Hello, the bug is very easy to reproduce. This is the 4th bug I've found with decorator in one month after start using it with Lightmode rendermode, evidently it is flimsy and needs testing.

.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %>
<!DOCTYPE html>
<html>
<head runat="server">
    <title>Telerik Decorator Bug # 4</title>
    <telerik:RadStyleSheetManager id="RadStyleSheetManager1" runat="server" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
     <Scripts>
     <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
     <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
     <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
      </Scripts>
    </telerik:RadScriptManager>
    <telerik:RadFormDecorator ID="RadFormDecorator1" Runat="server" RenderMode="Classic"
        DecoratedControls="Default, Select" />
    <script type="text/javascript">
        //Put your JavaScript code here.
    </script>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    <div>
         <asp:DropDownList ID="DropDownList1" runat="server">
        </asp:DropDownList>
        <asp:Button ID="Button1" runat="server" Text="Button" />
     </div>
    </form>
</body>
</html>


.cs

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
using System.Data;
using System.Configuration;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;
using System.Collections.Generic;
 
public partial class Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Dictionary<int, string> values = new Dictionary<int, string>();
        for (int i = 0; i < 50; i++)
        {
            values[i] = string.Format("4th Decortor/Select Bug : {0}", i);
        }
        DropDownList1.AppendDataBoundItems = true;
        DropDownList1.Items.Insert(0, new ListItem(""));
        DropDownList1.DataSource = values;
        DropDownList1.DataTextField = "Value";
        DropDownList1.DataValueField = "Key";
        DropDownList1.DataBind();
        DropDownList1.SelectedIndex = -1;
    }
}
Danail Vasilev
Telerik team
 answered on 10 Mar 2014
5 answers
117 views
I am begging for some kind soul to help me here.

I have tried everything I can think of, and I haven't been able to fix this problem.

For some reason, some appointments appear perfectly fine on my Scheduler, and others get cutoff. The code is exactly the same for both appointment creations.

Note: I am creating appointment manually and using the InsertAppointment() method to add them to the Scheduler.

I thought that maybe it was affecting only appointments scheduled in the future from the current date...but when I moved appointments around, I found (as you will see in the attached image) that I was able to see appointment perfectly from the 5th (current date) to the 9th. But starting the 10th, it gets cutoff. It's so BIZARRE...

PLEASE PLEASE Can anyone help me fix this?
Ben
Top achievements
Rank 1
 answered on 10 Mar 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?