Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
84 views
Hello,

if i add a column at runtime in code-behind my layout breaks, i think the attached picture speaks for itself...

EDIT:
only happens with client-side scrolling on!

<ClientSettings>    
<
Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="False">         
</
Scrolling>
</
ClientSettings>




best regards
Eyup
Telerik team
 answered on 24 Jan 2013
2 answers
143 views
I would like to customize the monthview to different a different data than the dayview;
for that i tweaked the Appointment template and the AppointmentCreated event.
My problem is that the month view only shows one line, the title or header of the view and nothing more.
This behavior also messes with the pdf printing as what gets printed is what im seeing on the screen (maybe you should implement a PDFTemplate?)

Here are images of the DayView and the MonthView
Is it possible to have MonthView show what DayView shows?
Or alternatively, is it possible to print a custom set of Appointment fields, different than whats shown on MonthView? (I want to enable printing or pdf exporting on monthview but im having this display issue)
My markup:

              
 <tk:RadScheduler ID="sched" runat="server" AppointmentStyleMode="Default" DayEndTime="19:00:00" AllowInsert="true"                         AllowEdit="true" AllowDelete="true"<br>                    EnableDescriptionField="True" FirstDayOfWeek="Monday" LastDayOfWeek="Friday"<br>                    ShowNavigationPane="true" ShowFooter="true" StartEditingInAdvancedForm="true"<br>                    StartInsertingInAdvancedForm="true" Height="551px"<br>                    OnFormCreated="sched_FormCreated"<br>                    OverflowBehavior="Expand" <br>                    OnAppointmentCommand="sched_AppointmentCommand"<br>                    OnAppointmentCreated="sched_AppointmentCreated"<br>                    OnAppointmentDataBound="sched_AppointmentDataBound"<br>                    OnAppointmentDelete="sched_AppointmentDelete"<br>                    Skin="Web20"><br>                    <MonthView AdaptiveRowHeight="true" /><br>                    <AdvancedForm Modal="true" /><br>                    <ExportSettings OpenInNewWindow="true" FileName="Scheduler"><br>                        <Pdf PageTitle="Calendário" Author="CRA" Creator="CRA" Title="Calendário"></Pdf><br>                    </ExportSettings><br>                    <TimelineView UserSelectable="false" /><br>                    <AppointmentContextMenuSettings EnableDefault="true" /><br>                    <TimeSlotContextMenuSettings EnableDefault="true" /><br>                    <TimeSlotContextMenus><br>                        <tk:RadSchedulerContextMenu ID="SchedulerTimeSlotContextMenu" runat="server"><br>                            <Items><br>                                <tk:RadMenuItem Text="New Appointment" Value="CommandAddAppointment" /><br>                            </Items><br>                        </tk:RadSchedulerContextMenu><br>                    </TimeSlotContextMenus><br>                    <AppointmentContextMenus><br>                        <tk:RadSchedulerContextMenu runat="server" ID="ContextMenu1"><br>                            <Items><br>                                <%--<tk:RadMenuItem Text="Ir para dia" Value="CommandNavigateDay" />--%><br>                                <tk:RadMenuItem Text="Editar" Value="CommandEdit" /><br>                                <tk:RadMenuItem Text="Apagar" Value="CommandDelete" /><br>                                <%--<tk:RadMenuItem Text="Exportar Para PPF" Value="CommandExport"></tk:RadMenuItem>--%><br>                            </Items><br>                        </tk:RadSchedulerContextMenu><br>                    </AppointmentContextMenus><br>                    <AppointmentTemplate><br>                        <asp:Image runat="server" ID="imgRepeat" AlternateText="Repeat" ImageUrl="~/images/repeat.png" Width="15" Height="15" Visible="false"/><br>                        <asp:Label runat="server" ID="lblHeader" Font-Bold="true" /><br>                        <hr /><br>                        <table border="0"><br>                            <tr><br>                                <td style="border-color: transparent;"><span style="font-weight: bold;">Descricao: </span></td><br>                                <td style="border-color: transparent;"><br>                                    <asp:Label ID="lblDescription" runat="server" /></td><br>                            </tr><br>                            <tr><br>                                <td style="border-color: transparent;"><span style="font-weight: bold;">Participantes: </span></td><br>                                <td style="border-color: transparent;"><br>                                    <asp:Label ID="lblParticipants" runat="server" /></td><br>                            </tr><br>                            <tr><br>                                <td style="border-color: transparent;"><span style="font-weight: bold;">Duracao: </span></td><br>                                <td style="border-color: transparent;"><br>                                    <asp:Label ID="lblDates" runat="server" /></td><br>                            </tr><br>                            <tr><br>                                <td style="border-color: transparent;"><span style="font-weight: bold;">Local: </span></td><br>                                <td style="border-color: transparent;"><br>                                    <asp:Label ID="lblLocale" runat="server" /></td><br>                            </tr><br>                        </table><br>                    </AppointmentTemplate><br>                </tk:RadScheduler><br><div></div>


