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

I have a Radgrid on my aspx page which is using Nested View Template for drill down of data based on a datakeyname in the first level.
I want to disable the drilldown ability only for the first row and keep it as is for rest of the rows in Radgrid.
This is because the first row on drill down does not contain any data, in any case in our implementation.
Hence, drill down for first row needs to be disabled.
Please let me know if it is possible to do that.
Jayesh Goyani
Top achievements
Rank 2
 answered on 03 Nov 2011
3 answers
175 views
Hello,

Last year I had this problemDate 10/17/2010 is not a valid date? bug? I could not solve, and did not give more priority to it.

Now, after almost a year, need to resolve this to avoid problems with customers.

When I select the date from the calendar by 16/10/2011 telerik, telerik put the date 15/10/2011 in RadDatePicker.
I tried to fix this in the event ClientEvents-OnDateSelected, changing the time the date 16/10/2011, but in the same way, the telerik days back the date to 15/10/2011.
I also tried changing the date directly in DateInput (get_dateInput().set_value("16/10/2011")), but the telerik also changes the date to 15/10/2011.
Vasil
Telerik team
 answered on 03 Nov 2011
1 answer
54 views


Hi ,

My requirement is to diaplay data in TreeStructure .So I have chosen RadTreelist because I need to select an Item or items.

My requirement  is to  ,when expanding a heading  should dispaly  radtreelist.Under this radtreelist I need another heading .
when expanding the second heading should diplay another radtreelist.

How is it possible?Is it possible for adding RadTreeList inside another RadTreeList ? how ?


Thanks,
Sindu.

.
Marin
Telerik team
 answered on 03 Nov 2011
1 answer
74 views
I want to refresh a RadGrid using RadTicker. Each time the RadGrid must refresh and bring the new data from Sql database.
Back end am using C# code.

Thanks in Advance. :) 
Sebastian
Telerik team
 answered on 03 Nov 2011
3 answers
76 views
Hi,
        I am using Customized Advance form in radscheduler. ZIndex is not working for RadSchedulerRecurrenceEditor, in that Calendar is going beyond the pop up. I am not able to select the value from Calendar. Please look into my attached file for better understanding.
Kate
Telerik team
 answered on 03 Nov 2011
0 answers
85 views
I am using RADUplaod Telerik control

Issue : When i am trying to upload small file. The progress bar initially showed activity but did not update the percentage and then suddenly the entire file was uploaded and showing 100%. Can't we show the progress correctly. For the case of large file - it is showing progress till last 5 seconds left, then it stuck for 5 second and file got uploaded. I dont want to show 2 progress bars actually i want to show only 1 progress bar with smooth transition.

Can you please help me out to solve this issue. 

Below are the code lines i wrote in my page.

(In *.aspx)
 <telerik:RadUpload ID="Radupload1" runat="server" InitialFileInputsCount="1" TargetFolder="~Temp"
                                    TargetPhysicalFolder="C:\Temp" ControlObjectsVisibility="None" />
  <asp:Button ID="buttonSubmit" runat="server" Text="Upload" OnClientClick="SetFileFromUpload(); StopSessionTimers();return ValidateCheck()"
                                    OnClick="buttonSubmit_Click" CssClass="btn" />

  <telerik:RadProgressManager ID="Radprogressmanager1" runat="server" />
  <telerik:RadProgressArea ID="RadProgressArea1" runat="server" Localization-EstimatedTime="Estimated time"
     Localization-TransferSpeed="Speed" DisplayCancelButton="false" Width="375px" OnClientSubmitting="submit" OnClientProgressUpdating="RadProgressArea1_OnClientProgressUpdating" ProgressIndicators="TransferSpeed,TimeEstimated,TimeElapsed,FilesCountBar,FilesCount,CurrentFileName,FilesCountPercent,RequestSize,TotalProgress, TotalProgressBar,TotalProgressPercent">
 </telerik:RadProgressArea>

On aspx.cs
protected void buttonSubmit_Click(object sender, System.EventArgs e)
    {
        Radupload1.TargetFolder = @"Temp";
            if (Radupload1.UploadedFiles.Count > 0)
            {
             const int total = 100;
            RadProgressContext progress = RadProgressContext.Current;
            progress.SecondaryTotal = total;
            for (int i = 0; i < total; i++)
            {
                progress.SecondaryValue = i;
                progress.SecondaryPercent = i;
                progress.CurrentOperationText = "Step " + i.ToString();

    if (!Response.IsClientConnected)
                {
                    break;                     //Cancel button was clicked or the browser was closed, so stop processing
                }
                System.Threading.Thread.Sleep(100);                //Stall the current thread for 0.1 seconds
            }
      }
}

Thanks
Vandana
Vandana
Top achievements
Rank 1
 asked on 03 Nov 2011
1 answer
65 views

If you define a custom palette in RadChart and use the LoadFromXml() method, the control will throw an error in FillStyle.GetHashCode().  Basically, what I think is going on there is that the PalettesCollection.GetPalette() method is throwing an error because the "CustomPalettes" property has not yet loaded the custom palette that is defined declaratively in the control’s XML markup on the aspx page.

 

Relevant code in Telerik.Charting.PalettesCollection.PalettesCollection.cs:

 

public static Palette GetPalette(string name, Chart chart)

{

      if (!chart.CustomPalettes.Contains(name))

      {

        throw new ChartException(string.Format("There is no Palette with name: {0}", name));

      }

 

      return chart.CustomPalettes.GetPalette(name);

}

 

Declarative definition sample in the aspx page:

<CustomPalettes>

            <telerik:Palette Name="CustomPaletteColorful">

                <Items>

                    <telerik:PaletteItem MainColor="0xff, 0xba, 0x4a" SecondColor="0xff, 0xf4, 0xe3">

                    </telerik:PaletteItem>

                    <telerik:PaletteItem MainColor="0x15, 0xc5, 0x16" SecondColor="0xda, 0xf6, 0xda">

                    </telerik:PaletteItem>

                    <telerik:PaletteItem MainColor="0xff, 0x5b, 0" SecondColor="0xff, 0xe5, 0xd7">

                    </telerik:PaletteItem>

                </Items>

            </telerik:Palette>

</CustomPalettes>
Ves
Telerik team
 answered on 03 Nov 2011
3 answers
194 views
Radtabstrip css is not displaying after postback in Google Chrome but its working in FireFox.

