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

I have a grid that on the ItemDataBound event I am checking some dates and turning the rows either yellow or red if the those corresponding dates are past the current date.  The test data I am using should make it so every row is red, however, only my alternating rows are turning red.  When I step through the code I can see that the code is being executed for every row so sometime between the time the code executes and the grid finishes loading the row color for some of the rows is being set back to white.

if ((e.Item.ItemType == GridItemType.Item) || (e.Item.ItemType == GridItemType.AlternatingItem))
{
    GridDataItem dataBoundItem = e.Item as GridDataItem;
  
    DateTime currentDate = DateTime.Now;
    DateTime dtRed = Convert.ToDateTime(DateToRed);
    DateTime dtYellow = Convert.ToDateTime(DateToYellow);
  
    //test data this should turn all rows red.//
    dtYellow = Convert.ToDateTime("08/25/2011");
    dtRed = Convert.ToDateTime("9/01/2011");
  
    System.TimeSpan diffRed = currentDate.Subtract(dtRed);
    System.TimeSpan diffYellow = currentDate.Subtract(dtYellow);
  
    if (diffYellow.Days >= 1)
    {
        dataBoundItem.BackColor = System.Drawing.Color.Yellow;
    }
  
    if (diffRed.Days >= 1)
    {
        dataBoundItem.BackColor = System.Drawing.Color.Red;
    }
}


<telerik:RadGrid ID="MyGrid" runat="server" Skin="WF" EnableLinqExpressions="false" EnableEmbeddedSkins="false" AllowSorting="true" OnSortCommand="MyGrid_SortCommand" OnItemDataBound="MyGrid_ItemDataBound" OnItemCommand="MyGrid_ItemCommand" OnItemCreated="MyGrid_ItemCreated" AllowFilteringByColumn="True">
            <MasterTableView Width="100%" CommandItemDisplay="Bottom" AutoGenerateColumns="false" EnableViewState="false" TableLayout="Fixed">
                <Columns>
                    <telerik:GridBoundColumn DataField="Application.Name" HeaderText="Application " UniqueName="Name" FilterListOptions="VaryByDataTypeAllowCustom" AutoPostBackOnFilter="true" CurrentFilterFunction="StartsWith"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="LOB" HeaderText="LOB" UniqueName="LOB"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Status" HeaderText=" Status" UniqueName="Status" AutoPostBackOnFilter="true" CurrentFilterFunction="StartsWith"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="dateToYellow" HeaderText="Date to Yellow" UniqueName="dateToYellow" AutoPostBackOnFilter="true" CurrentFilterFunction="StartsWith"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="dateToRed" HeaderText="Date to Red" UniqueName="dateToRed" AutoPostBackOnFilter="true" CurrentFilterFunction="StartsWith"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="FirstConfirmedInstallDate" HeaderText="Install Date" UniqueName="installDate" AutoPostBackOnFilter="true" CurrentFilterFunction="StartsWith"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Manager.Name" HeaderText="Application Manager" UniqueName="Manager"></telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
            <HeaderStyle BackColor="#666666" Font-Names="verdana, arial" Font-Size="Small" Height="20px" />
            <FilterItemStyle BackColor="#ffffff" />
        </telerik:RadGrid>

It is definately related to a conflict with the skin I am using because if I remove the skin, the color change code works fine. 

.RadGrid_WF
{
    border:1px solid #CCCCCC;
    background:#4f4f4f;
    color:#777777;
}
  
.RadGrid_WF,
.RadGrid_WF .rgMasterTable,
.RadGrid_WF .rgDetailTable,
.RadGrid_WF .rgGroupPanel table,
.RadGrid_WF .rgCommandRow table,
.RadGrid_WF .rgEditForm table,
.RadGrid_WF .rgPager table,
.GridToolTip_WF
{
    font:12px/16px "segoe ui",arial,sans-serif;
}
  
.RadGrid_WF .rgAdd,
.RadGrid_WF .rgRefresh,
.RadGrid_WF .rgEdit,
.RadGrid_WF .rgDel,
.RadGrid_WF .rgFilter,
.RadGrid_WF .rgPagePrev,
.RadGrid_WF .rgPageNext,
.RadGrid_WF .rgPageFirst,
.RadGrid_WF .rgPageLast,
.RadGrid_WF .rgExpand,
.RadGrid_WF .rgCollapse,
.RadGrid_WF .rgSortAsc,
.RadGrid_WF .rgSortDesc,
.RadGrid_WF .rgUpdate,
.RadGrid_WF .rgCancel,
.RadGrid_WF .rgUngroup,
.RadGrid_WF .rgExpXLS,
.RadGrid_WF .rgExpDOC,
.RadGrid_WF .rgExpPDF,
.RadGrid_WF .rgExpCSV
{
    background-image:url('Grid/sprite.gif');
}
  
/*header*/
  
.RadGrid_WF .rgHeaderDiv
{
    background:#474747 0 -9550px repeat-x url('Grid/sprite.gif');
}
.rgTwoLines .rgHeaderDiv
{
    background-position:0 -9050px;
}
  
.RadGrid_WF .rgHeader,
.RadGrid_WF th.rgResizeCol
{
    border:0;
    border-bottom:1px solid #CCCCCC;
    border:1px solid #CCCCCC;
    background:#191919 0 -2300px repeat-x url('Grid/sprite.gif');
}
  
.RadGrid_WF th.rgSorted
{
    background-color:#020202;
    background-position:0 -2600px;
}
  
.RadGrid_WF .rgHeader,
.RadGrid_WF .rgHeader a
{
    color:#fff;
}
  
/*rows*/
  
.RadGrid_WF .rgRow td,
.RadGrid_WF .rgAltRow td,
.RadGrid_WF .rgEditRow td,
.RadGrid_WF .rgFooter td
{
    border-style:solid;
    border-width:0 0 0 0;
}
  
.RadGrid_WF .rgRow td
{
    border-color:#CCCCCC;
    background-color:White;
    border-width:1px 1px 1px 1px;
}
  
.RadGrid_WF .rgAltRow
{
    border-color:#CCCCCC;
    background:white;
}
  
.RadGrid_WF .rgAltRow td
{
    border-color:#CCCCCC;
    border-width:1px 1px 1px 1px;
}
  
.RadGrid_WF .rgRow .rgSorted
{
    border-bottom-color:#4b4b4b;
    background-color:#4b4b4b;
}
  
.RadGrid_WF .rgAltRow .rgSorted
{
    border-bottom-color:#454545;
    background-color:#454545;
}
  
.RadGrid_WF .rgSelectedRow .rgSorted,
.RadGrid_WF .rgActiveRow .rgSorted,
.RadGrid_WF .rgHoveredRow .rgSorted,
.RadGrid_WF .rgEditRow .rgSorted
{
    background-color:transparent;
}
  
.RadGrid_WF .rgRow a,
.RadGrid_WF .rgAltRow a,
.RadGrid_WF .rgEditRow a,
.RadGrid_WF .rgFooter a,
.RadGrid_WF .rgEditForm a
{
    color:maroon;
}
  