My AppointmentCreated :

 
<div>      protected void sched_AppointmentCreated(object sender, AppointmentCreatedEventArgs e) {<br><br>            using (DBFactory link = new DBFactory()) {<br>                int evtID = int.Parse(e.Appointment.ID.ToString());<br>                if (evtID == 0) {<br>                    evtID = SessionManager.Instance.LastInsertedCalendarEventID;<br>                }<br>                CalendarEvent ce = link.GetCalendarEvent(evtID);<br><br>                Label lblHeader = (Label)e.Container.FindControl("lblHeader");<br>                Label lblDescription = (Label)e.Container.FindControl("lblDescription");<br>                Label lbldates = (Label)e.Container.FindControl("lbldates");<br>                Label lblParticipants = (Label)e.Container.FindControl("lblParticipants");<br>                Label lblLocale = (Label)e.Container.FindControl("lbllocale");<br>                Image imgRepeat = (Image)e.Container.FindControl("imgRepeat");<br>                if (ce.RecurrenceType == "I") {<br>                    imgRepeat.Visible = true;<br>                }<br>                lblLocale.Text = string.Format("{0}", ce.EventLocation1.Location);<br>                lblHeader.Text = string.Format("{0} - {1} ", ce.EventType1.EventTypeName, ce.Subject);<br>                lblDescription.Text = string.Format("{0}", ce.Description);<br>                lbldates.Text = string.Format("{0:hh:mm}h - {1:hh:mm}h", ce.StartDate, ce.EndDate);<br>                lblParticipants.Text = string.Format("{0}", link.GetUsernamesFromEvent(evtID));<br><br>            }<br>        }<br></div>


Also, i had to re-implement recurrence because i couldnt find a good and complete tutorial on how to work with a RecurrenceEditor with templates as im doing.
Plamen
Telerik team
 answered on 24 Jan 2013
3 answers
867 views
Hi,
I would like to be about to validate that the date entered into a date picker control is either blank or a valid date. The examples use a required field validator to check that a valid date is entered. That works fine. But I would like the user to be able to enter a blank date and for that to be valid as well. But if they have entered a date then flag it as an error if the date is invalid.
Princy
Top achievements
Rank 2
 answered on 24 Jan 2013
4 answers
154 views
I have a master detail grid.  For the master grid, I use NeedDataSource.  In addtion, on the ItemDatabound event, I modify some of the columns (ex. I hide some of the command buttons for some rows).

When a row is expanded and DetailTableDataBind is fired, the detail table renders fine.  However, the modifications made to the parent table above via ItemDatabound are lost.  It is as if I need to rebind my parent table.  Have been unable to do that, though without losing my detail table view.

I posted the relevant code below. Any help would be greatly appreciated.  Thanks, Rick

void afterGrid_DetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e)
{
    var dataItem = e.DetailTableView.ParentItem;
     
    var memberId = dataItem.GetDataKeyValue("Id").ToString().ToInteger();
 
    using (var db = new DataContext())
    {
        var toBind = //retrieves the data
 
        e.DetailTableView.DataSource = toBind;
    }
}
 
void afterGrid_ItemDataBound(object sender, GridItemEventArgs e)
{
    //Answers is name of detail data
    if (e.Item is GridDataItem && e.Item.OwnerTableView.Name != "Answers")
    {
        var item = (GridDataItem)e.Item;
        var cell = item["Remind"];
 
        if (cell.IsNotNull())
        {   //dont send if already submitted
            var data = (ReviewMember)item.DataItem;
 
            if (data.SubmitDate.HasValue)
            {
                cell.Controls.Clear();
           }
            else if (data.LastSavedDate.HasValue )
            {
                cell.Controls.Clear();
                cell.Text = "Sent";
            }
        }
    }
    else if (e.Item is GridDataItem && e.Item.OwnerTableView.Name == "Answers")
    {
        var item = (GridDataItem)e.Item;
        var data = (MemberResult)item.DataItem;
        var cell = item["Attach"];
 
        if (data.Question.Type != QuestionTypes.Upload)
        {
            cell.Controls.Clear();
        }
    }
}
 
void afterGrid_ItemCommand(object sender, GridCommandEventArgs e)
{
    if (e.CommandName.Equals("Remind"))
    {
       //do some work       
       afterGrid.Rebind();
    }
    else if (e.CommandName == RadGrid.ExpandCollapseCommandName)
    {
        foreach (GridItem item in e.Item.OwnerTableView.Items)
        {
            if (item.Expanded && item != e.Item)
            {
                item.Expanded = false;
            }
        }
    }
}
Rick Atkinson
Top achievements
Rank 1
 answered on 24 Jan 2013
9 answers
484 views
I have a situation where I have one RadWindow dialog box appearing over top of another RadWindow dialog box. The smaller, topmost one simply provides the user with the ability to add a new item to a DropDown ListBox "on-the-fly".

I'm experiencing something I've never before seen with ASP.Net programming: The button's event handler does not always fire.  It *seems* to fire more consistently when I have a breakpoint in the code, which allows me to debug it in Visual Studio.

I'm posting this quandary in the RadWindow forum because I'm wondering if the presence of the two RadWindows is somehow causing a conflict with the event handling mechanism of ASP.Net.

Might anyone have any ideas how to solve this problem?

Robert
Robert
Top achievements
Rank 1
 answered on 24 Jan 2013
2 answers
121 views
Please take a look at the attached screenshots.  The lowermost dropdown listbox is your RadComboBox.

The first screenshot shows the user selecting an item in the list.  The second screenshot shows the selected item after the list has collapsed.

Both of my questions concern the second screenshot:
  1. How/where can I change how the selected info is displayed?  Ideally I'd like to add some spaces after the "Pass" value (the "240" in the example).  I'd also like to make the "Pass" value bold if I could.
  2. The yellow background highlighting is because of some global jQuery code that automatically sets the background of all textboxes on each form to yellow upon receiving focus and then removes the yellow when focus is lost.  The code looks like this:
            $(":text").focus(TextboxHighlightAndSmartSelect).blur(TextboxRemoveHighlight);
    This works great and has no effect on the traditional DropDownList control.  However, I believe it's doing its thing on your control because of the TextBox component inside it.  Ideally I'd prefer not to mess with the global jQuery code and instead would just like to nullify the added "focus" event handler for the RadComboBox only.  I tried a few things to do this but couldn't figure it out.