<table width="100%">
                    <tr>
                        <td>
                            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" RegisterWithScriptManager="false">
                            </telerik:RadAjaxLoadingPanel>
                            <asp:UpdatePanel ID="DispalyGrid" runat="server" UpdateMode="Always">
                                <ContentTemplate>
                                    <telerik:RadGrid ID="wRGViewCustomer" runat="server" Width="100%" PageSize="15" OnNeedDataSource="wRGViewCustomer_NeedDataSource"
                                        OnItemCommand="wRGViewCustomer_RowCommand" AllowPaging="True" Skin="WebBlue"
                                        ShowGroupPanel="true" AllowSorting="true" GridLines="None" AutoGenerateColumns="False"
                                        AllowFilteringByColumn="true">
                                        <PagerStyle Mode="NextPrevNumericAndAdvanced"></PagerStyle>
                                        <MasterTableView DataKeyNames="COProductId" AllowMultiColumnSorting="false" GroupLoadMode="Server"
                                            TableLayout="Fixed" EnableHeaderContextMenu="true" >
                                            <PagerStyle Mode="NextPrevNumericAndAdvanced"></PagerStyle>
                                            <NestedViewTemplate>
                                                <asp:Panel runat="server" ID="InnerContainer" Visible="false" BackColor="#BDD097">
                                                    <table width="100%" cellpadding="0" cellspacing="0" border="0">
                                                        <tr>
                                                            <td>
                                                                <telerik:RadTabStrip runat="server" ID="TabStip1" Skin="Forest" MultiPageID="Multipage1"
                                                                    SelectedIndex="0" EnableViewState="true">
                                                                    <Tabs>
                                                                        <telerik:RadTab runat="server" Text="Fitter Order" PageViewID="PageView1">
                                                                        </telerik:RadTab>
                                                                        <telerik:RadTab runat="server" Text="PO" PageViewID="PageView2">
                                                                        </telerik:RadTab>
                                                                        <telerik:RadTab runat="server" Text="Bill" PageViewID="PageView3">
                                                                        </telerik:RadTab>
                                                                    </Tabs>
                                                                </telerik:RadTabStrip>
                                                                <telerik:RadMultiPage runat="server" ID="Multipage1" SelectedIndex="0" EnableViewState="true">
                                                                    <telerik:RadPageView runat="server" ID="PageView1" BorderStyle="Solid" BorderWidth="3"
                                                                        BorderColor="#BDD097" Skin="Forest" Width="99.5%">
                                                                        <div>
                                                                            <table width="100%" cellpadding="0" cellspacing="0" border="0">
                                                                                <tr>
                                                                                </tr>
                                                                                <tr>
                                                                                    <td>
                                                                                        <telerik:RadGrid ID="wRGFO" runat="server" Skin="Telerik" AllowSorting="true" AutoGenerateColumns="false"
                                                                                            GridLines="Both">
                                                                                            <PagerStyle Mode="NumericPages"></PagerStyle>
                                                                                            <MasterTableView DataKeyNames="FOId">
                                                                                                <Columns>
                                                                                                    <telerik:GridBoundColumn UniqueName="DocNo" HeaderText="DocNo" DataField="DocNo">
                                                                                                    </telerik:GridBoundColumn>
                                                                                                    <telerik:GridBoundColumn UniqueName="DocDate" HeaderText="Date" DataField="DocDate">
                                                                                                    </telerik:GridBoundColumn>
                                                                                                    <telerik:GridBoundColumn UniqueName="FitterName" HeaderText="Fitter Name" DataField="FitterName">
                                                                                                    </telerik:GridBoundColumn>
                                                                                                    <telerik:GridBoundColumn UniqueName="Status" HeaderText="Status" DataField="Status">
                                                                                                    </telerik:GridBoundColumn>
                                                                                                    <telerik:GridBoundColumn UniqueName="TotalFee" HeaderText="TotalFee" DataField="TotalFee">
                                                                                                    </telerik:GridBoundColumn>
                                                                                                    <telerik:GridBoundColumn UniqueName="Instruction" HeaderText="Instruction" DataField="Instruction">
                                                                                                    </telerik:GridBoundColumn>
                                                                                                    <telerik:GridBoundColumn UniqueName="Remark" HeaderText="Remark" DataField="Remark">
                                                                                                    </telerik:GridBoundColumn>
                                                                                                </Columns>
                                                                                            </MasterTableView>
                                                                                        </telerik:RadGrid>
                                                                                    </td>
                                                                                </tr>
                                                                            </table>
                                                                        </div>
                                                                    </telerik:RadPageView>
                                                                    <telerik:RadPageView runat="server" BorderStyle="Solid" BorderWidth="3" BorderColor="#BDD097"
                                                                        Skin="Forest" ID="PageView2" Width="99.5%">
                                                                        <div>
                                                                            <table width="100%" cellpadding="0" cellspacing="0" border="0">
                                                                                <tr>
                                                                                    <td>
                                                                                        <telerik:RadGrid ID="wRGPO" runat="server" Skin="Telerik" AllowSorting="true" AutoGenerateColumns="false"
                                                                                            GridLines="Both">
                                                                                            <MasterTableView DataKeyNames="POId">
                                                                                                <Columns>
                                                                                                    <telerik:GridBoundColumn UniqueName="docno" HeaderText="Doc No" DataField="docno">
                                                                                                    </telerik:GridBoundColumn>
                                                                                                    <telerik:GridBoundColumn UniqueName="docdate" HeaderText="Date" DataField="docdate"
                                                                                                        DataFormatString="{0:d}">
                                                                                                    </telerik:GridBoundColumn>
                                                                                                    <telerik:GridBoundColumn UniqueName="supplierName" HeaderText="Supplier Name" DataField="supplierName">
                                                                                                    </telerik:GridBoundColumn>
                                                                                                    <telerik:GridBoundColumn UniqueName="status" HeaderText="status" DataField="status"
                                                                                                        DataFormatString="{0:d}">
                                                                                                    </telerik:GridBoundColumn>
                                                                                                </Columns>
                                                                                            </MasterTableView>
                                                                                        </telerik:RadGrid>
                                                                                    </td>
                                                                                </tr>
                                                                            </table>
                                                                        </div>
                                                                    </telerik:RadPageView>
                                                                    <telerik:RadPageView runat="server" BorderStyle="Solid" BorderWidth="3" BorderColor="#BDD097"
                                                                        Skin="Forest" ID="PageView3" Width="99.5%">
                                                                        <div>
                                                                            <table width="100%" cellpadding="0" cellspacing="0" border="0">
                                                                                <tr>
                                                                                    <td>
                                                                                        <telerik:RadGrid ID="wRGBill" runat="server" Skin="Telerik" AllowSorting="true" AutoGenerateColumns="false"
                                                                                            GridLines="Both">
                                                                                            <MasterTableView DataKeyNames="POId">
                                                                                                <Columns>
                                                                                                    <telerik:GridBoundColumn UniqueName="docno" HeaderText="Doc No" DataField="docno">
                                                                                                    </telerik:GridBoundColumn>
                                                                                                    <telerik:GridBoundColumn UniqueName="docdate" HeaderText="Date" DataField="docdate"
                                                                                                        DataFormatString="{0:d}">
                                                                                                    </telerik:GridBoundColumn>
                                                                                                    <telerik:GridBoundColumn UniqueName="supplierName" HeaderText="Supplier Name" DataField="supplierName">
                                                                                                    </telerik:GridBoundColumn>
                                                                                                    <telerik:GridBoundColumn UniqueName="status" HeaderText="status" DataField="status"
                                                                                                        DataFormatString="{0:d}">
                                                                                                    </telerik:GridBoundColumn>
                                                                                                </Columns>
                                                                                            </MasterTableView>
                                                                                        </telerik:RadGrid>
                                                                                    </td>
                                                                                </tr>
                                                                            </table>
                                                                        </div>
                                                                    </telerik:RadPageView>
                                                                </telerik:RadMultiPage>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </asp:Panel>
                                            </NestedViewTemplate>
                                            <Columns>
                                                <telerik:GridBoundColumn UniqueName="AccountName" HeaderText="DocNo" DataField="docno"
                                                    FilterControlWidth="20px" HeaderStyle-Width="5%">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn UniqueName="docdate" HeaderText="DocDate" HeaderStyle-Width="11%"
                                                    DataField="docdate">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn UniqueName="DueDate" HeaderText="DueDate" HeaderStyle-Width="11%"
                                                    DataField="DueDate">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn UniqueName="PartyName" HeaderText="Name" HeaderStyle-Width="11%" FilterControlWidth="40px"
                                                    DataField="PartyName">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn UniqueName="PartyAddress" HeaderText="Address" HeaderStyle-Width="12%"
                                                    DataField="PartyAddress">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn UniqueName="MobileNo" HeaderText="MobileNo" HeaderStyle-Width="7%"
                                                    FilterControlWidth="40px" DataField="MobileNo">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn UniqueName="PhoneNo" HeaderText="PhoneNo" HeaderStyle-Width="7%"
                                                    FilterControlWidth="40px" DataField="PhoneNo">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn UniqueName="frameno" HeaderText="FNo" DataField="frameno"
                                                    FilterControlWidth="20px" HeaderStyle-Width="4%">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn UniqueName="productdescription" HeaderText="ProductDescription"
                                                    FilterControlWidth="170px" DataField="productdescription" HeaderStyle-Width="22%">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn UniqueName="status" HeaderText="Status" DataField="status"
                                                    FilterControlWidth="30px" HeaderStyle-Width="8%">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridTemplateColumn HeaderText="IsNew" HeaderStyle-Width="6%" ReadOnly="true" FilterControlWidth="25px">
                                                    <ItemTemplate>
                                                        <asp:CheckBox ID="chknew" Checked='<%#Bind("NewProduct") %>' runat="server" ShowFilterIcon="false" Enabled="false" />
                                                    </ItemTemplate>
                                                </telerik:GridTemplateColumn>
                                            </Columns>
                                            <HeaderStyle HorizontalAlign="Left" />
                                        </MasterTableView>
                                    </telerik:RadGrid>
                                </ContentTemplate>
                            </asp:UpdatePanel>
                        </td>
                    </tr>
                </table>
Dimitar Terziev
Telerik team
 answered on 03 Nov 2011
1 answer
107 views

 

We are using radgrid with lot of controls within radgrid. Please find the code aspx code for this radgrid controls
  