.RadGrid_WF .rgSelectedRow
{
    background:#303030 0 -3900px repeat-x url('Grid/sprite.gif');
    color:#fff;
}
*+html .RadGrid_WF .rgSelectedRow .rgSorted{background-color:#303030}
* html .RadGrid_WF .rgSelectedRow .rgSorted{background-color:#303030}
  
.RadGrid_WF .rgActiveRow,
.RadGrid_WF .rgHoveredRow
{
    background:#2e2e2e 0 -2900px repeat-x url('Grid/sprite.gif');
    color:#9eda29;
}
*+html .RadGrid_WF .rgActiveRow .rgSorted,
*+html .RadGrid_WF .rgHoveredRow .rgSorted{background-color:#2e2e2e}
* html .RadGrid_WF .rgActiveRow .rgSorted,
* html .RadGrid_WF .rgHoveredRow .rgSorted{background-color:#2e2e2e}
  
.RadGrid_WF .rgEditRow
{
    background:#202020;
    color:#d7d7d7;
}
*+html .RadGrid_WF .rgEditRow .rgSorted{background-color:#202020}
* html .RadGrid_WF .rgEditRow .rgSorted{background-color:#202020}
  
.RadGrid_WF .rgActiveRow td,
.RadGrid_WF .rgActiveRow td.rgSorted,
.RadGrid_WF .rgHoveredRow td,
.RadGrid_WF .rgHoveredRow td.rgSorted
{
    border-bottom-color:#1e1e1e;
}
  
.RadGrid_WF .rgSelectedRow td,
.RadGrid_WF .rgSelectedRow td.rgSorted
{
    border-bottom-color:#1a1a1a;
}
  
.RadGrid_WF .rgEditRow td,
.RadGrid_WF .rgEditRow td.rgSorted
{
    border-bottom-color:#080808;
}
  
/*footer*/
  
.RadGrid_WF .rgFooterDiv,
.RadGrid_WF .rgFooter
{
    background:#2e2e2e;
}
  
.RadGrid_WF .rgFooter td
{
    border:0;
    border-top:1px solid #080808;
}
  
/*status*/
  
.RadGrid_WF .rgPager .rgStatus
{
    border:solid #080808;
    border-width:1px 1px 0 0;
}
  
.RadGrid_WF .rgStatus div
{
    background-image:url('Common/loading_small.gif');
}
  
/*pager*/
  
.RadGrid_WF .rgPager
{
    background:#1e1e1e 0 -8000px repeat-x url('Grid/sprite.gif');
}
  
.RadGrid_WF td.rgPagerCell
{
    border-top:1px solid #080808;
    border-left:1px solid #3a3a3a;
}
  
.RadGrid_WF .rgInfoPart
{
    color:#a9a9a9;
}
  
.RadGrid_WF .rgInfoPart strong
{
    color:#fefefe;
}
  
.RadGrid_WF .rgPageFirst
{
    background-position:0 -550px;
}
.RadGrid_WF .rgPageFirst:hover
{
    background-position:0 -600px;
}
.RadGrid_WF .rgPagePrev
{
    background-position:0 -700px;
}
.RadGrid_WF .rgPagePrev:hover
{
    background-position:0 -750px;
}
.RadGrid_WF .rgPageNext
{
    background-position:0 -850px;
}
.RadGrid_WF .rgPageNext:hover
{
    background-position:0 -900px;
}
.RadGrid_WF .rgPageLast
{
    background-position:0 -1000px;
}
.RadGrid_WF .rgPageLast:hover
{
    background-position:0 -1050px;
}
  
.RadGrid_WF .rgPager .rgPagerButton
{
    border-color:#080808;
    background:#1b1b1b repeat-x 0 -1550px url('Grid/sprite.gif');
    color:#fff;
    font-family:"Segoe UI", Arial, Helvetica, Verdana, sans-serif;
}
  
.RadGrid_WF .rgNumPart a:hover,
.RadGrid_WF .rgNumPart a:hover span,
.RadGrid_WF .rgNumPart a.rgCurrentPage,
.RadGrid_WF .rgNumPart a.rgCurrentPage span
{
    background:no-repeat url('Grid/sprite.gif');
}
  
.RadGrid_WF .rgNumPart a
{
    color:#a9a9a9;
}
  
.RadGrid_WF .rgNumPart a:hover
{
    background-position:100% -1250px;
    color:#9eda29;
}
  
.RadGrid_WF .rgNumPart a:hover span
{
    background-position:0 -1150px;
}
  
.RadGrid_WF .rgNumPart a.rgCurrentPage,
.RadGrid_WF .rgNumPart a.rgCurrentPage:hover
{
    background-position:100% -1450px;
    color:#fff;
}
  
.RadGrid_WF .rgNumPart a.rgCurrentPage span,
.RadGrid_WF .rgNumPart a.rgCurrentPage:hover span
{
    background-position:0 -1350px;
}
  
/*sorting, reordering*/
  
.RadGrid_WF .rgHeader .rgSortAsc
{
    background-position:3px -248px;
    height:10px;
}
  
.RadGrid_WF .rgHeader .rgSortDesc
{
    background-position:3px -198px;
    height:10px;
}
  
.GridReorderTop_WF,
.GridReorderBottom_WF
{
    background:0 0 no-repeat url('Grid/sprite.gif');
}
  
.GridReorderBottom_WF
{
    background-position:0 -50px;
}
  
/*filtering*/
  
.RadGrid_WF .rgFilterRow
{
    background:#ffffff 0 -7000px;
}
  
.RadGrid_WF .rgFilterRow td
{
    border-top:1px solid #ffffff;
    border-bottom:1px solid #080808;
}
  
.RadGrid_WF .rgFilter
{
    background-position:0 -300px;
}
  
.RadGrid_WF .rgFilter:hover
{
    background-position:0 -350px;
}
  
.RadGrid_WF .rgFilterActive,
.RadGrid_WF .rgFilterActive:hover
{
    background-position:0 -400px;
}
  
.RadGrid_WF .rgFilterBox
{
    border-color:#080808;
    background:#ffffff;
    font-family:"Segoe UI", Arial, Helvetica, Verdana, sans-serif;
    color:#ffffff;
}
  
/*filter context menu*/
  
.RadMenu_WF .rgHCMClear,
.RadMenu_WF .rgHCMFilter
{
    border-color:#080808;
    background:#ffffff center -23px repeat-x url('FormDecorator/ButtonSprites.gif');
    color:#000;
    font-family:"Segoe UI", Arial, Helvetica, Verdana, sans-serif;
}
  
.RadMenu_WF .rgHCMClear:hover,
.RadMenu_WF .rgHCMFilter:hover
{
    background-position:center -67px;
    background-color:#020202;
    color:#9eda29;
}
  
/*grouping*/
  
.RadGrid_WF .rgGroupPanel
{
    border:0;
    border-bottom:1px solid #080808;
    background:#202020 0 -1900px repeat-x url('Grid/sprite.gif');
}
  
.RadGrid_WF .rgGroupPanel td
{
    border:0;
    padding:3px 4px;
}
  
.RadGrid_WF .rgGroupPanel td td
{
    padding:0;
}
  
.RadGrid_WF .rgGroupPanel .rgSortAsc
{
    background-position:2px -146px;
}
  
.RadGrid_WF .rgGroupPanel .rgSortDesc
{
    background-position:2px -95px;
}
  
.RadGrid_WF .rgUngroup
{
    background-position:0 -9000px;
}
  
.RadGrid_WF .rgGroupItem
{
    border:1px solid #080808;
    background:#1b1b1b 0 -6500px repeat-x url('Grid/sprite.gif');
    color:#fff;
}
  
.RadGrid_WF .rgMasterTable td.rgGroupCol,
.RadGrid_WF .rgMasterTable td.rgExpandCol
{
    border-color:#202020;
    background:#202020 none;
}
  
.RadGrid_WF .rgGroupHeader
{
    font-size:1.1em;
    line-height:21px;
    color:#fff;
}
  
.RadGrid_WF .rgGroupHeader,
.RadGrid_WF .rgGroupHeader td.rgGroupCol
{
    background:#202020 0 -8500px repeat-x url('Grid/sprite.gif');
}
  
.RadGrid_WF .rgGroupHeader td
{
    border-top:1px solid #3a3a3a;
    padding-top:0;
    padding-bottom:0;
}
  
.RadGrid_WF .rgGroupHeader td.rgGroupCol
{
    border-top-color:#202020;
}
  
.RadGrid_WF .rgExpand
{
    background-position:5px -496px;
}
  
.RadGrid_WF .rgCollapse
{
    background-position:3px -444px;
}
  
/*editing*/
  
.RadGrid_WF .rgEditForm
{
    border-bottom:1px solid #080808;
}
  
.RadGrid_WF .rgUpdate
{
    background-position:0 -1800px;
}
  
.RadGrid_WF .rgCancel
{
    background-position:0 -1850px;
}
  
/*hierarchy*/
  
.RadGrid_WF .rgDetailTable
{
    border-color:#080808;
}
  
/*command row*/
  
.RadGrid_WF .rgCommandRow
{
    background:#ffffff 0 -2100px repeat-x url('Grid/sprite.gif');
    color:#000000;
    height:40px;
    border-color:#ffffff;
}
  
.RadGrid_WF .rgCommandCell
{
    border:0;
    padding:2px 7px;
}
  
.RadGrid_WF tfoot .rgCommandCell
{
    border-top:1px solid #0e0e0e;
}
  
.RadGrid_WF thead .rgCommandCell
{
    border-bottom:1px solid #0e0e0e;
}
  
.RadGrid_WF .rgCommandTable,
.RadGrid_WF .rgCommandTable td
{
    border:0;
    padding:0;
}
  
.RadGrid_WF .rgCommandRow a
{
    color:#000;
    text-decoration:none;
}
  
.RadGrid_WF .rgAdd
{
    margin-right:3px;
    background-position:0 -1650px;
}
  
.RadGrid_WF .rgRefresh
{
    margin-right:3px;
    background-position:0 -1600px;
}
  
.RadGrid_WF .rgEdit
{
    background-position:0 -1700px;
}
  
.RadGrid_WF .rgDel
{
    background-position:0 -1750px;
}
  
.RadGrid_WF .rgExpXLS,
.RadGrid_WF .rgExpDOC,
.RadGrid_WF .rgExpPDF,
.RadGrid_WF .rgExpCSV
{
    background-image:url('../Common/Grid/export.gif');
}
  
.RadGrid_WF .rgExpXLS
{
    background-position:0 0;
}
.RadGrid_WF .rgExpDOC
{
    background-position:0 -50px;
}
.RadGrid_WF .rgExpPDF
{
    background-position:0 -100px;
}
.RadGrid_WF .rgExpCSV
{
    background-position:0 -150px;
}
  
/*multirow select*/
  
.GridRowSelector_WF
{
    background:#d7d7d7;
}
  
/*row drag n drop*/
  
.GridItemDropIndicator_WF
{
    border-top:1px dashed #d7d7d7;
}
  
/*tooltip*/
  
.GridToolTip_WF
{
    border:1px solid #080808;
    padding:3px;
    background:#ccc;
    color:#000;
}
  
/*rtl*/
  
.RadGridRTL_WF .rgPageFirst
{
    background-position:0 -1000px;
}
.RadGridRTL_WF .rgPageFirst:hover
{
    background-position:0 -1050px;
}
.RadGridRTL_WF .rgPagePrev
{
    background-position:0 -850px;
}
.RadGridRTL_WF .rgPagePrev:hover
{
    background-position:0 -900px;
}
.RadGridRTL_WF .rgPageNext
{
    background-position:0 -700px;
}
.RadGridRTL_WF .rgPageNext:hover
{
    background-position:0 -750px;
}
.RadGridRTL_WF .rgPageLast
{
    background-position:0 -550px;
}
.RadGridRTL_WF .rgPageLast:hover
{
    background-position:0 -600px;
}


Any ideas would be greatly appreciate.   Attached is an image of part of the grid that shows the dates.  The dates are the same for each line so the color should be red for each of them.

Thanks,

Rhonda
Daniel
Telerik team
 answered on 20 Sep 2011
3 answers
256 views
Hi, I need some of help

I have a grid master / detail, but I need to change the color of the row if I have information in the detail
Currently I have this in my code


Protected Sub RadGridPEDG_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGridPEDG.ItemCreated
        Dim tableName As String
        tableName = e.Item.OwnerTableView.Name
         
        If (e.Item.HasChildItems = true ) Then
             Dim dataBoundItem As GridDataItem = e.Item
             dataBoundItem.BackColor= Drawing.Color.Red
               
        End If
end  Sub

But not working

Thanks !!
Andrey
Telerik team
 answered on 20 Sep 2011
1 answer
121 views
hi all :)

I have a grid with template column, Item mode is a binary Image, and edit mode is a rad upload

how can I get the file name and make it an insert parameter default value ?

here is my code

HTML

<telerik:GridTemplateColumn DataField="Data" HeaderText="Image" UniqueName="Upload">
    <ItemTemplate>
        <telerik:RadBinaryImage runat="server" ID="RadBinaryImage1" ImageUrl='<%# Eval("User_AvatarPath") %>'
            AutoAdjustImageControlSize="false" Height="80px" Width="80px"
             />
    </ItemTemplate>
    <EditItemTemplate>
        <telerik:RadAsyncUpload runat="server" ID="AsyncUpload1" OnClientFileUploaded="OnClientFileUploaded"
            AllowedFileExtensions="jpg,jpeg,png,gif" MaxFileSize="1048576"
             OnValidatingFile="RadAsyncUpload1_ValidatingFile"
             TargetFolder="~/Pic's/Users"
             OverwriteExistingFiles="false" >
        </telerik:RadAsyncUpload>
    </EditItemTemplate>
</telerik:GridTemplateColumn>


C#.net

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Charting;
using Telerik.Web.UI;
using System.Data.SqlClient;
 
public partial class HTKfjksh7869435fds435_ljagut32542GSDFG_lgjdfsh32452GR235GGOJA324_Contros_NewItem_WebUserControl : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlDataSource1.UpdateParameters["User_AvatarPath"].DefaultValue = _ImagePath;
        SqlDataSource1.InsertParameters["User_AvatarPath"].DefaultValue = _ImagePath;
    }
 
    const int MaxTotalBytes = 1048576; // 1 MB
    int totalBytes;
    private static string _ImageName = "";
    private static string _ImagePath = "~/Pic's/Users/" + _ImageName;
    public bool? IsRadAsyncValid
    {
        get
        {
            if (Session["IsRadAsyncValid"] == null)
            {
                Session["IsRadAsyncValid"] = true;
            }
 
            return Convert.ToBoolean(Session["IsRadAsyncValid"].ToString());
        }
        set
        {
            Session["IsRadAsyncValid"] = value;
        }
    }
 
    public void RadAsyncUpload1_ValidatingFile(object sender, Telerik.Web.UI.Upload.ValidateFileEventArgs e)
    {
         
        if ((totalBytes < MaxTotalBytes) && (e.UploadedFile.ContentLength < MaxTotalBytes))
        {
            e.IsValid = true;
            totalBytes += e.UploadedFile.ContentLength;
            IsRadAsyncValid = true;
            _ImageName = e.UploadedFile.GetName();
             
        }
        else
        {
            e.IsValid = false;
            IsRadAsyncValid = false;
        }
 
 
    }
}



thank you all :)
Peter Filipov
Telerik team
 answered on 20 Sep 2011
5 answers
322 views
Hi,

I am exporting data from RadGrid to Excel/PDF. I want to do cell label formating in excel sheet. For eg. I want to set the width of a perticulor cell in excel. I want to change the color of a cell. I wnat to set the formate ( date formate , number format ) for a cell.

I want  to set some header to  exported excel or PDF.
Daniel
Telerik team
 answered on 20 Sep 2011
2 answers
108 views
Hi,
I am having problems with drag-n-drop columns into group pane, here is the declaration of gird:
<style type="text/css">
    .w130px {width: 130px;}
    .w400px {width: 400px;}
</style>
  
<telerik:RadGrid ID="radGrid" AutoGenerateColumns="false" runat="server" width="100%" ShowGroupPanel="true" DataSourceID="dataSource1">
    <MasterTableView>
        <Columns>
            <telerik:GridBoundColumn DataField="DesktopModuleID" HeaderText="DesktopModuleID" ItemStyle-CssClass="w130px" HeaderStyle-CssClass="w130px"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="ModuleName" HeaderText="ModuleName"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Description" HeaderText="Description" ItemStyle-CssClass="w400px" HeaderStyle-CssClass="w400px"></telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
    <ClientSettings AllowDragToGroup="true">
        <Scrolling AllowScroll="true" UseStaticHeaders="true" />
    </ClientSettings>
</telerik:RadGrid>

I drop a column into the group pane, find the header and item columns not aligned. The header columns still follow css rules, which has 130px, remaining space and 400px, but each item column seems to have 1/3 of table width.

If I remove the Scrolling:UseStaticHeaders, the problems seem to go away, but I need to have data grouping and static header work together. 

Please help
Veli
Telerik team
 answered on 20 Sep 2011
3 answers
181 views
Hi!

There are cases when you don't need the full potential of RadGrid. Indeed what i need in most of cases is to display some row data (no grouping, no totals, no nested tables, nothing... Simple table. You can ask why i don't do that by using a HTML table? Well... there are some facilities with grid like autogenerate columns, and my sql sp-s are dynamic. It means they return different number of columns.. Using grid in this scenario makes your job easier.

Nut when I use AJAX, i'm worried about overhead size of Grid. Whenever the grid is refreshed (or many of them) there is a big overhead with js functions with that. I disabled viewstate, because i don't need it and i tried to disable almos everything, but still the overhead size is big...

Is there any way to disable mos of functions (like client side events), so this overhead can be smaller? I mean, not the big JS file, but that part that is called every time a grid is refreshed.

For example making smaller something like this:

|0|hiddenField|__EVENTTARGET||0|hiddenField|__EVENTARGUMENT||56|hiddenField|__VIEWSTATE|/wEPZwUPOGNjZTRlNTY2ZTRiMGUxHJk8mrS1bLbuGXMwGAJHSNCFvHU=|96|hiddenField|__EVENTVALIDATION|/wEWCAKhw/y/DALZ8f76AQLbr53IDwK6qI6AAwKohJWGDQLT4J7NCQLJ/d6HDQKvjezdCy8TvR3DZmUxai2ShwN8h2S2DJ0O|63|asyncPostBackControlIDs||Ligat1$RadTreeView1,BetSlip1$btnVendos,BetSlip1$TimerKonfirmimi|0|postBackControlIDs|||447|updatePanelIDs||tPTjeterPanel,tKoka1$UserPassPanelPanel,tKoka1$EmerMbiemerPanelPanel,tGjermani Bundesliga$RadTabStrip1Panel,tGjermani Bundesliga$GridNdeshjetLigaPanel,tGjermani Bundesliga$panelperupdatePanel,tBetSlip1$BetSlipGridPanel,tBetSlip1$KoefiPanelPanel,tBetSlip1$MesazhiPanelPanel,tFrance Div. 2$RadTabStrip1Panel,tFrance Div. 2$GridNdeshjetLigaPanel,tFrance Div. 2$panelperupdatePanel,tBetSlip1$txtShumaPanel,tBetSlip1$PritjaPanelPanel,tRadAjaxManager1SU|221|childUpdatePanelIDs||Gjermani Bundesliga$RadTabStrip1Panel,Gjermani Bundesliga$GridNdeshjetLigaPanel,Gjermani Bundesliga$panelperupdatePanel,France Div. 2$RadTabStrip1Panel,France Div. 2$GridNdeshjetLigaPanel,France Div. 2$panelperupdatePanel|108|panelsToRefreshIDs||PTjeterPanel,BetSlip1$BetSlipGridPanel,BetSlip1$KoefiPanelPanel,BetSlip1$MesazhiPanelPanel,RadAjaxManager1SU|2|asyncPostBackTimeout||90|12|formAction||default.aspx|120|scriptBlock|ScriptPath|/ARIO BetWeb/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b|69|scriptStartupBlock|ScriptContentNoTags|Telerik.Web.UI.RadTreeView._preInitialize("Ligat1_RadTreeView1","0");|60|scriptStartupBlock|ScriptContentNoTags|Telerik.Web.UI.RadTreeView._clearLog("Ligat1_RadTreeView1");|62|scriptStartupBlock|ScriptContentNoTags|if(typeof ($telerik)!='undefined'){$telerik.registerSkins();};|5169|scriptStartupBlock|ScriptContentNoTags|Sys.Application.add_init(function() { 
    $create(Telerik.Web.UI.RadTabStrip, {"_postBackReference":"__doPostBack(\u0027Gjermani Bundesliga$RadTabStrip1\u0027,\u0027{0}\u0027)","_selectedIndex":0,"_skin":"Olsi_Pa_lidhje","clickSelectedTab":true,"clientStateFieldID":"Gjermani Bundesliga_RadTabStrip1_ClientState","selectedIndexes":["0"],"tabData":[{"value":"RF"},{"value":"45/90"},{"value":"DSH"},{"value":"RP1"},{"value":"SGP1"},{"value":"SGP"},{"value":"SHP"},{"value":"GJG"}]}, null, null, $get("Gjermani Bundesliga_RadTabStrip1")); 
    $create(Telerik.Web.UI.RadGrid, {"ClientID":"Gjermani Bundesliga_GridNdeshjetLiga","ClientSettings":{"AllowExpandCollapse":false,"AllowGroupExpandCollapse":false,"DataBinding":{},"Selecting":{},"Scrolling":{},"Resizing":{},"ClientMessages":{},"KeyboardNavigationSettings":{"AllowActiveRowCycle":false,"EnableKeyboardShortcuts":true,"FocusKey":89,"InitInsertKey":73,"RebindKey":82,"ExitEditInsertModeKey":27,"UpdateInsertItemKey":13,"DeleteActiveRow":127}},"Skin":"Windows7","UniqueID":"Gjermani Bundesliga$GridNdeshjetLiga","_activeRowIndex":"","_controlToFocus":"","_currentPageIndex":0,"_editIndexes":"[]","_embeddedSkin":true,"_gridTableViewsData":"[{\"ClientID\":\"Gjermani Bundesliga_GridNdeshjetLiga_ctl00\",\"UniqueID\":\"Gjermani Bundesliga$GridNdeshjetLiga$ctl00\",\"PageSize\":10,\"PageCount\":1,\"EditMode\":\"EditForms\",\"CurrentPageIndex\":0,\"VirtualItemCount\":0,\"AllowMultiColumnSorting\":false,\"AllowNaturalSort\":true,\"AllowFilteringByColumn\":false,\"IsItemInserted\":false,\"clientDataKeyNames\":[],\"_dataBindTemplates\":false,\"_selectedItemStyle\":\"\",\"_selectedItemStyleClass\":\"rgSelectedRow\",\"_columnsData\":[{\"UniqueName\":\"Kodi\",\"Resizable\":true,\"Reorderable\":true,\"Groupable\":true,\"ColumnType\":\"GridBoundColumn\",\"Display\":true},{\"UniqueName\":\"Ndeshja\",\"Resizable\":true,\"Reorderable\":true,\"Groupable\":true,\"ColumnType\":\"GridBoundColumn\",\"Display\":true},{\"UniqueName\":\"1\",\"Resizable\":true,\"Reorderable\":true,\"Groupable\":true,\"ColumnType\":\"GridBoundColumn\",\"Display\":true},{\"UniqueName\":\"X\",\"Resizable\":true,\"Reorderable\":true,\"Groupable\":true,\"ColumnType\":\"GridBoundColumn\",\"Display\":true},{\"UniqueName\":\"2\",\"Resizable\":true,\"Reorderable\":true,\"Groupable\":true,\"ColumnType\":\"GridBoundColumn\",\"Display\":true}]}]","_masterClientID":"Gjermani Bundesliga_GridNdeshjetLiga_ctl00","_shouldFocusOnPage":false,"allowMultiRowSelection":false,"clientStateFieldID":"Gjermani Bundesliga_GridNdeshjetLiga_ClientState"}, null, null, $get("Gjermani Bundesliga_GridNdeshjetLiga")); 
    $create(Telerik.Web.UI.RadTabStrip, {"_postBackReference":"__doPostBack(\u0027France Div. 2$RadTabStrip1\u0027,\u0027{0}\u0027)","_selectedIndex":0,"_skin":"Olsi_Pa_lidhje","clickSelectedTab":true,"clientStateFieldID":"France Div. 2_RadTabStrip1_ClientState","selectedIndexes":["0"],"tabData":[{"value":"RF"},{"value":"45/90"},{"value":"DSH"},{"value":"RP1"},{"value":"SGP1"},{"value":"SGP"},{"value":"HA"},{"value":"SHP"},{"value":"GJG"}]}, null, null, $get("France Div. 2_RadTabStrip1")); 
    $create(Telerik.Web.UI.RadGrid, {"ClientID":"France Div. 2_GridNdeshjetLiga","ClientSettings":{"AllowExpandCollapse":false,"AllowGroupExpandCollapse":false,"DataBinding":{},"Selecting":{},"Scrolling":{},"Resizing":{},"ClientMessages":{},"KeyboardNavigationSettings":{"AllowActiveRowCycle":false,"EnableKeyboardShortcuts":true,"FocusKey":89,"InitInsertKey":73,"RebindKey":82,"ExitEditInsertModeKey":27,"UpdateInsertItemKey":13,"DeleteActiveRow":127}},"Skin":"Windows7","UniqueID":"France Div. 2$GridNdeshjetLiga","_activeRowIndex":"","_controlToFocus":"","_currentPageIndex":0,"_editIndexes":"[]","_embeddedSkin":true,"_gridTableViewsData":"[{\"ClientID\":\"France Div. 2_GridNdeshjetLiga_ctl00\",\"UniqueID\":\"France Div. 2$GridNdeshjetLiga$ctl00\",\"PageSize\":10,\"PageCount\":1,\"EditMode\":\"EditForms\",\"CurrentPageIndex\":0,\"VirtualItemCount\":0,\"AllowMultiColumnSorting\":false,\"AllowNaturalSort\":true,\"AllowFilteringByColumn\":false,\"IsItemInserted\":false,\"clientDataKeyNames\":[],\"_dataBindTemplates\":false,\"_selectedItemStyle\":\"\",\"_selectedItemStyleClass\":\"rgSelectedRow\",\"_columnsData\":[{\"UniqueName\":\"Kodi\",\"Resizable\":true,\"Reorderable\":true,\"Groupable\":true,\"ColumnType\":\"GridBoundColumn\",\"Display\":true},{\"UniqueName\":\"Ndeshja\",\"Resizable\":true,\"Reorderable\":true,\"Groupable\":true,\"ColumnType\":\"GridBoundColumn\",\"Display\":true},{\"UniqueName\":\"1\",\"Resizable\":true,\"Reorderable\":true,\"Groupable\":true,\"ColumnType\":\"GridBoundColumn\",\"Display\":true},{\"UniqueName\":\"X\",\"Resizable\":true,\"Reorderable\":true,\"Groupable\":true,\"ColumnType\":\"GridBoundColumn\",\"Display\":true},{\"UniqueName\":\"2\",\"Resizable\":true,\"Reorderable\":true,\"Groupable\":true,\"ColumnType\":\"GridBoundColumn\",\"Display\":true}]}]","_masterClientID":"France Div. 2_GridNdeshjetLiga_ctl00","_shouldFocusOnPage":false,"allowMultiRowSelection":false,"clientStateFieldID":"France Div. 2_GridNdeshjetLiga_ClientState"}, null, null, $get("France Div. 2_GridNdeshjetLiga")); 
}); 
|1478|scriptStartupBlock|ScriptContentNoTags|Sys.Application.add_init(function() { 
    $create(Telerik.Web.UI.RadGrid, {"ClientID":"BetSlip1_BetSlipGrid","ClientSettings":{"AllowAutoScrollOnDragDrop":true,"ShouldCreateRows":true,"DataBinding":{},"Selecting":{},"Scrolling":{},"Resizing":{},"ClientMessages":{},"KeyboardNavigationSettings":{"AllowActiveRowCycle":false,"EnableKeyboardShortcuts":true,"FocusKey":89,"InitInsertKey":73,"RebindKey":82,"ExitEditInsertModeKey":27,"UpdateInsertItemKey":13,"DeleteActiveRow":127}},"Skin":"Simple","UniqueID":"BetSlip1$BetSlipGrid","_activeRowIndex":"","_controlToFocus":"","_currentPageIndex":0,"_editIndexes":"[]","_embeddedSkin":false,"_gridTableViewsData":"[{\"ClientID\":\"BetSlip1_BetSlipGrid_ctl00\",\"UniqueID\":\"BetSlip1$BetSlipGrid$ctl00\",\"PageSize\":10,\"PageCount\":1,\"EditMode\":\"EditForms\",\"CurrentPageIndex\":0,\"VirtualItemCount\":0,\"AllowMultiColumnSorting\":false,\"AllowNaturalSort\":true,\"AllowFilteringByColumn\":false,\"IsItemInserted\":false,\"clientDataKeyNames\":[],\"_dataBindTemplates\":false,\"_selectedItemStyle\":\"\",\"_selectedItemStyleClass\":\"rgSelectedRow\",\"_columnsData\":[{\"UniqueName\":\"zgjedhja\",\"Resizable\":true,\"Reorderable\":true,\"Groupable\":true,\"ColumnType\":\"GridTemplateColumn\",\"Display\":true}]}]","_masterClientID":"BetSlip1_BetSlipGrid_ctl00","_shouldFocusOnPage":false,"allowMultiRowSelection":false,"clientStateFieldID":"BetSlip1_BetSlipGrid_ClientState"}, null, null, $get("BetSlip1_BetSlipGrid")); 
}); 
|3129|scriptStartupBlock|ScriptContentNoTags|Sys.Application.add_init(function() { 
    $create(Telerik.Web.UI.RadAjaxManager, {"_updatePanels":"","ajaxSettings":[{InitControlID : "Ligat1_RadTreeView1",UpdatedControls : [{ControlID:"PTjeter",PanelID:""}]},{InitControlID : "Koka1_btnLogin",UpdatedControls : [{ControlID:"Koka1_UserPassPanel",PanelID:""},{ControlID:"Koka1_EmerMbiemerPanel",PanelID:""}]},{InitControlID : "Koka1_btnLargohu",UpdatedControls : [{ControlID:"Koka1_UserPassPanel",PanelID:""},{ControlID:"Koka1_EmerMbiemerPanel",PanelID:""}]},{InitControlID : "Gjermani Bundesliga_RadTabStrip1",UpdatedControls : [{ControlID:"Gjermani Bundesliga_RadTabStrip1",PanelID:""},{ControlID:"Gjermani Bundesliga_GridNdeshjetLiga",PanelID:""}]},{InitControlID : "Gjermani Bundesliga_panelperupdate",UpdatedControls : [{ControlID:"Gjermani Bundesliga_panelperupdate",PanelID:""}]},{InitControlID : "Gjermani Bundesliga_panelperupdate",UpdatedControls : [{ControlID:"BetSlip1_BetSlipGrid",PanelID:""}]},{InitControlID : "Gjermani Bundesliga_panelperupdate",UpdatedControls : [{ControlID:"BetSlip1_KoefiPanel",PanelID:""}]},{InitControlID : "Gjermani Bundesliga_panelperupdate",UpdatedControls : [{ControlID:"BetSlip1_MesazhiPanel",PanelID:""}]},{InitControlID : "France Div. 2_RadTabStrip1",UpdatedControls : [{ControlID:"France Div. 2_RadTabStrip1",PanelID:""},{ControlID:"France Div. 2_GridNdeshjetLiga",PanelID:""}]},{InitControlID : "France Div. 2_panelperupdate",UpdatedControls : [{ControlID:"France Div. 2_panelperupdate",PanelID:""}]},{InitControlID : "France Div. 2_panelperupdate",UpdatedControls : [{ControlID:"BetSlip1_BetSlipGrid",PanelID:""}]},{InitControlID : "France Div. 2_panelperupdate",UpdatedControls : [{ControlID:"BetSlip1_KoefiPanel",PanelID:""}]},{InitControlID : "France Div. 2_panelperupdate",UpdatedControls : [{ControlID:"BetSlip1_MesazhiPanel",PanelID:""}]},{InitControlID : "BetSlip1_btnVendos",UpdatedControls : [{ControlID:"BetSlip1_MesazhiPanel",PanelID:""},{ControlID:"BetSlip1_KoefiPanel",PanelID:""},{ControlID:"BetSlip1_txtShuma",PanelID:""},{ControlID:"BetSlip1_PritjaPanel",PanelID:""},{ControlID:"BetSlip1_BetSlipGrid",PanelID:""}]},{InitControlID : "BetSlip1_TimerKonfirmimi",UpdatedControls : [{ControlID:"BetSlip1_MesazhiPanel",PanelID:""},{ControlID:"BetSlip1_KoefiPanel",PanelID:""},{ControlID:"BetSlip1_txtShuma",PanelID:""}]},{InitControlID : "BetSlip1_BetSlipGrid",UpdatedControls : [{ControlID:"BetSlip1_KoefiPanel",PanelID:""},{ControlID:"BetSlip1_BetSlipGrid",PanelID:""}]}],"clientEvents":{OnRequestStart:"",OnResponseEnd:""},"defaultLoadingPanelID":"","enableAJAX":true,"enableHistory":false,"links":["controls/styles.css","App_Themes/Bet07/Calendar.Bet07_bslip.css","App_Themes/Bet07/Grid.Bet07_bslip.css","App_Themes/Bet07/Input.Bet07_bslip.css","App_Themes/Bet07/Menu.Bet07_bslip.css","App_Themes/Bet07/Menu.bet07_treeview.css","App_Themes/Bet07/Menu.menu_koka.css","App_Themes/Bet07/Slider.Bet07_bslip.css","App_Themes/Bet07/TabStrip.Olsi_Pa_lidhje.css","App_Themes/Bet07/TreeView.bet07_treeview.css"],"styles":[],"uniqueID":"RadAjaxManager1","updatePanelsRenderMode":0}, null, null, $get("RadAjaxManager1")); 
}); 
| 

All this is returned every time an AJAX call is performed

Is there any way?

Thank you!
Iana Tsolova
Telerik team
 answered on 20 Sep 2011
1 answer
138 views
Hi,

The feature demostrated here in your demo site, fits well our situation. But the example was developed using SqlServerDataSource, and we would like to do it with EntityFramework.

Could you provide us an example of it but using EntityFramework instead of SqlServerDataSource?
What would we have to change to accomplish the same example?

Thanks in advance.
Iana Tsolova
Telerik team
 answered on 20 Sep 2011
2 answers
68 views
Hello,
Is it possible to drag and drop RadGridRow to RadTreeView / RadTreeNode ? Have you an example ?
thanks
Franck
Top achievements
Rank 1
 answered on 20 Sep 2011
4 answers
116 views
Hi, In my grid I have 2 drop downs. I would like to either change the values or not let the grid be updated depending on what has been selected in the drop downs.

For example:
If the status drop down = unassigned then the assignedto drop down also has to = unassigned.
If the status drop down = assigned then the assignedto drop down can't = unassigned.

What is the best way to go about doing this?

Thanks

Princy
Top achievements
Rank 2
 answered on 20 Sep 2011
4 answers
444 views

i have added rad gridboundcolumns at run time and gridbuttoncolumns at design time .I m able to perform paging and resizing of grid but not sorting and filtering.When i click on grid columns for sorting ,entire grid gets disappear,and filter is not working at all.
I tried to add only those columns at run time which are dynamic and the fixed columns at design time,in that case sorting and filtering was working in some of the fixed columns and some of the dynamic colums but not for all columns.After that i added all columns at run time including grid design and button columns,but not even a single function was working(i.e. paging,sorting,page resize,filtering and delete),so i kept button columns at design time and rest all at runtime,other functionality is proper but again sorting and filtering is not working in this case also,is there anything additional that has to be done for sorting and filtering while adding columns dynamically

using System;

using System.Collections.Generic;

using System.Configuration;

using System.Text;

using System.Web;

using System.Web.UI;

using System.Web.UI.HtmlControls;

using System.Web.UI.WebControls;

using System.Data;

using System.Linq;

using log4net;

using Telerik.Web.UI;

using Kalitte.Dashboard.Framework;

using Kalitte.Dashboard.Framework.Types;

 

 

 

namespace abc.Web.UserControls.Patient.Management

{

public partial class ProcedureMaster : System.Web.UI.UserControl, IWidgetControl

    {

        #region Page Variables

 

        //Flag that holds the value for redirection

        bool NeedRedirection = false;

        static ILog log = null;

        WidgetInstance instance = null;

        Kalitte.Dashboard.Framework.DashboardSurface dashboardSurface = null;

        bool dynamicCol = false;

        public bool CanView;

        public bool CanAdd;

        public bool CanEdit;

        public bool CanDelete;

       

        int UserId = BOL.Classes.EHRSessions.UserId;

 

        public short AddEditWindowWidth

        {

            get

            {

                return ViewState["AddEditWindowWidth"] != null ? Convert.ToInt16(ViewState["AddEditWindowWidth"].ToString()) : (short)850;

            }

            set

            {

                ViewState["AddEditWindowWidth"] = value;

            }

        }

 

        public short AddEditWindowHeight

        {

            get

            {

                return ViewState["AddEditWindowHeight"] != null ? Convert.ToInt16(ViewState["AddEditWindowHeight"].ToString()) : (short)620;

            }

            set

            {

                ViewState["AddEditWindowHeight"] = value;

            }

        }

 

        #endregion

         #region Page Events

         protected void Page_Load(object sender, EventArgs e)

        {

             }

        protected void rgdProcedureMaster_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)

        {

            if (e.Item is GridFilteringItem)

            {

                if (hdnFilter.Value == "")

                    e.Item.Display = false;

            }

            else if (e.Item is GridDataItem)

            {

                GridDataItem item = (GridDataItem)e.Item;

                ImageButton ibtn = null;

 

                ibtn = (ImageButton)item["ibtnEdit"].Controls[0];

                if (ibtn != null) ibtn.Attributes.Add("onclick", "javascript:openRadWindow('Patient/Management/ProcedureMaster.aspx?&Id=" + DataBinder.Eval(e.Item.DataItem, "Id") + "&CallBackID=" + btnReloadButton.ClientID + "', " + AddEditWindowWidth + "," + AddEditWindowHeight + ",'" + instance.Title + "');");

                ibtn.AlternateText = Utility.ContentFetcher.GetResourceContent("RES_002", BOL.Classes.EHRSessions.Culture);

                ibtn.ToolTip = Utility.ContentFetcher.GetResourceContent("RES_002", BOL.Classes.EHRSessions.Culture);

 

                ibtn = (ImageButton)item["ibtnDelete"].Controls[0];

                ibtn.AlternateText = Utility.ContentFetcher.GetResourceContent("RES_003", BOL.Classes.EHRSessions.Culture);

                ibtn.ToolTip = Utility.ContentFetcher.GetResourceContent("RES_003", BOL.Classes.EHRSessions.Culture);

               

            }

            else if (e.Item is GridPagerItem && !(e.Item as GridPagerItem).IsTopPager)

                rgdProcedureMaster.PagerStyle.AlwaysVisible = (rgdProcedureMaster.MasterTableView != null && rgdProcedureMaster.MasterTableView.DataSourceCount > 5);

 

        }

 

        protected void rgdProcedureMaster_ItemCommand(object sender, GridCommandEventArgs e)

        {

            if (NeedRedirection || WasSessionEnd()) return;

            try

            {

                if (e.CommandName == "Page" || e.CommandName == "ChangePageSize" || e.CommandName == "Sort" || e.CommandName == "Filter")

                {

                    LoadGridColumns();

                    ConfigForm();

                    LoadProcedureData();

                   

                }

                else if (e.CommandName == "Delete")

                {

                    GridDataItem item = (GridDataItem)e.Item;

                    string procedureIds = Convert.ToString(item.GetDataKeyValue("Id")) + ",";

                    Result result = abc.BLL.Master.Management.Procedures.DeleteProcedures(procedureIds, BOL.Classes.EHRSessions.ClinicId, BOL.Classes.EHRSessions.UserId, LanguageCulture.EN_US);

                    if (result.Status)

                    {

                        LoadGridColumns();

                        ConfigForm();

                        LoadProcedureData();

                    }

                }

            }

        }

  

        #endregion

         #region Page Methods

         private void LoadProcedureData()

        {

            Result result = abc.BLL.Master.Management.Procedures.GetProceduresList(0, BOL.Classes.EHRSessions.ClinicId, LanguageCulture.EN_US, DataFormat.DATASET);

 

            DataTable dt = new DataTable();

            dt.Columns.Add("Id");

            dt.Columns.Add("ProcedureName");

 

            for (int i = 0; i < result.Ds.Tables[0].Rows.Count; i++)

            {

                string pTypeId = "PT_"+result.Ds.Tables[0].Rows[i]["ProcedureTypeLookupId"].ToString();

                bool isExist = false;

                foreach (DataColumn col in dt.Columns)

                {

                    if (pTypeId.Equals(col.ToString()))

                        isExist = true;

                }

                if (!isExist)

                    dt.Columns.Add(pTypeId);

            }

 

            dt.Columns.Add("RecordStatusLookupDisplayValue");

            dt.Columns.Add("CT_1");

            dt.Columns.Add("CTA_1");

 

            for (int i = 0; i < result.Ds.Tables[0].Rows.Count; i++)

            {

                 int tmpId = Convert.ToInt32(result.Ds.Tables[0].Rows[i]["Id"].ToString());

                string pName = result.Ds.Tables[0].Rows[i]["ProcedureName"].ToString();

                string dvalue = "PT_"+result.Ds.Tables[0].Rows[i]["ProcedureTypeLookupId"].ToString();

 

                if (dt.Rows.Count == 0)

                {

                    DataRow dr = dt.NewRow();

                    dr["Id"] = result.Ds.Tables[0].Rows[i]["Id"];

                    dr["ProcedureName"] = result.Ds.Tables[0].Rows[i]["ProcedureName"];

                    dr["RecordStatusLookupDisplayValue"] = result.Ds.Tables[0].Rows[i]["RecordStatusLookupDisplayValue"];

                    dr["CT_1"] = result.Ds.Tables[0].Rows[i]["CT_1"];

                    dr["CTA_1"] = result.Ds.Tables[0].Rows[i]["CTA_1"];

                    foreach (DataColumn dc in dt.Columns)

                    {

                        if (dvalue.Equals(dc.ColumnName.ToString()))

                            dr[dc.ColumnName] = "√";

                    }

                    dt.Rows.Add(dr);

                }

                else if (dt.Rows.Count > 0)

                {

                    dt.DefaultView.RowFilter = "Id=" + tmpId;

                    if (dt.DefaultView.Count > 0)

                    {

                        foreach (DataColumn dc in dt.Columns)

                        {

                            if (dvalue.Equals(dc.ColumnName.ToString()))

                                dt.DefaultView[0][dc.ColumnName] = "√";

                        }

                    }

                    else

                    {

                        DataRow dr1 = dt.NewRow();

                        dr1["Id"] = result.Ds.Tables[0].Rows[i]["Id"];

                        dr1["ProcedureName"] = result.Ds.Tables[0].Rows[i]["ProcedureName"];

                       

                        foreach (DataColumn dc in dt.Columns)

                        {

                            if (dvalue.Equals(dc.ColumnName.ToString()))

                                dr1[dc.ColumnName] = "√";

                        }

 

                        dr1["RecordStatusLookupDisplayValue"] = result.Ds.Tables[0].Rows[i]["RecordStatusLookupDisplayValue"];

                        dr1["CT_1"] = result.Ds.Tables[0].Rows[i]["CT_1"];

                        dr1["CTA_1"] = result.Ds.Tables[0].Rows[i]["CTA_1"];

 

                        dt.Rows.Add(dr1);

                    }

                }

            }

             dt.DefaultView.RowFilter = "";

            rgdProcedureMaster.DataSource = dt.DefaultView;

            rgdProcedureMaster.DataBind();

 

            bool needFilterAndSort = (dt.DefaultView != null && dt.DefaultView.Count > 0);

             lnkFilter.Style.Add("display", (needFilterAndSort ? "''" : "none"));

 

            //If filter not needed then reset the value in hdnFilter

            if (!needFilterAndSort) hdnFilter.Value = string.Empty;

            rgdProcedureMaster.AllowSorting = needFilterAndSort;

        }

 

        private void LoadGridColumns()

        {

            String lookupValues = LookupType.ProcedureType.ToString();

            Result result = BLL.Master.LookupReference.GetLookupReferenceList(lookupValues, BOL.Classes.EHRSessions.ClinicId, (LanguageCulture)BOL.Classes.EHRSessions.CultureId, ResultFormat.ILIST);

            BindDynamicColumns(result.LookupReferenceList, LookupType.ProcedureType.ToString());

         }

 

        private void BindDynamicColumns(IList<BOL.Master.LookupReference> iList, string lookUpType)

        {

            List<BOL.Master.LookupReference> results = iList.Where(d => d.LookupType == lookUpType).ToList();

 

            GridBoundColumn gbc;

 

            gbc = new GridBoundColumn();

            gbc.HeaderText = "Custome Field 2";

            gbc.DataField = "CTA_1";

            gbc.SortExpression = "CTA_1";

            gbc.UniqueName = "CTA_1";

            gbc.AutoPostBackOnFilter = false;

            gbc.CurrentFilterFunction = GridKnownFunction.Contains;

            gbc.FilterListOptions = GridFilterListOptions.VaryByDataType;

            gbc.ShowFilterIcon = true;

            gbc.DataType = System.Type.GetType("System.String");

            gbc.Visible = false;

            rgdProcedureMaster.MasterTableView.Columns.AddAt(0, gbc);

           

            gbc = new GridBoundColumn();

            gbc.HeaderText = "Custome Field 1";

            gbc.DataField = "CT_1";

            gbc.SortExpression = "CT_1";

            gbc.UniqueName = "CT_1";

            gbc.AutoPostBackOnFilter = false;

            gbc.CurrentFilterFunction = GridKnownFunction.Contains;

            gbc.FilterListOptions = GridFilterListOptions.VaryByDataType;

            gbc.ShowFilterIcon = true;

            gbc.Visible = false;

            rgdProcedureMaster.MasterTableView.Columns.AddAt(0, gbc);

   

            gbc = new GridBoundColumn();

            gbc.HeaderText = "Status";

            gbc.DataField = "RecordStatusLookupDisplayValue";

            gbc.SortExpression = "RecordStatusLookupDisplayValue";

            gbc.UniqueName = "RecordStatusLookupDisplayValue";

            gbc.AutoPostBackOnFilter = false;

            gbc.CurrentFilterFunction = GridKnownFunction.Contains;

            gbc.FilterListOptions = GridFilterListOptions.VaryByDataType;

            gbc.ShowFilterIcon = true;

            gbc.Visible = false;

            rgdProcedureMaster.MasterTableView.Columns.AddAt(0, gbc);

 

            for (int i = 0; i < results.Count; i++)

 

            {

                gbc = new GridBoundColumn();

                gbc.HeaderText = results[i].DisplayValue;

                gbc.DataField = "PT_" + results[i].Id.ToString();

                gbc.SortExpression = "PT_" + results[i].Id.ToString();

                gbc.UniqueName = "PT_" + results[i].Id.ToString();

                gbc.AutoPostBackOnFilter = false;

                gbc.CurrentFilterFunction = GridKnownFunction.Contains;

                gbc.FilterListOptions = GridFilterListOptions.VaryByDataType;

                gbc.ShowFilterIcon = true;

                gbc.ItemStyle.HorizontalAlign = HorizontalAlign.Center;

                rgdProcedureMaster.MasterTableView.Columns.AddAt(0, gbc);

             

            }

 

            gbc = new GridBoundColumn();

            gbc.HeaderText = "Procedure Name";

            gbc.DataField = "ProcedureName";

            gbc.SortExpression = "ProcedureName";

            gbc.UniqueName = "ProcedureName";

            gbc.AutoPostBackOnFilter = false;

            gbc.CurrentFilterFunction = GridKnownFunction.Contains;

            gbc.FilterListOptions = GridFilterListOptions.VaryByDataType;

            gbc.ShowFilterIcon = true;

            gbc.Visible = false;

            rgdProcedureMaster.MasterTableView.Columns.AddAt(0, gbc);

 

        }

 

         #endregion

        #region Widget Events

         public void Bind(WidgetInstance instance)

        {

            if (NeedRedirection || WasSessionEnd()) return;

            if (!instance.Hidden)

            {

                try

                {

                    ViewState["instance"] = instance.InstanceKey;

                   LoadGridColumns();

                   if (rgdProcedureMaster != null && rgdProcedureMaster.MasterTableView.SortExpressions.Count == 0)

                   {

                       GridSortExpression sortExpression = new GridSortExpression();

                       sortExpression.FieldName = "ProcedureName";

                       sortExpression.SortOrder = GridSortOrder.Ascending;

                       //Add sort expression, which will sort against first column

                       rgdProcedureMaster.MasterTableView.SortExpressions.AddSortExpression(sortExpression);

                   }

                    ConfigForm();

                    ConfigResources();

                    LoadProcedureData();

                 }

                 catch (EHRExceptions ex)

                {

                    System.Web.UI.ScriptManager.RegisterStartupScript(upProcedureMaster, upProcedureMaster.GetType(), "excAlert", "$(document).ready(function(){jAlert('" + Utility.ContentFetcher.GetValidationMessage("GREX_1", BOL.Classes.EHRSessions.Culture) + "');});", true);

                    Utility.MailSender.ExceptionLogger(log, ex.ErrorCode, BOL.Classes.EHRSessions.ClinicId, BOL.Classes.EHRSessions.UserId, ex.Message, ex.GetBaseException());

                }

                catch (Exception ex)

                {

                    System.Web.UI.ScriptManager.RegisterStartupScript(upProcedureMaster, upProcedureMaster.GetType(), "excAlert", "$(document).ready(function(){jAlert('" + Utility.ContentFetcher.GetValidationMessage("GREX_1", BOL.Classes.EHRSessions.Culture) + "');});", true);

                    Utility.MailSender.ExceptionLogger(log, "abc.Web.UserControls.Patient.Management.ProcedureMaster:001 - Bind", BOL.Classes.EHRSessions.ClinicId, BOL.Classes.EHRSessions.UserId, ex.Message, ex);

                }

            }

        }

 

        public UpdatePanel[] Command(WidgetInstance instance, Kalitte.Dashboard.Framework.WidgetCommandInfo commandData, ref UpdateMode updateMode)

        {

            if (NeedRedirection || WasSessionEnd()) return null;

            UpdatePanel[] upProcedure = null;

 

            try

            {

                if (!instance.Hidden)

                {

                    if (commandData.CommandName == "Reload" || commandData.CommandName == "refresh")

                    {

                        LoadGridColumns();

                        ConfigForm();

                        LoadProcedureData();

                        upProcedure = new UpdatePanel[] { upProcedureMaster };

                    }

                 }

            }

            catch (EHRExceptions ex)

            {

                System.Web.UI.ScriptManager.RegisterStartupScript(upProcedureMaster, upProcedureMaster.GetType(), "excAlert", "$(document).ready(function(){jAlert('" + Utility.ContentFetcher.GetValidationMessage("GREX_1", BOL.Classes.EHRSessions.Culture) + "');});", true);

                Utility.MailSender.ExceptionLogger(log, ex.ErrorCode, BOL.Classes.EHRSessions.ClinicId, BOL.Classes.EHRSessions.UserId, ex.Message, ex.GetBaseException());

            }

            catch (Exception ex)

            {

                System.Web.UI.ScriptManager.RegisterStartupScript(upProcedureMaster, upProcedureMaster.GetType(), "excAlert", "$(document).ready(function(){jAlert('" + Utility.ContentFetcher.GetValidationMessage("GREX_1", BOL.Classes.EHRSessions.Culture) + "');});", true);

                Utility.MailSender.ExceptionLogger(log, "abc.Web.UserControls.Patient.Management.ProcedureMaster:001 - Command", BOL.Classes.EHRSessions.ClinicId, BOL.Classes.EHRSessions.UserId, ex.Message, ex);

            }

             return upProcedure;

        }

         public void InitControl(Kalitte.Dashboard.Framework.WidgetInitParameters parameters)

        {

            if (NeedRedirection || WasSessionEnd()) return;

            try

            {

                instance = parameters.Instance;

                dashboardSurface = parameters.Surface;

 

            }

            catch (EHRExceptions ex)

            {

                System.Web.UI.ScriptManager.RegisterStartupScript(upProcedureMaster, upProcedureMaster.GetType(), "excAlert", "$(document).ready(function(){jAlert('" + Utility.ContentFetcher.GetValidationMessage("GREX_1", BOL.Classes.EHRSessions.Culture) + "');});", true);

                Utility.MailSender.ExceptionLogger(log, ex.ErrorCode, BOL.Classes.EHRSessions.ClinicId, BOL.Classes.EHRSessions.UserId, ex.Message, ex.GetBaseException());

            }

            catch (Exception ex)

            {

                System.Web.UI.ScriptManager.RegisterStartupScript(upProcedureMaster, upProcedureMaster.GetType(), "excAlert", "$(document).ready(function(){jAlert('" + Utility.ContentFetcher.GetValidationMessage("GREX_1", BOL.Classes.EHRSessions.Culture) + "');});", true);

                Utility.MailSender.ExceptionLogger(log, "abc.Web.UserControls.Patient.Management.ProcedureMaster:001 - InitControl", BOL.Classes.EHRSessions.ClinicId, BOL.Classes.EHRSessions.UserId, ex.Message, ex);

            }

        }

         #endregion

     }

}

 

Ascx.

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ProcedureMaster.ascx.cs"

    Inherits="abc.Web.UserControls.Patient.Management.ProcedureMaster" %>

<asp:UpdatePanel ID="upProcedureMaster" runat="server" UpdateMode="Conditional">

    <ContentTemplate>

        <div id="<%= abc.BOL.FormDetails.ClinicManagement_ProcedureMaster.ToString() %>"

            class="widget_container clearfix">

            <!-- menu bar starts -->

            <div class="wid_menu_bar clearfix">

                <div class="right">

                    <div class="left">

                        <img src='<%=ResolveUrl("~/App_Themes/Bari_Default/images/wid_menubar_left.png") %>'

                            alt="Icon bar left image" /></div>

                    <div class="wid_icons left">

                        <ul>

                            <li><a id="lnkFilter" href="javascript:void(0);" runat="server">

                                <img id="imgFilter" src="~/App_Themes/Bari_Default/images/filter_ico.png" alt="Filter"

                                    title="Filter" class="v_middle" runat="server" />&nbsp;<asp:Label ID="lblFilter"

                                        runat="server" Text="Filter"></asp:Label></a></li>

                            <li><a href="javascript:void(0);" id="lbtnPrint" runat="server">

                                <img id="imgPrint" src="~/App_Themes/Bari_Default/images/print_ico.png" alt="Print"

                                    title="Print" class="v_middle" runat="server" />&nbsp;<asp:Label ID="lblPrint" runat="server"

                                        Text="Print"></asp:Label></a></li>

                            <li><a id="lnkProcedureMasterAdd" href="javascript:void(0);" runat="server" style="display: none">

                                <img id="imgAdd" src="~/App_Themes/Bari_Default/images/add_ico.png" alt="Add" title="Add"

                                    class="v_middle" runat="server" />&nbsp;<asp:Label ID="lblAdd" runat="server" Text="Add"></asp:Label></a></li>

                        </ul>

                    </div>

                </div>

            </div>

            <!-- menu bar ends -->

            <!-- widget content starts -->

            <div id="pop_middle_Management_ProcedureMaster" class="wid_middle" runat="server">

                <!-- Custom fields starts -->

                <table class="table_container">

                    <tr>

                        <td class="pop_col_width">

                            <telerik:RadGrid ID="rgdProcedureMaster" runat="server" AllowPaging="True" GridLines="Vertical"

                                AutoGenerateColumns="False" EnableEmbeddedSkins="False" Skin="BariRC" AllowSorting="True"

                                AllowFilteringByColumn="True" PageSize="5" OnItemDataBound="rgdProcedureMaster_ItemDataBound"

                                CellSpacing="0" OnItemCommand="rgdProcedureMaster_ItemCommand" EnableViewState="True">

                                <GroupingSettings CaseSensitive="false" />

                                <SortingSettings EnableSkinSortStyles="false" />

                                <ClientSettings>

                                    <ClientEvents OnFilterMenuShowing="FilterMenuShowing" />

                                </ClientSettings>

                                <MasterTableView DataKeyNames="Id"  EnableColumnsViewState="False">

                                    <Columns>

                                        <telerik:GridButtonColumn UniqueName="ibtnEdit" HeaderText="Edit" ImageUrl="~/App_Themes/Bari_Default/images/edit_ico.png"

                                            ButtonType="ImageButton" Visible="False" FilterImageToolTip="" />

                                        <telerik:GridButtonColumn UniqueName="ibtnDelete" HeaderText="Delete" ImageUrl="~/App_Themes/Bari_Default/images/delete_ico.png"

                                            ButtonType="ImageButton" Visible="False" CommandName="Delete" ConfirmDialogType="RadWindow"

                                            FilterImageToolTip="" />

                                    </Columns>

                                </MasterTableView>

                                <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_BariRC" EnableEmbeddedSkins="False">

                                </HeaderContextMenu>

                            </telerik:RadGrid>

                        </td>

                    </tr>

                </table>

            </div>

            <!-- widget content ends -->

        </div>

        <input id="hdnFilter" type="hidden" value="" runat="server" />

        <div style="display: none">

            <asp:Button ID="btnReloadButton" runat="server" Style="display: none" OnClick="btnReloadButton_Click" /></div>

    </ContentTemplate>

</asp:UpdatePanel>

 

 

 

Pavlina
Telerik team
 answered on 20 Sep 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?