Robert

Robert
Top achievements
Rank 1
 answered on 24 Jan 2013
10 answers
734 views
hi
how can i set background=transparent ?
its not fire
thanks
Anbu
Top achievements
Rank 1
 answered on 23 Jan 2013
17 answers
1.7K+ views
Currently, if I populate a combo box with X items, the height of the drop down fits the number of items.  If I provide a list of 1000 items, the drop down makes itself big enough to show all 1000 items.  The only way I have found to limit this is by setting the Height property of the combo box.  However, when I do this I specify something like 300px, but then if I only have 2 items in the list, then I get a big whitespace beneath those 2 items.  Is there something like a "MaxHeight" property that can be set, or a way to make the combo box resize to a certain height?

Thanks
Sara
Sophie
Top achievements
Rank 2
 answered on 23 Jan 2013
5 answers
283 views
Hi

How to give set focus to the content area of the radeditor?
the setfocus method is working in ie but not in chrome.
if i gave the setFocus() it focus on the toolbar(like bold,italic) . not in the content area of editor.
How to give the focus to content area?


thanks in advance. 
geetha.
Jesper Vognsen Laustsen
Top achievements
Rank 2
 answered on 23 Jan 2013
2 answers
653 views
Hi Telerik team,

I have strange problem.

First time page get's loaded with no problem but when I clicked on any page number for paging I got following error:

"Microsoft JScript runtime error: Sys.ArgumentException: Value must not be null for Controls and Behaviors. Parameter name: element"


For paging I am using SetGridData(); method.


Also want to let you know that after commenting following code everything works fine.

 <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                                                                <ClientEvents OnRequestStart="onRequestStart" />
                                                                <AjaxSettings>
                                                                    <telerik:AjaxSetting AjaxControlID="rgTemplates">
                                                                        <UpdatedControls>
                                                                            <telerik:AjaxUpdatedControl ControlID="rgTemplates" />
                                                                            <telerik:AjaxUpdatedControl ControlID="RadSplitter1" />
                                                                        </UpdatedControls>
                                                                    </telerik:AjaxSetting>
                                                                    <telerik:AjaxSetting AjaxControlID="btnSearch">
                                                                        <UpdatedControls>
                                                                            <telerik:AjaxUpdatedControl ControlID="rgTemplates" />
                                                                            <telerik:AjaxUpdatedControl ControlID="btnSearch" />
                                                                            <telerik:AjaxUpdatedControl ControlID="RadSplitter1" />
                                                                        </UpdatedControls>
                                                                    </telerik:AjaxSetting>
                                                                </AjaxSettings>
                                                            </telerik:RadAjaxManager>


But I want to AJAXify.


Here is the ASPX code:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="myBibles.aspx.cs" Inherits="Debut.myBibles"
    MaintainScrollPositionOnPostback="true" EnableEventValidation="false" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Src="usercontrolls/header.ascx" TagName="header" TagPrefix="uc1" %>
<%@ Register Src="usercontrolls/footer.ascx" TagName="footer" TagPrefix="uc3" %>
<%@ Register Src="usercontrolls/leftmenu.ascx" TagName="leftmenu" TagPrefix="uc4" %>
<%@ 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 id="Head1" runat="server">

       <style type="text/css">  
        .AutoHeight  
        {  
            height: auto !important;
        }  
    </style>
    
     <style type="text/css">  
        .AutoHeight1  
        {  
            height: 460px;
        }  
    </style>    

    <title>
        <%# cAppName%>-
        <%# NavGrpMyPrograms%></title>
     
    <link href="css/debutstyle.css" rel="stylesheet" type="text/css" />
    <link href="favicon.ico" rel="shortcut icon" />
    <script language="javascript" src="js/util.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="css/jquery-ui.cache.css" media="all" />
    <script language="javascript" type="text/javascript" src="js/util.js"></script>
    <script language="javascript" type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
    <script language="javascript" type="text/javascript" src="js/jquery-ui-1.8.17.custom.min.js"></script>
    <script language="javascript" type="text/javascript" src="js/deliverables.js"></script>
    <link href="css/util.css" rel="stylesheet" type="text/css" />

     <telerik:RadCodeBlock ID="RadCodeBlock2" runat="server"> 
    <script type="text/javascript">

        function InitAll() {
            $(function () {
                $("#rdPremDtFrom").datepicker({
                    changeMonth: true,
                    changeYear: true
                });
            });
            $(function () {
                $("#rdPremDtTo").datepicker({
                    changeMonth: true,
                    changeYear: true
                });
            });
            $(function () {
                $("#rdSubDtFrom").datepicker({
                    changeMonth: true,
                    changeYear: true
                });
            });
            $(function () {
                $("#rdSubDtTo").datepicker({
                    changeMonth: true,
                    changeYear: true
                });
            });
        }

        function onMyProgramsSort(iCol, iDir) {
            document.getElementById("sortcol").value = iCol;
            document.getElementById("sortdir").value = iDir;
            document.forms[0].submit();
        }

        function onMyTasksSort(iCol, iDir) {
            document.forms[0].txtMyTasksSortCol.value = iCol;
            document.forms[0].txtMyTasksSortDir.value = iDir;
            document.forms[0].submit();
        }


        function datevalidation(frm, to) {

            var ddstrfrm = frm.value;
            var ddstrto = to.value;

            if ((ddstrfrm != "") && (ddstrto != "")) {
                var ddfrm = new Date(ddstrfrm);
                var ddto = new Date(ddstrto);
                if (ddfrm > ddto) {
                    alert('From date must be less than or equal to To date.');
                    to.value = "";
                }

            }

        }
       
    </script>

    </telerik:RadCodeBlock>

     <telerik:RadCodeBlock ID="RadCodeBlock3" runat="server"> 
    <script type="text/javascript">

        function onRequestStart(sender, args) {
            if (args.get_eventTarget().indexOf("ExportToExcelButton") >= 0 ||
                    args.get_eventTarget().indexOf("ExportToWordButton") >= 0 ||
                    args.get_eventTarget().indexOf("ExportToCsvButton") >= 0) {
                args.set_enableAjax(false);
            }
        }
       
    </script>
    
    </telerik:RadCodeBlock>

    
      