<asp:RadGrid ID="grdTimesheet" runat="server" GridLines="Both" OnNeedDataSource="grdTimesheet_NeedDataSource"
OnItemDataBound="grdTimesheet_ItemDataBound" OnPreRender="grdTimesheet_PreRender"
OnItemCommand="grdTimesheet_ItemCommand" ClientSettings-AllowColumnsReorder="true"
ShowFooter="true" ShowHeader="true">
<MasterTableView EditMode="InPlace" CommandItemDisplay="Top" AutoGenerateColumns="false">
<Columns>
<telerik:GridCheckBoxColumn HeaderText="<%$ Resources:Culture, grdTimesheethdrSubmit %>"
UniqueName="IsSubmitted" DataField="IsSubmitted" ReadOnly="true" HeaderStyle-HorizontalAlign="Center"
ItemStyle-HorizontalAlign="center" FooterStyle-HorizontalAlign="Center" FooterStyle-Font-Bold="true"
FooterStyle-VerticalAlign="Middle" HeaderStyle-Width="70px" ItemStyle-BackColor="#F5F5F5" />
<telerik:GridTemplateColumn UniqueName="Site" HeaderText="<%$ Resources:Culture, grdTimesheethdrSite %>"
DataField="Site_Key" ItemStyle-HorizontalAlign="center" HeaderStyle-Width="70px"
HeaderStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:TextBox Text='<%#DataBinder.Eval(Container.DataItem,"SiteFormattedID") %>' runat="server"
Style="width: 68px;" />
<table id="cmbSite" runat="server" border="0" cellpadding="0" cellspacing="0" style="width: 100%;
height: 100%">
<tr>
<td>
<asp:TextBox class="input" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"SiteFormattedID") %>' />
</td>
<td>
<asp:Image ID="btnImg" runat="server" Height="17px" Width="20px" ImageUrl="~/Images/ellipse.png" />
</td>
</tr>
</table>
<asp:HiddenField ID="hdnSitetext" runat="server" Value='<%#DataBinder.Eval(Container.DataItem,"SiteFormattedID") %>' />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="ProfCtr" HeaderText="<%$ Resources:Culture, grdTimesheethdrProfCenter %>"
DataField="Profit_Center_Key" ItemStyle-HorizontalAlign="center" HeaderStyle-Width="90px"
HeaderStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:TextBox Text='<%#DataBinder.Eval(Container.DataItem,"Profit_Center_Key") %>'
runat="server" />
<telerik:RadComboBox runat="server" ID="cmbProfCtr" ShowToggleImage="true" Width="100%"
DropDownWidth="100px" OnClientSelectedIndexChanged="showSelected" OnClientDropDownClosed="OnClientDropDownClosedHandler"
OnClientBlur="OnClientBlur" MarkFirstMatch="true" />
<asp:HiddenField ID="hdnProfCtr" Value='<%#DataBinder.Eval(Container.DataItem,"Profit_Center_Key") %>'
runat="server" />
<asp:HiddenField ID="hdnProfCtrtext" Value='' runat="server" />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="WorkType" HeaderText="<%$ Resources:Culture, grdTimesheethdrWrkType %>"
HeaderStyle-Width="77px" ItemStyle-Height="25px" HeaderStyle-HorizontalAlign="Center"
ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:TextBox Text='<%#DataBinder.Eval(Container.DataItem,"WorkType_Name") %>' runat="server" />
<telerik:RadComboBox runat="server" ID="cmbWorkType" ShowToggleImage="true" Width="100%"
DropDownWidth="200px" OnClientSelectedIndexChanged="itemText" OnClientDropDownClosed="OnClientDropDownClosedHandler"
OnClientBlur="OnClientBlur" MarkFirstMatch="true" />
<asp:HiddenField ID="hdnWorkType" Value='<%#DataBinder.Eval(Container.DataItem,"WorkType_KeyAndCategory") %>'
runat="server" />
<asp:HiddenField ID="hdnWorkTypetext" Value='' runat="server" />
<asp:HiddenField ID="hdnWorkTypeCode" Value='<%#DataBinder.Eval(Container.DataItem,"WorkType_Name") %>'
runat="server" />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn UniqueName="Category" HeaderText="<%$ Resources:Culture, grdTimesheethdrCategory %>"
DataField="WorkType_Category" ItemStyle-HorizontalAlign="center" HeaderStyle-HorizontalAlign="Center"
ItemStyle-VerticalAlign="Middle" FooterStyle-Font-Bold="true" FooterStyle-HorizontalAlign="Center"
FooterStyle-VerticalAlign="Middle" HeaderStyle-Width="70px" ReadOnly="true" ItemStyle-BackColor="#F5F5F5"
ItemStyle-ForeColor="Black">
</telerik:GridBoundColumn>
<telerik:GridCheckBoxColumn HeaderText="<%$ Resources:Culture, grdTimesheethdrTimecard %>"
UniqueName="IsTimeCard" DataField="IsTimeCardEntry" ReadOnly="true" HeaderStyle-HorizontalAlign="Center"
ItemStyle-HorizontalAlign="center" FooterStyle-HorizontalAlign="Center" FooterStyle-Font-Bold="true"
FooterStyle-VerticalAlign="Middle" HeaderStyle-Width="70px" ItemStyle-BackColor="#F5F5F5" />
<telerik:GridBoundColumn HeaderText="Day1" UniqueName="Day1" DataField="Day1" HeaderStyle-HorizontalAlign="Center"
HeaderStyle-Width="73px" FooterStyle-HorizontalAlign="Center" FooterStyle-Font-Bold="true"
FooterStyle-VerticalAlign="Middle" />
<telerik:GridBoundColumn HeaderText="Day2" UniqueName="Day2" DataField="Day2" HeaderStyle-HorizontalAlign="Center"
HeaderStyle-Width="73px" FooterStyle-HorizontalAlign="Center" FooterStyle-Font-Bold="true"
FooterStyle-VerticalAlign="Middle" />
<telerik:GridBoundColumn HeaderText="Day3" UniqueName="Day3" DataField="Day3" HeaderStyle-HorizontalAlign="Center"
HeaderStyle-Width="73px" FooterStyle-HorizontalAlign="Center" FooterStyle-Font-Bold="true"
FooterStyle-VerticalAlign="Middle" />
<telerik:GridBoundColumn HeaderText="Day4" UniqueName="Day4" DataField="Day4" HeaderStyle-HorizontalAlign="Center"
HeaderStyle-Width="73px" FooterStyle-HorizontalAlign="Center" FooterStyle-Font-Bold="true"
FooterStyle-VerticalAlign="Middle" />
<telerik:GridBoundColumn HeaderText="Day5" UniqueName="Day5" DataField="Day5" HeaderStyle-HorizontalAlign="Center"
HeaderStyle-Width="73px" FooterStyle-HorizontalAlign="Center" FooterStyle-Font-Bold="true"
FooterStyle-VerticalAlign="Middle" />
<telerik:GridBoundColumn HeaderText="Day6" UniqueName="Day6" DataField="Day6" HeaderStyle-HorizontalAlign="Center"
HeaderStyle-Width="73px" FooterStyle-HorizontalAlign="Center" FooterStyle-Font-Bold="true"
FooterStyle-VerticalAlign="Middle" />
<telerik:GridBoundColumn HeaderText="Day7" UniqueName="Day7" DataField="Day7" HeaderStyle-HorizontalAlign="Center"
HeaderStyle-Width="73px" FooterStyle-HorizontalAlign="Center" FooterStyle-Font-Bold="true"
FooterStyle-VerticalAlign="Middle" />
<telerik:GridBoundColumn HeaderText="<%$ Resources:Culture, grdTimesheethdrTotal %>"
UniqueName="Total" DataField="Total" ReadOnly="true" ItemStyle-HorizontalAlign="center"
HeaderStyle-HorizontalAlign="Center" FooterStyle-Font-Bold="true" FooterStyle-HorizontalAlign="Center"
FooterStyle-VerticalAlign="Middle" HeaderStyle-Width="55px" ItemStyle-BackColor="#F5F5F5"
ItemStyle-ForeColor="Black" />
<telerik:GridTemplateColumn HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
UniqueName="Delete" ItemStyle-BackColor="#F5F5F5" HeaderStyle-Width="15px">
<ItemTemplate>
<asp:LinkButton ID="lnkDelete" runat="server" CommandName="DeleteSelected">
<img alt="Delete" style="border: 0px; vertical-align: middle; height: 11px; width: 11px;
text-align: center;" src="../../Images/delete.gif" />
</asp:LinkButton>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn UniqueName="RowNumber" DataField="RowNumber" ReadOnly="true"
Visible="false" />
<telerik:GridTemplateColumn UniqueName="OpenShiftDays" Visible="false">
<ItemTemplate>
<asp:HiddenField ID="hdnOpenShiftDays" runat="server" Value='<%#DataBinder.Eval(Container.DataItem,"OpenShiftDays") %>' />
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
<CommandItemTemplate>
<asp:LinkButton ID="btnAddNew" runat="server" CommandName="AddNewRow" uniquename="Add">
<asp:Button ID="btnAddNewImage" Style="border: 0px; vertical-align: middle;" runat="server"
Text="" CommandName="AddNewRow" CssClass="rgAdd" />
Add new row</asp:LinkButton>
</CommandItemTemplate>
</MasterTableView>
<HeaderStyle HorizontalAlign="Center" Font-Bold="true" CssClass="contentArea" />
<ClientSettings AllowColumnsReorder="false" ReorderColumnsOnClient="false" EnablePostBackOnRowClick="false">
<Selecting AllowRowSelect="false" />
<Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="false"
EnableVirtualScrollPaging="false" />
<Resizing ShowRowIndicatorColumn="true" />
<ClientEvents OnRowCreated="onrowcreated" OnGridCreated="ongridcreated" />
</ClientSettings>
</asp:RadGrid>
  
  
And we have 50 to 100 or more than hundreds of records in this radgrid.
And on click of textbox we change the behaviour of other controls (on entry in textbox we need to show either dropdown or textbox).
For achiving this functionlaity we did lot of code behind code (on ItemDatabound and Onprerender) as well as javascript code.
  
Right now our functionality working fine but it would take lot of time to complete or perfomance for this controls very slow as compare to other radgrid in diffrence page.
  
  
Please find the code
  