</head>
<body>
    <form id="frmMyProgram" runat="server">

    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> 
        <script type="text/javascript">
           
            function RadSlidingPane1_Expanding(sender, eventArgs) {
                var slidingZone = $find("<%= SlidingZone1.ClientID %>");

                alert(slidingZone);

                slidingZone.dockPane(sender.get_id());
                eventArgs.set_cancel(true);
            }


            function undocpane(sender, eventArgs) {

                var slidingZone = $find("<%= SlidingZone1.ClientID %>");

                alert(slidingZone);

                var dockedPaneId = slidingZone.get_dockedPaneId();
                var slidingPaneId = document.getElementById("RadSlidingPane1")

                if (slidingPaneId != null && slidingPaneId != dockedPaneId) {
                    slidingZone.undockPane(slidingPaneId.id);
                }
            }


            function SplitterLoaded(splitter, arg) {
                var pane = splitter.getPaneById('<%= Radpane2.ClientID %>');

                alert(pane);

                var height = pane.getContentElement().scrollHeight;
                splitter.set_height(height);
                pane.set_height(height);
            }

</script>

</telerik:RadCodeBlock>

    <script type="text/javascript" src="js/wz_tooltip2.js"></script>
    <script type="text/javascript" src="js/wz_tooltip2.js"></script>
    <asp:HiddenField ID="sortcol" runat="server" Value="" />
    <asp:HiddenField ID="sortdir" runat="server" Value="" />
    <asp:HiddenField ID="txtMyTasksSortCol" runat="server" Value="" />
    <asp:HiddenField ID="txtMyTasksSortDir" runat="server" Value="" />
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse;
        width: 100%;">
        <uc1:header ID="header2" runat="server" />
        <tr>
            <td class="left-nav">
                <uc4:leftmenu ID="leftmenu1" runat="server" />
            </td>
            <td style="padding: 15px" align="left" valign="top">
                <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse"
                    width="100%">
                    <tr>
                        <td width="100%">

                            <div id='formattedPrint'>
                                <p class="page-title-program">
                                    <%# NavGrpMyPrograms%>
                                </p>
                                <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%">
                                    <tr>
                                        <td height="100%">
                                           
                                            <div class="subtitle1">
                                                <asp:Label runat="server" ID="lblhead">Rights Bibles for Approval</asp:Label>
                                            </div>

                                            <div class="body">
                                                <asp:Label runat="server" ID="lblpageinfo">Click on a Program/Episode to view summary information about the program.</asp:Label>
                                            </div>
                                            <table border="0" cellpadding="0" cellspacing="0" 
                                                style="border-collapse: collapse; " width="100%">
                                                <tr>
                                                    <td width="100%" style="height:auto">
                                                        <div id='Div2' style="display: block;">


                                                            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                                                                <ClientEvents OnRequestStart="onRequestStart" />
                                                                <AjaxSettings>
                                                                    <telerik:AjaxSetting AjaxControlID="rgTemplates">
                                                                        <UpdatedControls>
                                                                            <telerik:AjaxUpdatedControl ControlID="rgTemplates" />
                                                                            <telerik:AjaxUpdatedControl ControlID="RadSplitter1" />
                                                                        </UpdatedControls>
                                                                    </telerik:AjaxSetting>
                                                                    <telerik:AjaxSetting AjaxControlID="btnSearch">
                                                                        <UpdatedControls>
                                                                            <telerik:AjaxUpdatedControl ControlID="rgTemplates" />
                                                                            <telerik:AjaxUpdatedControl ControlID="btnSearch" />
                                                                            <telerik:AjaxUpdatedControl ControlID="RadSplitter1" />
                                                                        </UpdatedControls>
                                                                    </telerik:AjaxSetting>
                                                                </AjaxSettings>
                                                            </telerik:RadAjaxManager>


                                                            <telerik:RadSplitter ID="RadSplitter1" runat="server" Width="100%"  
                                                                 CssClass="AutoHeight"  onclientload="SplitterLoaded">
                                                                <telerik:RadPane ID="LeftPane" runat="server" Width="15px" Scrolling="none">
                                                                    <telerik:RadSlidingZone ID="SlidingZone1" runat="server" Width="15px" 
                                                                        ClickToOpen="True" Visible="true" Height="100%">
                                                                        <telerik:RadSlidingPane ID="RadSlidingPane1" Title="Search Filters" 
                                                                            runat="server" OnClientExpanding="RadSlidingPane1_Expanding" 
                                                                            Width="215px" >
                                                                                    <table>
                                                                                        <tr>
                                                                                            <td>
                                                                                                <asp:Label CssClass="aspLabel" ID="lblProdCompany" runat="server" Text="Production Company:"></asp:Label><br />
                                                                                                <asp:TextBox CssClass="aspTextBox" ID="txtProdCompany" runat="server"></asp:TextBox>
                                                                                            </td>
                                                                                        </tr>
                                                                                        <tr>
                                                                                            <td>
                                                                                                <asp:Label CssClass="aspLabel" ID="lblSeries" runat="server" Text="Series:"></asp:Label><br />
                                                                                                <asp:TextBox CssClass="aspTextBox" ID="txtSeries" runat="server"></asp:TextBox>
                                                                                            </td>
                                                                                        </tr>
                                                                                        <tr>
                                                                                            <td>
                                                                                                <asp:Label CssClass="aspLabel" ID="lblProgID" runat="server" Text="Program ID:"></asp:Label><br />
                                                                                                <asp:TextBox CssClass="aspTextBox" ID="txtProgID" runat="server"></asp:TextBox>
                                                                                            </td>
                                                                                        </tr>
                                                                                        <tr>
                                                                                            <td>
                                                                                                <asp:Label CssClass="aspLabel" ID="lblProgName" runat="server" Text="Program Name:"></asp:Label><br />
                                                                                                <asp:TextBox CssClass="aspTextBox" ID="txtProgName" runat="server"></asp:TextBox>
                                                                                            </td>
                                                                                        </tr>
                                                                                        <tr>
                                                                                            <td>
                                                                                                <asp:Label CssClass="aspLabel" ID="lblProgType" runat="server" Text="Program Type:"></asp:Label><br />
                                                                                                <asp:DropDownList CssClass="aspDropDownList" ID="ddlProgType" runat="server">
                                                                                                    <asp:ListItem></asp:ListItem>
                                                                                                    <asp:ListItem>Long Form</asp:ListItem>
                                                                                                    <asp:ListItem>Short Form</asp:ListItem>
                                                                                                </asp:DropDownList>
                                                                                            </td>
                                                                                        </tr>
                                                                                        <tr>
                                                                                            <td>
                                                                                                <asp:Label CssClass="aspLabel" ID="lblReviewer" runat="server" Text="Reviewer Name:"></asp:Label><br />
                                                                                                <asp:DropDownList CssClass="aspDropDownList" ID="ddlReviewer" runat="server">
                                                                                                </asp:DropDownList>
                                                                                            </td>
                                                                                        </tr>
                                                                                        <tr>
                                                                                            <td>
                                                                                                <asp:Label CssClass="aspLabel" ID="lblSubmittedDate" runat="server" Text="Submitted Date:"></asp:Label><br />
                                                                                                <asp:TextBox ID="rdSubDtFrom" runat="server" CssClass="aspTextBoxDateFrom"></asp:TextBox>
                                                                                                <asp:Label CssClass="aspLabel0" ID="Label2" runat="server" Text="to"></asp:Label>
                                                                                                <asp:TextBox ID="rdSubDtTo" runat="server" CssClass="aspTextBoxDateTo"></asp:TextBox>
                                                                                            </td>
                                                                                        </tr>
                                                                                        <tr>
                                                                                            <td>
                                                                                                <asp:Label CssClass="aspLabel" ID="lblPremiereDate" runat="server" Text="Premiere Date:"></asp:Label><br />
                                                                                                <asp:TextBox ID="rdPremDtFrom" runat="server" CssClass="aspTextBoxDateFrom"></asp:TextBox>
                                                                                                <asp:Label CssClass="aspLabel0" ID="Label1" runat="server" Text="to"></asp:Label>
                                                                                                <asp:TextBox ID="rdPremDtTo" runat="server" CssClass="aspTextBoxDateTo"></asp:TextBox>
                                                                                                <br />
                                                                                            </td>
                                                                                        </tr>                                                                                       
                                                                                    </table>
                                                                            <table>
                                                                            <tr><td>&nbsp;</td></tr>
                                                                            <tr><td>&nbsp;</td></tr>
                                                                                <tr>
                                                                                    <td style="padding-left:10px;">                                                                                       
                                                                                        <asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click" />
                                                                                    </td>
                                                                                </tr>
                                                                            </table>
                                                                        </telerik:RadSlidingPane>
                                                                    </telerik:RadSlidingZone>
                                                                </telerik:RadPane>
                                                                        <telerik:RadPane ID="Radpane2" runat="server" Scrolling="none" >
                                                                           <div style="padding: 1px; width: 99.5%; height: 100%;">
                                                                                <telerik:RadGrid ID="rgTemplates" runat="server" AllowPaging="True" AllowSorting="True"
                                                                                    CellSpacing="0" GridLines="None" Width="99.8%"  AutoGenerateColumns="False"
                                                                                    ShowStatusBar="True" Skin="Office2010Silver" OnPageIndexChanged="rgTemplates_PageIndexChanged"
                                                                                    OnSortCommand="rgTemplates_SortCommand" PageSize="50" 
                                                                                    OnItemCommand="rgTemplate_ItemCommand" CssClass="AutoHeight">
                                                                                    <PagerStyle Mode="NumericPages"></PagerStyle>
                                                                                    <ClientSettings EnableAlternatingItems="False">
                                                                                        <Selecting CellSelectionMode="None" />
                                                                                        <ClientMessages ColumnResizeTooltipFormatString="" />
                                                                                        <Scrolling AllowScroll="false" UseStaticHeaders="false" />
                                                                                        <Resizing AllowColumnResize="false" ShowRowIndicatorColumn="false" />
                                                                                    </ClientSettings>
                                                                                    <AlternatingItemStyle Font-Names="Tahoma" Font-Size="8pt" />
                                                                                    
                                                                                    
                                                                                    <MasterTableView GridLines="Both" CommandItemDisplay="Top" Width="100%">
                                                                                        <CommandItemSettings ExportToPdfText="Export to PDF" ShowExportToExcelButton="true"
                                                                                            ShowAddNewRecordButton="false" ShowRefreshButton="false"></CommandItemSettings>
                                                                                        <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                                                                                        </RowIndicatorColumn>
                                                                                        <ExpandCollapseColumn Visible="false" FilterControlAltText="Filter ExpandColumn column">
                                                                                        </ExpandCollapseColumn>
                                                                                        <EditFormSettings>
                                                                                            <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                                                                                            </EditColumn>
                                                                                        </EditFormSettings>
                                                                                        <HeaderStyle Font-Bold="True" Font-Size="9pt" />
                                                                                    </MasterTableView>

                                                                                    <HeaderStyle BorderColor="#E0E0E0" BorderStyle="Solid" BorderWidth="1px" Font-Names="Tahoma"
                                                                                        ForeColor="Gray" Height="12px" Font-Bold="True" />
                                                                                    <ItemStyle BorderColor="#E3E8E7" BorderStyle="Solid" BorderWidth="1px" Font-Names="Tahoma"
                                                                                        Font-Size="8pt" />
                                                                                    <FilterMenu EnableImageSprites="False">
                                                                                    </FilterMenu>
                                                                                </telerik:RadGrid>
                                                                          </div>
                                                                        </telerik:RadPane>

                                                            </telerik:RadSplitter>
                                                        </div>

                                                    </td>
                                                </tr>
                                            </table>
                                            <br />
             
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td class="left-nav">
                &nbsp;
            </td>
            <td>
                <uc3:footer ID="footer2" runat="server" />
            </td>
        </tr>
    </table>
    </form>