protected void grdTimesheet_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
try
{
Hashtable hTbl = new Hashtable();
if (Session[WFConstants.TIMESHEET_PARAMS] != null)
{
hTbl = (Hashtable)Session[WFConstants.TIMESHEET_PARAMS];
}
Entities<TimesheetDetail> entTimesheetDetail = ExcelGridSource;
for (int i = 0; i < entTimesheetDetail.TotalRecords; i++)
{
grdTimesheet.EditIndexes.Add(i);
}
//check this timesheet fill from timecard or not
TimesheetDetail timecard = ((TimesheetDetail)entTimesheetDetail.Where<TimesheetDetail>(tsd => tsd.Record_Type == "Worktype" && tsd.IsTimeCardEntry == true).Take<TimesheetDetail>(1).SingleOrDefault());
if (timecard != null)
{
isTimeCardEntry = true;
}
//set the calling page to ViewType variable
GetParentPage();
//toggle visibility of submitted column[it's show only Admin view timesheet]
if (ViewType == TimesheetViewType.Administrator)
{
grdTimesheet.Columns[0].Visible = true; // show submitted column
}
else
{
grdTimesheet.Columns[0].Visible = false;
}
grdTimesheet.Columns[2].Visible = Timesheet_Is_ProfCtr; //toggle visibility of ProfitCenter column
grdTimesheet.Columns[5].Visible = isTimeCardEntry; //toggle visibility of TimeCardEntry column
#region COMMAND ITEM HANDLER
if (e.Item is GridCommandItem)
{
GridCommandItem commandItem = e.Item as GridCommandItem;
LinkButton button = commandItem.FindControl("btnAddNew") as LinkButton;
Button btnImage = commandItem.FindControl("btnAddNewImage") as Button;
//toggle disability of AddNew Row link and image based on Submit and Reopen timesheet.
if ((this.Page as PageBase).SecurityRights == enmSecurityRights.ReadOnly)
{
if (button != null && btnImage != null)
{
button.Enabled = false;
btnImage.Enabled = false;
button.Style.Add("cursor", "default");
}
else
{
button.Attributes.Remove("style");
}
}
else if (hTbl["IsNeedRecalc"] != null && hTbl["IsNeedRecalc"].ToString() != "" && Convert.ToBoolean(hTbl["IsNeedRecalc"].ToString()))
{
if (button != null && btnImage != null)
{
button.Enabled = false;
btnImage.Enabled = false;
button.Style.Add("cursor", "default");
}
else
{
button.Attributes.Remove("style");
}
}
else if (hTbl["TimesheetStatus"] != null && hTbl["TimesheetStatus"].ToString() != "" && hTbl["TimesheetStatus"].ToString() != "1")
{
if (button != null && btnImage != null)
{
button.Enabled = false;
btnImage.Enabled = false;
button.Style.Add("cursor", "default");
}
else
{
button.Attributes.Remove("style");
}
}
else if (IsTimeSheetSubmitted)
{
if (button != null && btnImage != null)
{
button.Enabled = false;
btnImage.Enabled = false;
button.Style.Add("cursor", "default");
}
else
{
button.Attributes.Remove("style");
}
}
}
#endregion
#region HEADER ITEM HANDLER
if (e.Item is GridHeaderItem)
{
GridHeaderItem headerItem = (GridHeaderItem)e.Item;
TimesheetDetail weekday = ((TimesheetDetail)entTimesheetDetail.Where<TimesheetDetail>(tsd => tsd.Record_Type == "Weekday").Take<TimesheetDetail>(1).SingleOrDefault());
TimesheetDetail weekdate = ((TimesheetDetail)entTimesheetDetail.Where<TimesheetDetail>(tsd => tsd.Record_Type == "Weekdate").Take<TimesheetDetail>(1).SingleOrDefault());
headerItem["Day1"].Text = weekday.Day1 + "<BR>" + weekdate.Day1.ToString();
headerItem["Day2"].Text = weekday.Day2 + "<BR>" + weekdate.Day2.ToString();
headerItem["Day3"].Text = weekday.Day3 + "<BR>" + weekdate.Day3.ToString();
headerItem["Day4"].Text = weekday.Day4 + "<BR>" + weekdate.Day4.ToString();
headerItem["Day5"].Text = weekday.Day5 + "<BR>" + weekdate.Day5.ToString();
headerItem["Day6"].Text = weekday.Day6 + "<BR>" + weekdate.Day6.ToString();
headerItem["Day7"].Text = weekday.Day7 + "<BR>" + weekdate.Day7.ToString();
}
#endregion
#region FOOTER ITEM HANDLER
if (e.Item is GridFooterItem)
{
GridFooterItem footer = (GridFooterItem)e.Item;
footer["Day1"].Attributes.Add("name", footer["Day1"].ClientID);
footer["Day2"].Attributes.Add("name", footer["Day2"].ClientID);
footer["Day3"].Attributes.Add("name", footer["Day3"].ClientID);
footer["Day4"].Attributes.Add("name", footer["Day4"].ClientID);
footer["Day5"].Attributes.Add("name", footer["Day5"].ClientID);
footer["Day6"].Attributes.Add("name", footer["Day6"].ClientID);
footer["Day7"].Attributes.Add("name", footer["Day7"].ClientID);
footer["Total"].Attributes.Add("name", footer["Total"].ClientID);
if (isTimeCardEntry)
{
footer["IsTimeCard"].Text = "Total : ";
}
else
{
footer["Category"].Text = "Total : ";
}
TimesheetDetail aggregate = ((TimesheetDetail)entTimesheetDetail.Where<TimesheetDetail>(tsd => tsd.Record_Type == "Aggregate").Take<TimesheetDetail>(1).SingleOrDefault());
footer["Day1"].Text = aggregate.Day1.ToString();
footer["Day2"].Text = aggregate.Day2.ToString();
footer["Day3"].Text = aggregate.Day3.ToString();
footer["Day4"].Text = aggregate.Day4.ToString();
footer["Day5"].Text = aggregate.Day5.ToString();
footer["Day6"].Text = aggregate.Day6.ToString();
footer["Day7"].Text = aggregate.Day7.ToString();
footer["Total"].Text = aggregate.Total.ToString();
}
#endregion
if (e.Item is GridDataItem)
{
GridDataItem dataItem = (GridDataItem)e.Item;
CheckBox chk = (dataItem["IsTimeCard"].Controls[0] as CheckBox);
if (chk != null)
{
if (chk.Checked)
{
dataItem.BackColor = System.Drawing.Color.Red;
//dataItem.Font.Bold = true;
}
}
}
if (e.Item.ItemType == GridItemType.EditItem)
{
GridDataItem item = (GridDataItem)e.Item;
#region Sites Column
TextBox txtboxSite = (TextBox)(item["Site"].Controls[1]);
if (txtboxSite != null)
{
//txtboxSite.Attributes.Add("onblur", "javascript:return showSelected(this)");
string strScript = " return SelectSite(" + txtboxSite.ClientID + ");";
Image img = ((Image)item.FindControl("btnImg"));
if (img != null)
{
img.Attributes.Add("onclick", strScript);
}
}
else
{
txtboxSite.Text = String.Empty;
}
#endregion
#region Profit Center Column
HiddenField hdnProfCtr = (HiddenField)(item["ProfCtr"]).FindControl("hdnProfCtr");
HiddenField hdnSite = (HiddenField)(item["Site"]).FindControl("hdnSitetext");
if (Convert.ToBoolean(hTbl["Timesheet_Is_ProfCtr"]))
{
//Set profit center's formatted id
if (hdnSite != null)
{
List<ProfitCenter> list = new List<ProfitCenter>();
if (Session["profctrSite"] != null)
{
Entities<ProfitCenters> entProfitCenters = (Entities<ProfitCenters>)Session["profctrSite"];
foreach (ProfitCenters pc in entProfitCenters)
{
if (pc.SiteFormattedID == hdnSite.Value)
{
ProfitCenter profctr = new ProfitCenter();
profctr.ProfCtr_Key = pc.ProfCtrKey;
profctr.ProfCtr_Type_Desc = pc.ProfCtrName;
list.Add(profctr);
}
}
}
if (hdnProfCtr != null)
{
ProfitCenter profct = (ProfitCenter)list.Where<ProfitCenter>(pc => pc.ProfCtr_Key == hdnProfCtr.Value).Take<ProfitCenter>(1).SingleOrDefault();
TextBox txtbox = (TextBox)(item["ProfCtr"].Controls[1]);
if (profct != null && txtbox != null)
{
txtbox.Text = profct.ProfCtr_Type_Desc;
if (list.Count == 1)
{
txtbox.Enabled = false;
}
}
else
{
txtbox.Text = string.Empty;
}
HiddenField hdnpc = (HiddenField)(item["ProfCtr"]).FindControl("hdnProfCtrtext"); ;
if (profct != null && hdnpc != null)
{
hdnpc.Value = profct.ProfCtr_Type_Desc;
}
}
RadComboBox rComboBox = (RadComboBox)(item["ProfCtr"]).FindControl("cmbProfCtr");
if (rComboBox != null)
{
UIHelper.ClearComboBoxControl<RadComboBox>(rComboBox);
rComboBox.DataSource = list;
rComboBox.DataTextField = "ProfCtr_Type_Desc";
rComboBox.DataValueField = "ProfCtr_Key";
rComboBox.DataBind();
rComboBox.Items.Insert(0, new RadComboBoxItem(String.Empty, "0"));
rComboBox.SelectedValue = hdnProfCtr.Value;
}
}
}
#endregion
#region Work type column
//Work Types
HiddenField hdnSitetext = (HiddenField)(item["Site"]).FindControl("hdnSitetext");
string siteid = String.Empty;
string profctrid = String.Empty;
string ProfCtr_Type_Key = String.Empty;
if (hdnSitetext != null)
{
siteid = hdnSitetext.Value;
}
if (hdnProfCtr != null)
{
profctrid = hdnProfCtr.Value;
}
List<ValidWorkTypes> WTlist = new List<ValidWorkTypes>();
Entities<EmployeeWeeklyWorkTypes> entAllWorkTypes = EmployeeWorkTypeSource;
if (System.Web.HttpContext.Current.Session[WFConstants.TIMESHEET_PROFITCENTER_SITE] != null)
{
Entities<profdata.com.Entities.Framework.TimeClock.ProfitCenters> entProfitCenters = (Entities<profdata.com.Entities.Framework.TimeClock.ProfitCenters>)System.Web.HttpContext.Current.Session[WFConstants.TIMESHEET_PROFITCENTER_SITE];
ProfitCenters profCtr = (ProfitCenters)(entProfitCenters.Where<ProfitCenters>(pct => pct.ProfCtrKey == profctrid).Take<ProfitCenters>(1).SingleOrDefault());
if (profCtr != null)
{
ProfCtr_Type_Key = profCtr.ProfCtrType;
}
}
string businessEntityID = String.Empty;
if (profctrid == "0") profctrid = String.Empty;
DataTable dtbl = null;
if (Session["EmpAuthorizedSites"] != null)
{
dtbl = (DataTable)Session["EmpAuthorizedSites"];
}
else
{
if (Session[WFConstants.TIMESHEET_PARAMS] != null)
{
hTbl = (Hashtable)Session[WFConstants.TIMESHEET_PARAMS];
if (hTbl != null)
{
string emp_key = hTbl[WFConstants.TIMESHEET_HASHTABLE_EMPLOYEE_KEY].ToString();
string weekendingdate = hTbl[WFConstants.TIMESHEET_HASHTABLE_BUSINESS_ENDDATE].ToString();
UserInfo userInfo = new UserInfo();
CompanySites companySites = new CompanySites();
dtbl = companySites.GetEmployeesAuthorizedSites(userContext, userInfo.GetAssociatedEmployeeListFromContext((Page as PageBase).EmployeeContexts), emp_key, weekendingdate);
}
}
}
if (dtbl != null)
{
DataRow[] dr = dtbl.Select("ID='" + siteid + "'");
if (dr.Length > 0)
{
businessEntityID = dr[0]["BusEnts"].ToString();
}
}
foreach (EmployeeWeeklyWorkTypes ewt in entAllWorkTypes)
{
if (ewt.ProfCtr_Type_Key == String.Empty || ewt.ProfCtr_Type_Key == ProfCtr_Type_Key)
{
if (!String.IsNullOrEmpty(ewt.BusEntID))
{
string[] WTBeArr = ewt.BusEntID.Split(',');
string[] BeArr = businessEntityID.Split(',');
for (int i = 0; i < WTBeArr.Length; i++)
{
if (WTBeArr[i] != String.Empty)
{
for (int j = 0; j < BeArr.Length; j++)
{
if (BeArr[j] != String.Empty && BeArr[j] == WTBeArr[i])
{
ValidWorkTypes obj = new ValidWorkTypes();
obj.WorkTypeCode = ewt.WorkType_Code;
obj.WorkTypeKeyAndCategory = ewt.WorkType_KeyAndCategory;
WTlist.Add(obj);
}
}
}
}
}
else
{
ValidWorkTypes obj = new ValidWorkTypes();
obj.WorkTypeCode = ewt.WorkType_Code;
obj.WorkTypeKeyAndCategory = ewt.WorkType_KeyAndCategory;
WTlist.Add(obj);
}
}
}
HiddenField hdnworktype = (HiddenField)(item["WorkType"]).FindControl("hdnWorkType");
RadComboBox rComboBox_wt = (RadComboBox)(item["WorkType"]).FindControl("cmbWorkType");
if (rComboBox_wt != null)
{
UIHelper.ClearComboBoxControl<RadComboBox>(rComboBox_wt);
rComboBox_wt.DataSource = WTlist;
rComboBox_wt.DataTextField = "WorkTypeCode";
rComboBox_wt.DataValueField = "WorkTypeKeyAndCategory";
rComboBox_wt.DataBind();
rComboBox_wt.Items.Insert(0, new RadComboBoxItem(String.Empty, "0"));
rComboBox_wt.SelectedValue = hdnworktype.Value;
}
if (hdnworktype != null)
{
ValidWorkTypes worktype = (ValidWorkTypes)WTlist.Where<ValidWorkTypes>(pc => pc.WorkTypeKeyAndCategory == hdnworktype.Value).Take<ValidWorkTypes>(1).SingleOrDefault();
TextBox txtbox = (TextBox)(item["WorkType"].Controls[1]);
if (worktype != null && txtbox != null)
{
txtbox.Text = worktype.WorkTypeCode;
if (WTlist.Count == 1)
{
txtbox.Enabled = false;
}
}
else
{
HiddenField hdnworktypeCode = (HiddenField)(item["WorkType"]).FindControl("hdnWorkTypeCode");
if (hdnworktypeCode != null && txtbox != null)
{
txtbox.Text = hdnworktypeCode.Value;
}
}
}
#endregion
}
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void grdTimesheet_PreRender(object sender, EventArgs e)
{
try
{
GetParentPage();
grdTimesheet.Attributes.Add("onkeydown", "onKeyDown(this,event);");
int itemsCount = 0;
int columnsCount = 0;
bool isReadOnlyRow = false;
bool isGridDisabled = false;
bool isNeddRecalc = false;
bool isAllTimeCardEntry = true;
Hashtable hTbl = new Hashtable();
if (Session[WFConstants.TIMESHEET_PARAMS] != null)
{
hTbl = (Hashtable)Session[WFConstants.TIMESHEET_PARAMS];
//btnGoToTimeCard.Visible = false;
if (hTbl != null && hTbl["TimesheetStatus"] != null && hTbl["TimesheetStatus"].ToString() != "" && hTbl["TimesheetStatus"].ToString() != "1")
{
isGridDisabled = true;
}
if (hTbl["ViewType"] != null && hTbl["ViewType"].ToString() != String.Empty)
{
ViewType = (TimesheetViewType)hTbl["ViewType"];
}
if (hTbl["IsNeedRecalc"] != null && hTbl["IsNeedRecalc"].ToString() != "" && Convert.ToBoolean(hTbl["IsNeedRecalc"].ToString()))
{
isNeddRecalc = true;
}
}
CompanySites companySites = new CompanySites();
if (Session["OldTimeSheet"] != null)
{
Entities<TimesheetDetail> entTimesheetDetail = (Entities<TimesheetDetail>)Session["OldTimeSheet"];
// Attach the event handlers to the client side events of the TextBoxes. 
foreach (GridItem item in grdTimesheet.MasterTableView.Items)
{
if (item is GridDataItem)
{
GridDataItem dataItem = (GridDataItem)item;
columnsCount = 0;
isReadOnlyRow = (dataItem["IsTimeCard"].Controls[0] as CheckBox).Checked;
if (!isReadOnlyRow)
{
isAllTimeCardEntry = false;
}
#region toggle visibility of delete icon of a grid
LinkButton lnkDelete = (dataItem["Delete"].Controls[1]) as LinkButton;
if ((this.Page as PageBase).SecurityRights == enmSecurityRights.ReadOnly)
{
if (lnkDelete != null)
{
lnkDelete.Enabled = false;
lnkDelete.Style.Add("cursor", "default");
}
else
{
lnkDelete.Attributes.Remove("style");
}
}
else if (isReadOnlyRow)
{
if (lnkDelete != null)
{
lnkDelete.Visible = false;
}
}
else if (isGridDisabled || IsTimeSheetSubmitted || isNeddRecalc)
{
if (lnkDelete != null)
{
lnkDelete.Enabled = false;
lnkDelete.Style.Add("cursor", "default");
}
else
{
lnkDelete.Attributes.Remove("style");
}
}
#endregion
if (!CheckFunctionalSecurityRights())
{
HiddenField hdnSiteFormatted = dataItem["Site"].Controls[5] as HiddenField;
if (hdnSiteFormatted != null)
{
#region Site Manager foreign site gray out
if (ViewType == TimesheetViewType.SiteManager || ViewType == TimesheetViewType.Administrator)
{
userContext = (this.Page as PageBase).CurrentUserContext;
string site_desc = String.Empty;
string sitekey = companySites.GetSiteKey(userContext, hdnSiteFormatted.Value, out site_desc);
if (entTimesheetDetail.Count > item.ItemIndex && !String.IsNullOrEmpty(entTimesheetDetail[item.ItemIndex].Timesheet_Key) && !String.IsNullOrEmpty(hdnSiteFormatted.Value) && hdnSiteFormatted.Value != "0" && !companySites.IsSitePermitted(userContext, sitekey))
{
dataItem.Enabled = false;
(this.Parent.Page.Master as workforce).DeleteEnabled = false;
if (lnkDelete != null)
{
lnkDelete.Enabled = false;
lnkDelete.Style.Add("cursor", "default");
}
}
}
#endregion
}
}
HiddenField hdnOpenShify = dataItem["OpenShiftDays"].Controls[1] as HiddenField;
for (int i = 2; i < grdTimesheet.MasterTableView.RenderColumns.Length; i++)
{
GridColumn column = grdTimesheet.MasterTableView.RenderColumns[i];
if (column.UniqueName != "IsTimeCard" && column.UniqueName != "Category" && column.UniqueName != "Total")
{
TextBox textBox = (dataItem[column.UniqueName].Controls[0]) as TextBox;
if (textBox != null)
{
textBox.Attributes.Add("style", "text-align:center");
if (isReadOnlyRow || isGridDisabled || IsTimeSheetSubmitted || isNeddRecalc)
{
if (isReadOnlyRow && hdnOpenShify != null && i >= 8 && hdnOpenShify.Value.Contains((i - 7).ToString()))
{
string open = hdnOpenShify.Value;
((TableCell)textBox.Parent).CssClass = "errorSelect";
textBox.Attributes.Add("class", "errorSelect");
textBox.Attributes.Add("disabled", "disabled");
}
else
{
textBox.ReadOnly = true;
textBox.Attributes.Add("class", "input");
((TableCell)textBox.Parent).Style.Add("background-color", "#F5F5F5");
}
}
else
{
textBox.Attributes.Add("onclick", "cellClick('" + textBox.ClientID + "');");
textBox.Attributes.Add("onchange", "horizontalTotal('" + textBox.ClientID + "');");
textBox.Attributes.Add("onblur", "horizontalTotal('" + textBox.ClientID + "');");
textBox.Attributes.Add("onKeyPress", "return checkIt(event);");
if (textBox.Text != String.Empty && !ValidInput(textBox.Text))
{
if (column.UniqueName != "Total")
{
((TableCell)textBox.Parent).CssClass = "errorSelect";
textBox.Attributes.Add("class", "errorSelect");
}
}
else
{
((TableCell)textBox.Parent).CssClass = "";
textBox.Attributes.Add("class", "input");
}
textBox.MaxLength = 5;
}
}
else if (column.UniqueName == "Site")
{
TextBox txtSiteBox = (TextBox)dataItem[column.UniqueName].Controls[1];
if (isReadOnlyRow || isGridDisabled || IsTimeSheetSubmitted || isNeddRecalc)
{
txtSiteBox.Attributes.Add("style", "text-align:center");
txtSiteBox.ReadOnly = true;
txtSiteBox.Attributes.Add("class", "input");
((TableCell)txtSiteBox.Parent).Style.Add("background-color", "#F5F5F5");
}
else
{
HtmlTable tblSite = (dataItem[column.UniqueName].FindControl("cmbSite")) as HtmlTable;
txtSiteBox.Attributes.Add("style", "text-align:center");
txtSiteBox.Attributes.Add("class", "input");
txtSiteBox.Attributes.Add("onclick", "textclick('" + txtSiteBox.ClientID + "');");
tblSite.Attributes.Add("onmouseout", "hideSite('" + txtSiteBox.ClientID + "');");
}
}
else if (column.UniqueName == "ProfCtr" || column.UniqueName == "WorkType")
{
textBox = (TextBox)dataItem[column.UniqueName].Controls[1];
RadComboBox radComboBox = (dataItem[column.UniqueName].FindControl("cmb" + column.UniqueName)) as RadComboBox;
if (textBox != null)
{
if (isReadOnlyRow || isGridDisabled || IsTimeSheetSubmitted || isNeddRecalc)
{
textBox.Attributes.Add("style", "text-align:center");
textBox.ReadOnly = true;
textBox.Attributes.Add("class", "input");
((TableCell)textBox.Parent).Style.Add("background-color", "#F5F5F5");
}
else
{
textBox.Attributes.Add("style", "text-align:center");
textBox.Attributes.Add("class", "input");
textBox.Attributes.Add("onclick", "textclick('" + textBox.ClientID + "');");
}
}
if (radComboBox != null)
{
if (isReadOnlyRow || isGridDisabled || IsTimeSheetSubmitted || isNeddRecalc)
{
radComboBox.Enabled = false;
}
}
}
}
columnsCount++;
}
itemsCount++;
}
else if (item is GridFooterItem)
{
GridFooterItem footerItem = (GridFooterItem)item;
for (int i = 2; i < grdTimesheet.MasterTableView.RenderColumns.Length; i++)
{
GridColumn column = grdTimesheet.MasterTableView.RenderColumns[i];
TextBox textBox = (footerItem[column.UniqueName].Controls[0]) as TextBox;
if (textBox != null)
{
textBox.Text = i.ToString();
}
columnsCount++;
}
}
}
if (grdTimesheet.MasterTableView.Items.Count == 0)
{
isAllTimeCardEntry = false;
}
RadScriptManager.RegisterStartupScript(Page, Page.GetType(), "init", "colls = " + 17 + ";rows=" + itemsCount + ";", true);
//Set buttons visibility
btnSubmit.Text = "Submit";
btnComments.Visible = false;
// Do not show comments when Timesheet is not created
if (hTbl["TimesheetKey"] != null && hTbl["TimesheetKey"].ToString() != String.Empty)
{
btnComments.Visible = (ViewType != TimesheetViewType.Employee ? true : false);
btnRevalidateTimecard.Visible = (ViewType != TimesheetViewType.Employee ? true : false);
if (hTbl["TimeCardErrors"] != null && hTbl["TimeCardErrors"].ToString() != String.Empty && hTbl["TimeCardErrors"].ToString() != "0")
{
if (isTimeCardEntry)
{
btnRevalidateTimecard.Enabled = true;
}
}
btnComments.Text = "Show Comments (" + Comments + ")...";
//btnSubmit.Visible = true;
if (hTbl != null && (hTbl["TimesheetStatus"].ToString() == "" || hTbl["TimesheetStatus"].ToString() == "1"))
{
btnSubmit.Text = "Submit";
}
else
{
btnSubmit.Text = "Reopen";
}
}
btnGoToTimeCard.Enabled = isTimeCardEntry; // enabled if there is at least one timecard entry
btnAuditHistory.Visible = (ViewType != TimesheetViewType.Employee ? true : false); //visible to site manger and administrator
btnApprovalStatus.Visible = (ViewType != TimesheetViewType.Employee ? true : false); //visible to only administrator
if (IsTimeSheetSubmitted)
{
btnSubmit.Text = "Reopen";
}
if (grdTimesheet.MasterTableView.Items.Count == 0 || isNeddRecalc ||
(hTbl.Contains("TimeCardErrors") && !String.IsNullOrEmpty(hTbl["TimeCardErrors"].ToString())
&& int.Parse(hTbl["TimeCardErrors"].ToString()) > 0))
{
btnSubmit.Enabled = false;
}
else
{
btnSubmit.Enabled = true;
}
if (isAllTimeCardEntry && ViewType == TimesheetViewType.Employee)
{
btnSubmit.Visible = false;
}
else
{
btnSubmit.Visible = true;
}
// Do not show comments when Timesheet is not created
if (hTbl["TimesheetKey"] != null && hTbl["TimesheetKey"].ToString() != String.Empty)
{
btnComments.Visible = (ViewType != TimesheetViewType.Employee ? true : false);
btnRevalidateTimecard.Visible = (ViewType != TimesheetViewType.Employee ? true : false);
if (hTbl["TimeCardErrors"] != null && hTbl["TimeCardErrors"].ToString() != String.Empty && hTbl["TimeCardErrors"].ToString() != "0")
{
if (isTimeCardEntry)
{
btnRevalidateTimecard.Enabled = true;
}
}
btnComments.Text = "Show Comments (" + Comments + ")...";
//btnSubmit.Visible = true;
//if (hTbl != null && (hTbl["TimesheetStatus"].ToString() == "" || hTbl["TimesheetStatus"].ToString() == "1"))
//{
// btnSubmit.Enabled = true;
// btnSubmit.Text = "Submit";
//}
//else
//{
// btnSubmit.Enabled = true;
// btnSubmit.Text = "Reopen";
//}
}
if (grdTimesheet.MasterTableView.Items.Count == 0 && btnSubmit.Text == "Submit")
{
btnSubmit.Enabled = false;
}
if ((this.Page as PageBase).SecurityRights == enmSecurityRights.ReadOnly)
{
btnRevalidateTimecard.Enabled = false;
btnSubmit.Enabled = false;
}
}
ResetDirtyChanges();
}
catch (Exception ex)
{
throw ex;
}
}
/// <summary>
/// 
/// </summary>
/// <param name="source"></param>
/// <param name="e"></param>
protected void grdTimesheet_ItemCommand(object source, GridCommandEventArgs e)
{
try
{
saveTimesheetDetails();
switch (e.CommandName)
{
case "InsertNewRow":
{
//if submitted fo not add a new row
if (Session[WFConstants.TIMESHEET_PARAMS] != null)
{
Hashtable hTbl = new Hashtable();
hTbl = (Hashtable)Session[WFConstants.TIMESHEET_PARAMS];
if (hTbl != null && hTbl["TimesheetStatus"] != null && hTbl["TimesheetStatus"].ToString() != "" && hTbl["TimesheetStatus"].ToString() != "1")
{
return;
}
CreateNewEntry(ExcelGridSource, 1, 1);
ShowHideProfitCenterAndTimeCardColumn();
IsDirtyOn = true;
grdTimesheet.Rebind();
string clinetname = e.CommandArgument.ToString().Substring(0, e.CommandArgument.ToString().LastIndexOf('l') + 1);
clinetname = clinetname + "01";
string script = "setTimeout( function () { selectedCellId='" + clinetname + "'; MoveDown();},100);";
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "selectCell", script, true);
}
//set dirty grid flag to true 
SetGridDirty();
}
break;
case "AddNewRow":
{
CreateNewEntry(ExcelGridSource, 1, 1);
ShowHideProfitCenterAndTimeCardColumn();
IsDirtyOn = true;
grdTimesheet.Rebind();
//set dirty grid flag to true 
SetGridDirty();
}
break;
case "DeleteSelected":
{
IsDirtyOn = true;
if (e.Item is GridDataItem)
{
GridDataItem dataItem = (GridDataItem)e.Item;
string rowNum = (dataItem["RowNumber"].Controls[0] as TextBox).Text;
if (rowNum != "")
{
RadWindow Window = WinMgr.Windows[1];
Window.VisibleOnPageLoad = true;
Window.Width = Unit.Pixel(300);
Window.Height = Unit.Pixel(240);
Window.Modal = true;
ViewState["RowNumber"] = rowNum;
ShowHideProfitCenterAndTimeCardColumn();
grdTimesheet.Rebind();
HideErrorWarning(null);
}
}
//set dirty grid flag to true 
SetGridDirty();
}
break;
default: break;
}
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
Shinu
Top achievements
Rank 2
 answered on 03 Nov 2011
1 answer
72 views
The problem that I am having is that the custom user control is not displaying for a DetailTableView.EditFormSettings when using a GridButtonColumn as the firing event.

I have a class that defines a Hierarchical RadGrid that I will be using application wide. This grid has many column so this is the best implementation for me.
using System;
using System.Data;
using System.Drawing;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
 
namespace MAAS.WebApplication.Controls
{
    public static class BatchRadGrid
    {
 
        internal static RadGrid GridDefinition(string id)
        {
            RadGrid _policyRadGrid = new RadGrid
                                         {
                                             ID = id,
                                             Width = Unit.Percentage(98),
                                             Height = Unit.Pixel(460),
                                             PageSize = 10,
                                             AllowPaging = true,
                                             EnableAjaxSkinRendering = true,
                                             AllowSorting = true,
                                             AutoGenerateColumns = false,
                                             ShowStatusBar = true,
                                             GridLines = GridLines.None,
                                             AutoGenerateEditColumn = false,
                                             AutoGenerateDeleteColumn = false,
                                             ExportSettings =
                                                 {
                                                     HideStructureColumns = true,
                                                     ExportOnlyData = true,
                                                     IgnorePaging = true,
                                                 },
                                             HeaderContextMenu =
                                                 {
                                                     Enabled = true,
                                                     CssClass = "GridContextMenu GridContextMenu_Web20"
                                                 },
                                             PagerStyle = {Mode = GridPagerMode.NextPrevNumericAndAdvanced},
                                             ClientSettings =
                                                 {
                                                     Scrolling = {AllowScroll = true, UseStaticHeaders = true},
                                                     Selecting = {AllowRowSelect = true},
                                                     AllowExpandCollapse = true,
                                                     ClientEvents = {OnRowDblClick = "RowDblClicked"}
 
                                                 },
                                             FilterMenu = {EnableImageSprites = false},
                                             MasterTableView =
                                                 {
                                                     PageSize = 10,
                                                     CommandItemDisplay = GridCommandItemDisplay.Top,
                                                     CommandItemSettings =
                                                         {
                                                             ShowExportToExcelButton = false,
                                                             AddNewRecordText = "Add New Batch"
                                                         },
                                                     EnableHeaderContextMenu = true,
                                                     HorizontalAlign = HorizontalAlign.NotSet,
                                                     EditFormSettings =
                                                         {
                                                             FormCaptionStyle = {CssClass = "EditFormHeader"},
                                                             ColumnNumber = 3,
                                                             CaptionDataField = "BatchID",
                                                             CaptionFormatString = "Edit properties of Item {0}",
                                                             InsertCaption = "New Batch",
                                                             FormTableItemStyle = {Wrap = false},
                                                             FormMainTableStyle =
                                                                 {
                                                                     BackColor = Color.FromArgb(222, 222, 214),
                                                                     CellPadding = 3,
                                                                     CellSpacing = 0,
                                                                     GridLines = GridLines.None,
                                                                     Width = Unit.Percentage(43)
                                                                 },
                                                             FormTableStyle =
                                                                 {
                                                                     BackColor = Color.FromArgb(222, 222, 214),
                                                                     CellPadding = 2,
                                                                     CellSpacing = 0,
                                                                     Height = Unit.Percentage(100)
                                                                 },
                                                             FormTableAlternatingItemStyle = {Wrap = false},
                                                             FormTableButtonRowStyle =
                                                                 {
                                                                     HorizontalAlign = HorizontalAlign.Right,
                                                                     CssClass = "EditFormButtonRow"
                                                                 },
                                                         },
                                                     HierarchyLoadMode = GridChildLoadMode.ServerBind,
                                                     DataKeyNames = new string[] {"BatchID"},
                                                     EditMode = GridEditMode.PopUp,
                                                 },
                                         };
 
            //Add Edit Column
            GridEditCommandColumn _masterGridEditCommandColumn = new GridEditCommandColumn
                                                                     {
                                                                         ButtonType = GridButtonColumnType.ImageButton,
                                                                         HeaderText = "",
                                                                         UniqueName = "MasterEditRecord",
                                                                         HeaderStyle = {Width = Unit.Pixel(20)},
                                                                         ItemStyle = {Width = Unit.Pixel(20)}
                                                                     };
            _policyRadGrid.MasterTableView.Columns.Add(_masterGridEditCommandColumn);
 
            //Add Delete Column
            GridButtonColumn _masterDeleteCommandColumn = new GridButtonColumn
                                                              {
                                                                  ConfirmText = "Confirm",
                                                                  ConfirmDialogType = GridConfirmDialogType.RadWindow,
                                                                  ButtonType = GridButtonColumnType.ImageButton,
                                                                  HeaderText = "",
                                                                  ConfirmTitle = "Delete",
                                                                  CommandName = "Delete",
                                                                  Text = "Delete",
                                                                  UniqueName = "MasterDeleteRecord",
                                                                  HeaderStyle = {Width = Unit.Pixel(20)},
                                                                  ItemStyle =
                                                                      {
                                                                          HorizontalAlign = HorizontalAlign.Center,
                                                                          Width = Unit.Pixel(20)
                                                                      }
                                                              };
 
            _policyRadGrid.MasterTableView.Columns.Add(_masterDeleteCommandColumn);
 
 
            GridButtonColumn _masterPromoteCommandColumn = new GridButtonColumn
                                                               {
                                                                   ConfirmText = "Confirm",
                                                                   ConfirmDialogType = GridConfirmDialogType.RadWindow,
                                                                   ButtonType = GridButtonColumnType.ImageButton,
                                                                   HeaderText = "",
                                                                   ConfirmTitle = "Promote Batch",
                                                                   CommandName = "Promote",
                                                                   Text = "Promote",
                                                                   UniqueName = "MasterPromoteRecord",
                                                                   HeaderStyle = {Width = Unit.Pixel(20)},
                                                                   ItemStyle =
                                                                       {
                                                                           HorizontalAlign = HorizontalAlign.Center,
                                                                           Width = Unit.Pixel(20)
                                                                       }
                                                               };
            _policyRadGrid.MasterTableView.Columns.Add(_masterPromoteCommandColumn);
 
            GridBoundColumn _masterBoundColumn = new GridBoundColumn
                                                     {
                                                         DataField = "BatchID",
                                                         HeaderText = "Batch ID",
                                                         UniqueName = "BatchID",
                                                         HeaderStyle = {Width = Unit.Pixel(50)},
                                                         ItemStyle = {Width = Unit.Pixel(50)},
                                                         ReadOnly = true,
                                                     };
            _policyRadGrid.MasterTableView.Columns.Add(_masterBoundColumn);
 
            _masterBoundColumn = new GridBoundColumn
                                     {
                                         DataField = "AccountingPeriodID",
                                         HeaderText = "Accounting Period",
                                         UniqueName = "AccountingPeriodID",
                                         HeaderStyle = {Width = Unit.Pixel(130)},
                                         ItemStyle = {Width = Unit.Pixel(130)},
                                         ReadOnly = true,
                                     };
            _policyRadGrid.MasterTableView.Columns.Add(_masterBoundColumn);
            _masterBoundColumn = new GridBoundColumn
                                     {
                                         DataField = "BatchName",
                                         HeaderText = "Batch Name",
                                         UniqueName = "BatchName",
                                         HeaderStyle = {Width = Unit.Pixel(200)},
                                         ItemStyle = {Width = Unit.Pixel(200)},
                                         ReadOnly = true,
                                     };
            _policyRadGrid.MasterTableView.Columns.Add(_masterBoundColumn);
 
            _masterBoundColumn = new GridBoundColumn
                                     {
                                         DataField = "BatchStatusName",
                                         HeaderText = "Batch Status",
                                         UniqueName = "BatchStatusName",
                                         HeaderStyle = {Width = Unit.Pixel(80)},
                                         ItemStyle = {Width = Unit.Pixel(80)},
                                         ReadOnly = true,
                                     };
            _policyRadGrid.MasterTableView.Columns.Add(_masterBoundColumn);
 
            _masterBoundColumn = new GridBoundColumn
                                     {
                                         DataField = "BatchDescription",
                                         HeaderText = "Batch Description",
                                         UniqueName = "BatchDescription",
                                         HeaderStyle = {Width = Unit.Percentage(100)},
                                         ItemStyle = {Width = Unit.Percentage(100)},
                                     };
            _policyRadGrid.MasterTableView.Columns.Add(_masterBoundColumn);
 
 
            // (II in hierarchy level) Detail table - Manual Adjustments of the Batch
 
            GridTableView _batchAdjustments = new GridTableView(_policyRadGrid)
                                                  {
                                                      ID = string.Format("{0}_ChildGrid", id),
                                                      Name = string.Format("{0}_ChildGrid", id),
                                                      DataMember = "Policy",
                                                      AutoGenerateColumns = false,
                                                      Width = Unit.Percentage(100),
                                                      PageSize = 10,
                                                      BackColor = Color.FromArgb(198, 203, 214),
                                                      CommandItemDisplay = GridCommandItemDisplay.Top,
                                                      CommandItemSettings =
                                                          {
                                                              ShowExportToExcelButton = true,
                                                              AddNewRecordText = "Add New Adjustment",
 
                                                          },
                                                      EnableHeaderContextMenu = true,
                                                      HorizontalAlign = HorizontalAlign.NotSet,
                                                      EditFormSettings =
                                                          {
                                                              EditColumn =
                                                                  {
                                                                      UniqueName = "EditRecord",
                                                                  },
                                                          },
                                                      HierarchyLoadMode = GridChildLoadMode.ServerOnDemand,
                                                      EditMode = GridEditMode.PopUp,
                                                  };
 
            GridRelationFields _relationFields = new GridRelationFields
                                                     {
                                                         MasterKeyField = "BatchID",
                                                         DetailKeyField = "ManualAdjustmentBatchId"
                                                     };
            _batchAdjustments.ParentTableRelation.Add(_relationFields);
 
            _policyRadGrid.MasterTableView.DetailTables.Add(_batchAdjustments);
 
 
            //Add Edit Column
            GridEditCommandColumn _gridEditCommandColumn = new GridEditCommandColumn
                                                               {
                                                                   ButtonType = GridButtonColumnType.ImageButton,
                                                                   HeaderText = "",
                                                                   UniqueName = "PolicyEditRecord",
                                                                   HeaderStyle = {Width = Unit.Pixel(33)},
                                                                   ItemStyle =
                                                                   {
                                                                       HorizontalAlign = HorizontalAlign.Center,
                                                                       Width = Unit.Pixel(33)
                                                                   },
                                                               };
            _batchAdjustments.Columns.Add(_gridEditCommandColumn);
 
            //Add Delete Column GridButtonColumn
            GridButtonColumn _deleteCommandColumn = new GridButtonColumn
                                                        {
                                                            ButtonType = GridButtonColumnType.ImageButton,
                                                            CommandName = "Delete",
                                                            UniqueName = "DeleteTransaction",
                                                            HeaderStyle = {Width = Unit.Pixel(33)},
                                                            ItemStyle =
                                                                {
                                                                    HorizontalAlign = HorizontalAlign.Center,
                                                                    Width = Unit.Pixel(33)
                                                                },
                                                        };
 
 
            _batchAdjustments.Columns.Add(_deleteCommandColumn);
 
            //Add columns           
            GridBoundColumn _boundColumn = new GridBoundColumn
                                               {
                                                   DataField = "ManualAdjustmentBatchId",
                                                   HeaderText = "ManualAdjustmentBatchId",
                                                   UniqueName = "ManualAdjustmentBatchId",
                                                   HeaderStyle = {Width = Unit.Pixel(100)},
                                                   ItemStyle = {Width = Unit.Pixel(100)},
                                                   Visible = false,
                                                   ReadOnly = true,
                                               };
            _batchAdjustments.Columns.Add(_boundColumn);
 
            _boundColumn = new GridBoundColumn
                                               {
                                                   DataField = "ManualAdjustmentId",
                                                   HeaderText = "Manual Adjustment Id",
                                                   UniqueName = "ManualAdjustmentId",
                                                   HeaderStyle = {Width = Unit.Pixel(100)},
                                                   ItemStyle = {Width = Unit.Pixel(100)},
                                                   Visible = false,
                                                   ReadOnly = true,
                                               };
            _batchAdjustments.Columns.Add(_boundColumn);
 
 
            _boundColumn = new GridBoundColumn
                                               {
                                                   DataField = "OriginatingSystemCode",
                                                   HeaderText = "Originating System Code",
                                                   UniqueName = "OriginatingSystemCode",
                                                   HeaderStyle = {Width = Unit.Pixel(100)},
                                                   ItemStyle = {Width = Unit.Pixel(100)},
                                                   Visible = false,
                                                   ReadOnly = true,
                                               };
            _batchAdjustments.Columns.Add(_boundColumn);
 
 
            _boundColumn = new GridBoundColumn
                               {
                                   DataField = "PolicyNumber",
                                   HeaderText = "Policy Number",
                                   UniqueName = "PolicyNumber",
                                   HeaderStyle = {Width = Unit.Pixel(100)},
                                   ItemStyle = {Width = Unit.Pixel(100)},
                                   EditFormColumnIndex = 0,
                               };
            _batchAdjustments.Columns.Add(_boundColumn);
 
            _boundColumn = new GridBoundColumn
                               {
                                   DataField = "PolicyVersion",
                                   HeaderText = "Policy Version",
                                   UniqueName = "PolicyVersion",
                                   HeaderStyle = {Width = Unit.Pixel(100)},
                                   ItemStyle = {Width = Unit.Pixel(100)},
                                   EditFormColumnIndex = 1,
                               };
            _batchAdjustments.Columns.Add(_boundColumn);
 
            _boundColumn = new GridBoundColumn
                               {
                                   DataField = "InternalLegalEntityCode",
                                   HeaderText = "Internal Legal Entity Code",
                                   UniqueName = "InternalLegalEntityCode",
                                   HeaderStyle = {Width = Unit.Pixel(100)},
                                   ItemStyle = {Width = Unit.Pixel(100)},
                                   EditFormColumnIndex = 2,
                               };
            _batchAdjustments.Columns.Add(_boundColumn);
 
 
            _boundColumn = new GridBoundColumn
                               {
                                   DataField = "ProductLine2Name",
                                   HeaderText = "Product Line 2 Name",
                                   UniqueName = "ProductLine2Name",
                                   HeaderStyle = {Width = Unit.Pixel(100)},
                                   ItemStyle = {Width = Unit.Pixel(100)},
                                   EditFormColumnIndex = 3
                               };
            _batchAdjustments.Columns.Add(_boundColumn);
 
            _boundColumn = new GridBoundColumn
                               {
                                   DataField = "DirectAssumedCededCode",
                                   HeaderText = "Direct Assumed Ceded Code",
                                   UniqueName = "DirectAssumedCededCode",
                                   HeaderStyle = {Width = Unit.Pixel(100)},
                                   ItemStyle = {Width = Unit.Pixel(100)},
                                   EditFormColumnIndex = 0,
 
                               };
            _batchAdjustments.Columns.Add(_boundColumn);
 
            _boundColumn = new GridBoundColumn
                               {
                                   DataField = "PolicyTransactionTypeCode",
                                   HeaderText = "Policy Transaction Type Code",
                                   UniqueName = "PolicyTransactionTypeCode",
                                   HeaderStyle = {Width = Unit.Pixel(100)},
                                   ItemStyle = {Width = Unit.Pixel(100)},
                                   EditFormColumnIndex = 1
                               };
 
        _batchAdjustments.Columns.Add(_boundColumn);
 
            _boundColumn = new GridBoundColumn
                                 {
                                     DataField = "FinancialAmount",
                                     HeaderText = "Financial Amount",
                                     UniqueName = "FinancialAmount",
                                     HeaderStyle = {Width = Unit.Pixel(100)},
                                     ItemStyle = {Width = Unit.Pixel(100)},
                                     EditFormColumnIndex = 2,
                                     DataFormatString = "{0:C}"
                                 };
            _batchAdjustments.Columns.Add(_boundColumn);
 
            GridDateTimeColumn _bounddtColumn = new GridDateTimeColumn
            {
                                   DataField = "PolicyEffectiveDate",
                                   HeaderText = "Policy Effective Date",
                                   UniqueName = "PolicyEffectiveDate",
                                   HeaderStyle = {Width = Unit.Pixel(100)},
                                   ItemStyle = {Width = Unit.Pixel(100)},
                                   EditFormColumnIndex = 3,
                                   DataFormatString = "{0:M/d/yyyy}",
                               };
            _batchAdjustments.Columns.Add(_bounddtColumn);
 
            _boundColumn = new GridBoundColumn
                                      {
                                          DataField = "CoverageMarkelCode",
                                          HeaderText = "Coverage Markel Code",
                                          UniqueName = "CoverageMarkelCode",
                                          HeaderStyle = { Width = Unit.Pixel(100) },
                                          ItemStyle = {Width = Unit.Pixel(100)},
                                          Visible = false,
                                          ReadOnly = true,
                                      };
            _batchAdjustments.Columns.Add(_boundColumn);
 
            _boundColumn = new GridBoundColumn
                                 {
                                     DataField = "AnnualStatementLineNAICCode",
                                     HeaderText = "Annual Statement Line NAIC Code",
                                     UniqueName = "AnnualStatementLineNAICCode",
                                     HeaderStyle = { Width = Unit.Pixel(100) },
                                     ItemStyle = {Width = Unit.Pixel(100)},
                                     EditFormColumnIndex = 0,
                                 };
            _batchAdjustments.Columns.Add(_boundColumn);
 
            _boundColumn = new GridBoundColumn
                                 {
                                     DataField = "InwardAssumingCompanyCode",
                                     HeaderText = "Inward Assuming Company Code",
                                     UniqueName = "InwardAssumingCompanyCode",
                                     HeaderStyle = { Width = Unit.Pixel(100) },
                                     ItemStyle = {Width = Unit.Pixel(100)},
                                     EditFormColumnIndex = 1,
                                 };
            _batchAdjustments.Columns.Add(_boundColumn);
 
            _boundColumn = new GridBoundColumn
                               {
                                   DataField = "ProducerCode",
                                   HeaderText = "Producer Code",
                                   UniqueName = "ProducerCode",
                                   HeaderStyle = {Width = Unit.Pixel(100)},
                                   ItemStyle = {Width = Unit.Pixel(100)},
                                   EditFormColumnIndex = 2,
                                   DataFormatString = "{0:MM/dd/yyyy}",
                               };
            _batchAdjustments.Columns.Add(_boundColumn);
 
            _boundColumn = new GridBoundColumn
                                 {
                                     DataField = "LegacyProgramCode",
                                     HeaderText = "Legacy Program Code",
                                     UniqueName = "LegacyProgramCode",
                                     HeaderStyle = { Width = Unit.Pixel(100) },
                                     ItemStyle = {Width = Unit.Pixel(100)},
                                     EditFormColumnIndex = 3,
 
                                 };
            _batchAdjustments.Columns.Add(_boundColumn);
 
            _boundColumn = new GridBoundColumn
                                 {
                                     DataField = "FinancialRiskISOCountrySubdivisionCode",
                                     HeaderText = "Financial Risk ISO Country Subdivision Code",
                                     UniqueName = "FinancialRiskISOCountrySubdivisionCode",
                                     HeaderStyle = { Width = Unit.Pixel(100) },
                                     ItemStyle = {Width = Unit.Pixel(100)},
                                     EditFormColumnIndex = 0,
                                 };
            _batchAdjustments.Columns.Add(_boundColumn);
 
            _boundColumn = new GridBoundColumn
                                 {
                                     DataField = "LineOfBusinessMarkelCode",
                                     HeaderText = "Line Of Business Markel Code",
                                     UniqueName = "LineOfBusinessMarkelCodeb",
                                     HeaderStyle = { Width = Unit.Pixel(100) },
                                     ItemStyle = {Width = Unit.Pixel(100)},
                                     EditFormColumnIndex = 2,
 
                                 };
            _batchAdjustments.Columns.Add(_boundColumn);
 
            _boundColumn = new GridBoundColumn
                                 {
                                     DataField = "SublineMarkelCode",
                                     HeaderText = "Subline Markel Code",
                                     UniqueName = "SublineMarkelCode",
                                     HeaderStyle = { Width = Unit.Pixel(100) },
                                     ItemStyle = {Width = Unit.Pixel(100)},
                                     EditFormColumnIndex = 3,
 
                                 };
            _batchAdjustments.Columns.Add(_boundColumn);
 
            _boundColumn = new GridBoundColumn
                                 {
                                     DataField = "RatingClassMarkelCode",
                                     HeaderText = "Rating Class Markel Code",
                                     UniqueName = "RatingClassMarkelCode",
                                     HeaderStyle = { Width = Unit.Pixel(100) },
                                     ItemStyle = {Width = Unit.Pixel(100)},
                                     EditFormColumnIndex = 0,
 
                                 };
            _batchAdjustments.Columns.Add(_boundColumn);
 
            _boundColumn = new GridBoundColumn
                                 {
                                     DataField = "CoverageTriggerCode",
                                     HeaderText = "Coverage Trigger Code",
                                     UniqueName = "CoverageTriggerCode",
                                     HeaderStyle = { Width = Unit.Pixel(100) },
                                     ItemStyle = {Width = Unit.Pixel(100)},
                                     EditFormColumnIndex = 1,
 
                                 };
            _batchAdjustments.Columns.Add(_boundColumn);
 
            _boundColumn = new GridBoundColumn
                                 {
                                     DataField = "RegionCode",
                                     HeaderText = "Region Code",
                                     UniqueName = "RegionCode",
                                     HeaderStyle = { Width = Unit.Pixel(100) },
                                     ItemStyle = {Width = Unit.Pixel(100)},
                                     EditFormColumnIndex = 2,
 
                                 };
            _batchAdjustments.Columns.Add(_boundColumn);
 
            _boundColumn = new GridBoundColumn
                                 {
                                     DataField = "LegacyAccountingUnitCode",
                                     HeaderText = "Legacy Accounting Unit Code",
                                     UniqueName = "LegacyAccountingUnitCode",
                                     HeaderStyle = { Width = Unit.Pixel(100) },
                                     ItemStyle = {Width = Unit.Pixel(100)},
                                     EditFormColumnIndex = 3,
 
                                 };
            _batchAdjustments.Columns.Add(_boundColumn);
 
            _bounddtColumn = new GridDateTimeColumn
                                 {
                                     DataField = "PremiumFinancialEffectiveFromDate",
                                     HeaderText = "Premium Financial Effective From Date",
                                     UniqueName = "PremiumFinancialEffectiveFromDate",
                                     HeaderStyle = { Width = Unit.Pixel(100) },
                                     ItemStyle = {Width = Unit.Pixel(100)},
                                     EditFormColumnIndex = 0,
                                     DataFormatString = "{0:M/d/yyyy}",
                                 };
            _batchAdjustments.Columns.Add(_bounddtColumn);
 
            _bounddtColumn = new GridDateTimeColumn
                                 {
                                     DataField = "PremiumFinancialEffectiveToDate",
                                     HeaderText = "Premium Financial Effective To Date",
                                     UniqueName = "PremiumFinancialEffectivetoDate",
                                     HeaderStyle = {Width = Unit.Pixel(100)},
                                     ItemStyle = {Width = Unit.Pixel(100)},
                                     EditFormColumnIndex = 0,
                                     DataFormatString = "{0:M/d/yyyy}",
 
                                 };
            _batchAdjustments.Columns.Add(_bounddtColumn);
 
            _bounddtColumn = new GridDateTimeColumn
                                 {
                                     DataField = "CoverageEffectiveDate",
                                     HeaderText = "Coverage Effective Date",
                                     UniqueName = "CoverageEffectiveDate",
                                     HeaderStyle = { Width = Unit.Pixel(100) },
                                     ItemStyle = {Width = Unit.Pixel(100)},
                                     EditFormColumnIndex = 0,
                                     DataFormatString = "{0:M/d/yyyy}",
                                 };
 
            _batchAdjustments.Columns.Add(_bounddtColumn);
 
            _bounddtColumn = new GridDateTimeColumn
                                 {
                                     DataField = "CoverageExpirationDate",
                                     HeaderText = "Coverage Expiration Date",
                                     UniqueName = "CoverageExpirationDate",
                                     HeaderStyle = {Width = Unit.Pixel(100)},
                                     ItemStyle = {Width = Unit.Pixel(100)},
                                     EditFormColumnIndex = 0,
                                     DataFormatString = "{0:M/d/yyyy}",
                                 };
 
            _batchAdjustments.Columns.Add(_bounddtColumn);
            _boundColumn = new GridBoundColumn
                                 {
                                     DataField = "PolicyClaimManualAdjustmentTypeName",
                                     HeaderText = "Manual Adjustment Type Name",
                                     UniqueName = "PolicyClaimManualAdjustmentTypeName",
                                     HeaderStyle = {Width = Unit.Pixel(100)},
                                     ItemStyle = {Width = Unit.Pixel(100)},
                                     EditFormColumnIndex = 0,
                                 };
 
            _batchAdjustments.Columns.Add(_boundColumn);
 
            _boundColumn = new GridBoundColumn
                                 {
                                     DataField = "AutoGenerated",
                                     HeaderText = "Auto-Generated",
                                     UniqueName = "AutoGenerated",
                                     HeaderStyle = {Width = Unit.Pixel(100)},
                                     ItemStyle = {Width = Unit.Pixel(100)},
                                     EditFormColumnIndex = 0,
                                 };
 
            _batchAdjustments.Columns.Add(_boundColumn);
            return _policyRadGrid;
        }
    }
 }


The grid will function in a different manner based on the access level of the user. On a 'basic user level' they will have a Add New Item/Edit Item on the parent grid and Edit, Reject(delete), Approve(Update) on the Child Grid

The next level will be a 'Approver' role. They will NOT have Add New Item/Edit Item on the parent grid and will only have Reject(Edit) on the child. The action that the user will take in this role when rejecting an item is that they will be required to enter a comment through a user control that will be launched when the click the reject button.

private void SubmittedBatchesRadGrid_ItemDataBound(object sender, GridItemEventArgs e)
{
    GridDataItem _dataItem = e.Item as GridDataItem;
    if (_dataItem == null) return;
 
    if (e.Item.OwnerTableView.Name == "SubmittedBatchesRadGrid_ChildGrid")
    {
        SetChildGridCommandColumns(sender, e);
        return;
    }
 
    if (_dataItem.KeyValues == "{}") { return; }
 
    SetMasterGridCommandColumns(sender, e, _dataItem);
 
}
 
private static void SetChildGridCommandColumns(object sender, GridItemEventArgs e)
{
    const string _jqueryCode = "if(!$find('{0}').confirm('{1}', event, '{2}'))return false;";
    const string _confirmText = "<p>Rejecting this adjustment will mean that you will have to also reject the batch when you are done processing these items.</p><p>Are you sure you want to reject this adjustment?</p>";
    ((ImageButton)(((GridEditableItem)e.Item)["PolicyEditRecord"].Controls[0])).ImageUrl = "/controls/styles/images/editpencil.png";
    ImageButton _btnReject = (ImageButton)((GridDataItem)e.Item)["DeleteTransaction"].Controls[0];
 
    _btnReject.CommandName = "Update";
    _btnReject.ImageUrl = "/controls/styles/images/decline.png";
    _btnReject.ToolTip = "Reject this item";
    //_btnReject.Attributes["onclick"] = string.Format(_jqueryCode, ((Control)sender).ClientID, _confirmText, "Reject Adjustment");
}
 
private void SubmittedBatchesRadGrid_DetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e)
{
    e.DetailTableView.EditFormSettings.EditFormType = GridEditFormType.WebUserControl;
    e.DetailTableView.EditFormSettings.UserControlName = "/Controls/RejectedAdjustmentComment.ascx";
    e.DetailTableView.EditMode = GridEditMode.PopUp;
 
    e.DetailTableView.CommandItemSettings.ShowAddNewRecordButton = false;
    GridDataItem _dataItem = e.DetailTableView.ParentItem;
    e.DetailTableView.DataSource = AdjustmentAPI.GetAdjustmentsByBatch(Convert.ToInt32(_dataItem.GetDataKeyValue("BatchID").ToString()), PolicyClaimManualAdjustmentCode);
}


Any thoughts as to why it's not launching the user control?




Marin
Telerik team
 answered on 03 Nov 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?