</body>

<script language="javascript" type="text/javascript">
    if (document.getElementById('smenu3'))
        document.getElementById('smenu3').style.display = 'none';
    if (document.getElementById('smenu4'))
        document.getElementById('smenu4').style.display = 'none';
</script>
</html>


Here is code behind page:


public partial class myBibles : System.Web.UI.Page
    {
        public string cAppName = string.Empty;
        public string NavGrpMyPrograms = "cNavGrpIndexLogin";
        public string sRequired = string.Empty;
        public string ProductionCompanyDisplayNm = string.Empty;
        public bool RoleSysID = false;
        public string PageDoMyTasks = string.Empty;
        public string PageMyProgramsArchive = string.Empty;
        public string strHelp = string.Empty;
        public string strHelpTitle = string.Empty;
        public int iReviewerSysID = 0;

        dbutils ut = new dbutils();
        constants ct = new constants();
        StringBuilder sb = new StringBuilder();
        HelpPopup hp = new HelpPopup();
        logincheck lc = new logincheck();
        //JG-630
        Reviewer tsInfo = new Reviewer();
        ADPageUserAccess adpa = new ADPageUserAccess();
       String strusersysid = string.Empty;


        protected void Page_Load(object sender, EventArgs e)
        {                    
            if (!ct.CheckSessionExist())
            {
                Response.Redirect(ct.CPagelogin);
            }
            
            if (!IsPostBack)
            {
                SetReviewrCombo();

                //To display the login Reviewers data.
                strusersysid = ct.getSessionInt("UserSysID").ToString();

                if (strusersysid != "")
                {
                    //ddlReviewer.SelectedValue =  strusersysid; // Kim Zena = "2142";
                }
                                                              
                //JG-630.
                //SlidingZone1.DockedPaneId = "RadSlidingPane1";
                setGridHeaders();                
                //loaddata();
                doSearch();
            }
            cAppName = ct.CAppName;
            //ProductionCompanyDisplayNm = ct.getSessionstring("ProductionCompanyDisplayNm");
            RoleSysID = ct.getSessionInt("RoleSysID") != ct.GcAETNReviewer;
            PageDoMyTasks = ct.CPageDoMyTasks;
            
            PageMyProgramsArchive = ct.CPageMyBiblesArchive; //ct.CPageMyProgramsArchive;
            NavGrpMyPrograms = ct.CNavGrpMyPrograms;

            strHelp = hp.displayHelp(HelpPopup.HelpConstants.gcHelpMyPrograms);
            strHelpTitle = hp.displayHelpTitle(true, HelpPopup.HelpConstants.gcHelpMyPrograms);

            //Escape sequence for '.
            strHelp = strHelp.Replace("'", "\\'"); 
   
            rdSubDtFrom.Attributes.Add("onchange", "datevalidation(" + rdSubDtFrom.ClientID + "," + rdSubDtTo.ClientID + ");");
            rdSubDtTo.Attributes.Add("onchange", "datevalidation(" + rdSubDtFrom.ClientID + "," + rdSubDtTo.ClientID + ");");

            rdPremDtFrom.Attributes.Add("onchange", "datevalidation(" + rdPremDtFrom.ClientID + "," + rdPremDtTo.ClientID + ");");
            rdPremDtTo.Attributes.Add("onchange", "datevalidation(" + rdPremDtFrom.ClientID + "," + rdPremDtTo.ClientID + ");");

            btnSearch.Attributes.Add("onclick", "undocpane();");

            ScriptManager.RegisterStartupScript(this, GetType(), "scriptKey", "InitAll();", true);            
       }


        void SetReviewrCombo()
        {
            try 
            {
                DataTable dt = new DataTable();
                dt = ut.getAETNReviewerList10(iReviewerSysID, 1);

                ddlReviewer.DataSource = dt;
                ddlReviewer.DataValueField = "id";
                ddlReviewer.DataTextField = "text";
                ddlReviewer.DataBind();
                ddlReviewer.Items.Insert(0, "");
            }

            catch (Exception ex)
            {
                ut.WritetoLog(ex.ToString());
            }
            
        }
        
        protected void rgTemplates_PageIndexChanged(object sender, GridPageChangedEventArgs e)
        {
            Session.Add("CPI",e.NewPageIndex);
            SetGridData();
        }

        protected void rgTemplates_SortCommand(object sender, GridSortCommandEventArgs e)
        {
            SetGridData();
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                doSearch();

                SlidingZone1.DockedPaneId = "RadSlidingPane1";
                //RadSlidingPane1
                //SlidingZone1.
               
            }
            catch (Exception ex)
            {
                ut.WritetoLog(ex.ToString());
            }
        }

        
        /// get headers array list for grid from class and sets them
        void setGridHeaders()
        {
            try
            {
                ArrayList al = tsInfo.GetHeaders();
                GridBoundColumn boundColumn;

                foreach (string colhead in al)
                {
                    //Important: first Add column to the collection  
                    boundColumn = new Telerik.Web.UI.GridBoundColumn();
                    this.rgTemplates.MasterTableView.Columns.Add(boundColumn);

                    if (colhead == "Supplier/Production Company")
                    {
                        boundColumn.DataField = "Production_company";
                        //boundColumn.HeaderStyle.Width = Unit.Pixel(260);
                    }
                    else if (colhead == "Series/Specials")
                    {
                        boundColumn.DataField = "Series_name";
                        //boundColumn.HeaderStyle.Width = Unit.Pixel(260);
                    }
                    else if (colhead == "Program ID")
                    {
                        boundColumn.DataField = "Program_ID";
                        boundColumn.HeaderStyle.Width = Unit.Pixel(110);
                        boundColumn.ItemStyle.ForeColor = System.Drawing.Color.Blue;
                        boundColumn.SortExpression = "Prog_ID";
                    }
                    else if (colhead == "Program/Episode")
                    {
                        boundColumn.DataField = "Episode_name";
                        //boundColumn.HeaderStyle.Width = Unit.Pixel(350);
                        boundColumn.ItemStyle.ForeColor = System.Drawing.Color.Blue;
                        boundColumn.SortExpression = "Epi_name";
                    }
                    else if (colhead == "Premiered")
                    {
                        boundColumn.DataField = "Premiere_date";
                        boundColumn.HeaderStyle.Width = Unit.Pixel(105);
                        boundColumn.DataFormatString = "{0: MM/dd/yyyy}";
                        boundColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
                        boundColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
                    }
                    else if (colhead == "Reviewer")
                    {
                        boundColumn.DataField = "Reviewer";
                        boundColumn.HeaderStyle.Width = Unit.Pixel(125);
                    }
                    else if (colhead == "Type")
                    {
                        boundColumn.DataField = "Prog_type";
                        boundColumn.HeaderStyle.Width = Unit.Pixel(95);
                    }
                    else if (colhead == "E&O")
                    {
                        boundColumn.DataField = "EO";
                        boundColumn.HeaderStyle.Width = Unit.Pixel(48);
                        boundColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
                        boundColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
                    }
                    else if (colhead == "MUS")
                    {
                        boundColumn.DataField = "MUS";
                        boundColumn.HeaderStyle.Width = Unit.Pixel(48);
                        boundColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
                        boundColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
                    }
                    else if (colhead == "SS")
                    {
                        boundColumn.DataField = "SS";
                        boundColumn.HeaderStyle.Width = Unit.Pixel(45);
                        boundColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
                        boundColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
                    }
                    else if (colhead == "L&R")
                    {
                        boundColumn.DataField = "LR";
                        boundColumn.HeaderStyle.Width = Unit.Pixel(48);
                        boundColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
                        boundColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
                    }
                    else if (colhead == "Ready")
                    {
                        boundColumn.DataField = "Ready";
                        boundColumn.HeaderStyle.Width = Unit.Pixel(62);
                        boundColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
                        boundColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
                    }

                    else if (colhead == "Submitted")
                    {
                        boundColumn.DataField = "Submit_date";
                        boundColumn.HeaderStyle.Width = Unit.Pixel(110);
                        boundColumn.DataFormatString = "{0: MM/dd/yyyy}";
                        boundColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
                        boundColumn.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
                    }
                    else
                    {
                        boundColumn.DataField = colhead;
                    }
                    boundColumn.ItemStyle.Font.Name = "Tahoma";
                    boundColumn.ItemStyle.Font.Size = FontUnit.Point(9);
                    boundColumn.HeaderText = colhead;                    
                }

            }
            catch (Exception ex)
            {
                ut.WritetoLog(ex.ToString());
            }
        }


        IList<ReviewerTemplate> GetStoredGridData()
        {
            try
            {
                IList<ReviewerTemplate> allReviewer;
                int iDBAvailability = 0;

                //if (ct.getSessionsObject("reviewtemplate") == null)
                //{

                    allReviewer = ut.getReviewerRequiringTemplates(ref iDBAvailability);
                    if (iDBAvailability == 0)
                    {
                        Response.Redirect(ct.CPageMaintenance, false);
                    }

                    ct.setSessionsObject("reviewtemplate", allReviewer);
                //}
                //else
                //{
                //    allReviewer = (IList<ReviewerTemplate>)ct.getSessionsObject("reviewtemplate");
                //}

                return allReviewer;
            }
            catch (Exception ex)
            {
                ut.WritetoLog(ex.ToString());
                return null;
            }
        }


        void doSearch()
        {
            try
            {
                IList<ReviewerTemplate> allpac = GetStoredGridData();
                IList<ReviewerTemplate> searchallpac = new List<ReviewerTemplate>();

                ////search using LINQ and lambda expressions
                var searchpacs = from s in allpac
                                 select s;

                if (txtProdCompany.Text != "")
                {
                    searchpacs = searchpacs.Where(r => r.Production_company.ToLower().Contains(txtProdCompany.Text.ToLower()));
                }

                if (txtSeries.Text != "")
                {
                    searchpacs = searchpacs.Where(r => r.Series_name.ToLower().Contains(txtSeries.Text.ToLower()));
                }
                
                if (txtProgID.Text != "")
                {
                    searchpacs = searchpacs.Where(r => r.Program_ID.ToLower().Contains(txtProgID.Text.ToLower()));
                }

                if (txtProgName.Text != "")
                {
                    searchpacs = searchpacs.Where(r => r.Episode_name.ToLower().Contains(txtProgName.Text.ToLower()));
                }

                if (ddlProgType.SelectedItem.Text != "")
                {
                    searchpacs = searchpacs.Where(r => r.Prog_type.ToLower() == ddlProgType.SelectedItem.Text.ToLower());
                }

                if (ddlReviewer.SelectedItem.Text != "")
                {
                    searchpacs = searchpacs.Where(r => r.Reviewer.ToLower() == ddlReviewer.SelectedItem.Text.ToLower());
                }


                if (rdSubDtFrom.Text != "")
                {                    
                    searchpacs = searchpacs.Where(r => r.Submit_date >= Convert.ToDateTime(rdSubDtFrom.Text));
                }

                if(rdSubDtTo.Text != "")
                {
                    searchpacs = searchpacs.Where(r => r.Submit_date <= Convert.ToDateTime(rdSubDtTo.Text));
                }
               
                if (rdPremDtFrom.Text != "")
                {
                    searchpacs = searchpacs.Where(r => r.Premiere_date >= Convert.ToDateTime(rdPremDtFrom.Text));
                }

                if (rdPremDtTo.Text != "")
                {
                    searchpacs = searchpacs.Where(r => r.Premiere_date <= Convert.ToDateTime(rdPremDtTo.Text));
                }
                                            
                foreach (ReviewerTemplate q in searchpacs)
                {
                    searchallpac.Add(q);
                }


                rgTemplates.MasterTableView.CurrentPageIndex = 0;

                this.rgTemplates.DataSource = searchpacs;

                if (searchallpac.Count < 70 && searchallpac.Count > 0)
                {
                    this.rgTemplates.PageSize = searchallpac.Count;
                }
                else
                {
                    this.rgTemplates.PageSize = 50;
                }

                //if (searchallpac.Count > 0)
                //{
                //    RadSplitter1.Attributes.Add("class", "AutoHeight");
                //    Radpane2.Attributes.Add("class", "AutoHeight");
                //    LeftPane.Attributes.Add("class", "AutoHeight");

                //    //RadSplitter1.CssClass = "AutoHeight";
                //    //Radpane2.CssClass = "AutoHeight";
                //    //LeftPane.CssClass = "AutoHeight";
                //}
                //else
                //{
                //    RadSplitter1.Height = new Unit(460);
                //}

                //this.rgTemplates.PageSize = 50;

                //this.rgTemplates.CssClass = "AutoHeight";
                //RadSplitter1.CssClass = "AutoHeight";

                if (searchallpac.Count == 0 || searchallpac.Count <= 17 )
                {
                    RadSplitter1.CssClass = "AutoHeight1";
                    Radpane2.CssClass = "AutoHeight1";
                    rgTemplates.CssClass = "AutoHeight1";
                }
                else
                {
                    RadSplitter1.CssClass = "AutoHeight";
                    Radpane2.CssClass = "AutoHeight";
                    rgTemplates.CssClass = "AutoHeight";
                }

                this.rgTemplates.Rebind();

                ct.setSessionsObject("reviewtemplate", searchallpac);
            }
            catch (Exception ex)
            {
                ut.WritetoLog(ex.ToString());
            }
        }


        protected void rgTemplate_ItemCommand(object sender, GridCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == RadGrid.ExportToExcelCommandName ||
                    e.CommandName == RadGrid.ExportToWordCommandName ||
                    e.CommandName == RadGrid.ExportToCsvCommandName)
                {
                    rgTemplates.ExportSettings.ExportOnlyData = true;
                    rgTemplates.ExportSettings.IgnorePaging = true;
                    rgTemplates.ExportSettings.OpenInNewWindow = true;
                    rgTemplates.ExportSettings.FileName = "MyBibles";
                    rgTemplates.MasterTableView.ExportToExcel();
                   
                    //Hide the image column "Ready".
                    rgTemplates.MasterTableView.GetColumn("Ready").Visible = false;
    
                    //For Export to Excel.
                    SetGridData();
                }

            }
            catch (Exception ex)
            {
                ut.WritetoLog(ex.ToString());
            }
            
        }


        void SetGridData()
        {
            try
            {
                IList<ReviewerTemplate> mybible = new List<ReviewerTemplate>();

                if (ct.getSessionsObject("reviewtemplate") != null)
                {
                    mybible = (IList<ReviewerTemplate>)ct.getSessionsObject("reviewtemplate");
                }

                //Get the last PAgeindex.
                int getPageindex = 0;
                getPageindex = mybible.Count / rgTemplates.PageSize;

                if (getPageindex == Convert.ToInt16(HttpContext.Current.Session["CPI"]))
                {
                    RadSplitter1.CssClass = "AutoHeight1";
                    Radpane2.CssClass = "AutoHeight1";
                    rgTemplates.CssClass = "AutoHeight1";
                }
                else 
                {
                    RadSplitter1.CssClass = "AutoHeight";
                    Radpane2.CssClass = "AutoHeight";
                    rgTemplates.CssClass = "AutoHeight";
                }

                this.rgTemplates.DataSource = mybible;
                Session.Remove("CPI");
            }
            catch (Exception ex)
            {
                ut.WritetoLog(ex.ToString());
            }
        }

    }




Please help me.


Thanks & Regards
Shirish
Shirish
Top achievements
Rank 1
 answered on 23 Jan 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?