Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
104 views

hello

is there a way to localize the button "Apply" and "Cancel" and the checkbox "Check All" in a grid with CheckList Filtering enabled?

 

thank you

Eyup
Telerik team
 answered on 13 Apr 2015
1 answer
302 views

I need to add a custom radio button control that I created based on an if condition to my GridView. My radiobutton will be enabled or disabled based on this condition and will have the text changed as well.I'm trying to figure out how to add a radiobutton object into my data row instead of a stringdt.Columns.Add("FirstName").

 

<telerik:RadGrid runat="server" ID="grd1" OnNeedDataSource="grd1_NeedDataSource">
<MasterTableView AutoGenerateColumns="False">
<Columns>
<telerik:GridTemplateColumn HeaderText="Radiobutton header" UniqueName="col1">
<ItemTemplate>
<asp:RadioButton ID="rbType" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "rbEnableorDisable")%>' />
</ItemTemplate>
</telerik:GridTemplateColumn>
 
<telerik:GridTemplateColumn HeaderText="FirstName header" UniqueName="col2">
<ItemTemplate>
<asp:Label Text='<%# DataBinder.Eval(Container.DataItem, "Name")%>' runat="server" />
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>

 Codebehind


dt= New DataTable
dt.Columns.Add("rbEnableorDisable")
dt.Columns.Add("FirstName")
 
Dim rb As RadioButton
rb = New RadioButton
 
For each item in itemlist //some data iteration declared elsewhere
dr = dt.NewRow()
If (Condition)
rb.Text = "Should be Disabled"
rb.Enabled = False
Else
rb.Text = "Should be Enabled"
rb.Enabled = True
End if
 
dr.Item("FirstName") = item.FirstName
dr.Item("rbEnableOrDisable") = rb//?Code for inserting a radio button object
dt.Rows.Add(dr)
Next
 
With grd1
.DataSource = dt
.DataBind()
End With

 So far with this code I am only able to display the radiobutton text if i havedr.Item("rbEnableOrDisable") = rb.Text.I need to display the whole radiobutton object(show the text and if it's enabled or disabled among others)I triedLocationData.Columns.Add(New DataColumn("rbType", GetType(RadioButton)))but it seems I need to append to the ItemTemplateAlso tried adding the whole column dynamic with:grd1.Controls.Add(rb)

 

Eyup
Telerik team
 answered on 13 Apr 2015
3 answers
387 views
Hi dear

How we can find controls(Radcombobox) in insert item of radgrid on client side.

Thanks
Eyup
Telerik team
 answered on 13 Apr 2015
4 answers
216 views
Dear Telerik Champs
is scheduler support Hijri calendar like this culture  (ar-SA)

I set the culture info as  (ar-SA) to the scheduler and every thing was ok
but When I begin to save a new appointment the date comming wrong like this one (12/10/2571)
so I try to search in the samples and  the thread but I found this demo link

I found that in the demo u r using only the Gregorian culture that means no supporting for Hijri or what?

I appreciate ur help
Plamen
Telerik team
 answered on 13 Apr 2015
17 answers
535 views
After adding the new EnableCheckAllItemsCheckBox, when checking the box the OnItemChecked is not fired. For all othe check boxes in the list it is.
Marcos
Top achievements
Rank 2
 answered on 13 Apr 2015
2 answers
172 views

I have an application page with 2 RadEditors on it. 

People enter content in one of the two and by clicking a button they submit the content to a Note field in SharePoint 2010( which is rich text, not enhanced rich text). Submission is done via C# custom code. 

My issue is that when I try to set the value of the field font name, font size, underline, font color and back color are stripped down in the field. My guess is that the field does not accept XHtml (correct my if I am wrong) so when I try to set the field value with the content :

 <span style="font-family: Arial; font-size: 48px;"><strong><em><span style="background-color: #ffff00; color: #ff0000; text-decoration: underline;">test</span></em></strong></span> which comes from RadEditor, some of these value do not get converted to something like:

<font style="background-color:#ffff00" color="#ff0000" size="7" face="Arial"><strong><em><u>Anisia 567</u></em></strong></font> that the field is expecting.

 This behavior is occuring with both of my RadEditors.

The configuration of editor is as follows:

<telerik:RadEditor runat="server" ID="TextBoxRich" EmptyMessage="msg1" Height="67px" Width="100%" BackColor="#dae4f1" CssClass="noteTextBox" BorderColor="Black" ToolTip="msg2">
                                                    <Tools>
                                                        <telerik:EditorToolGroup>
                                                            <telerik:EditorTool Name="FontName"/>
                                                            <telerik:EditorTool Name="FontSize"/>
                                                            <telerik:EditorTool Name="Bold"/>
                                                            <telerik:EditorTool Name="Italic"/>
                                                            <telerik:EditorTool Name="Underline"/>
                                                            <telerik:EditorTool Name="JustifyLeft"/>
                                                            <telerik:EditorTool Name="JustifyCenter"/>
                                                            <telerik:EditorTool Name="JustifyRight"/>
                                                            <telerik:EditorTool Name="InsertOrderedList"/>
                                                            <telerik:EditorTool Name="InsertUnorderedList"/>
                                                            <telerik:EditorTool Name="Outdent"/>
                                                            <telerik:EditorTool Name="Indent"/>
                                                            <telerik:EditorTool Name="ForeColor"/>
                                                            <telerik:EditorTool Name="BackColor"/>
                                                        </telerik:EditorToolGroup>
                                                    </Tools>
                                                </telerik:RadEditor>  

and in ShaPoint I set the value as follows:

SPFieldMultiLineText field = (SPFieldMultiLineText)Item.Fields["Note"];
 field.ParseAndSetValue(newItem, TextBoxRich.Content);

Any suggestion is greatly appreciated.

 Thank you.

Best regards,

Anisia Pop

Anisia Alexandra
Top achievements
Rank 1
 answered on 13 Apr 2015
1 answer
335 views

Just looking for some clarification here. Would it be true to say that the main difference between RadMenu and RadNavigation is the Responsive behavior of the RadNavigation control? 

 I am trying to figure out which control to use, and am just in the beginning of my research into the new PageLayour and related parts of the Responsive infrastructure that Telerik offers. Is it possible to use the RadNavigation with images or templates? Furthermore, can those templates be turned on or off depending on the browser type it is being viewed with?

I would like to have a rich template based menu when viewed on a desktop client and the simple text-based menu on tablet or smartphone browsers.

 Any feedback would be greatly appreciated as I try to wrap my brain around all this!

Plamen
Telerik team
 answered on 13 Apr 2015
4 answers
259 views
I get below form RadGrid.MasterVradGrid.MasterTableView.FilterExpression
filterExpression="(RequiredDate = DateTime.Parse("1/27/2015 12:00:00 AM"))"
if (!string.IsNullOrWhiteSpace(filterExpression))
{
      query = query.Where(filterExpression);
}

Happen Exception.
======================================================================================================
An exception of type 'System.NotSupportedException' occurred in EntityFramework.SqlServer.dll but was not handled in user code

Additional information: LINQ to Entities does not recognize the method 'System.DateTime Parse(System.String)' method, and this method cannot be translated into a store expression.
======================================================================================================

Because I use EF6 it no support 'System.DateTime.Parse' method

I want change filter expression ,I hope result below example.
query = query.Where("(RequiredDate >= DateTime(2015,1,29))");

How Override Filter Pattern from RadGrid?
小章
Top achievements
Rank 1
 answered on 13 Apr 2015
5 answers
145 views
I'm using the RadGrid with a LinqDataSource and keep getting "The state information is invalid for this page and might be corrupted." error

What am I doing wrong?

The problem only occurs on the production server.
Windows Server 2008 setup in a web farm of 3 computers.

The following code generates an error. on the production server on postbacks (e.g. sorting, filtering or paging)... but not every single postback (about 1 in 3).
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="page2.aspx.cs" Inherits="site_admin_page2" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
    <title></title
</head> 
<body> 
    <form id="form1" runat="server"
    <div> 
        <asp:LinqDataSource ID="LinqDataSource1" runat="server"  
            onselecting="LinqDataSource1_Selecting"
        </asp:LinqDataSource> 
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
        </telerik:RadScriptManager> 
        <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True"  
            AllowPaging="True" AllowSorting="True" DataSourceID="LinqDataSource1"  
            GridLines="None"
            <MasterTableView DataSourceID="LinqDataSource1"
            <RowIndicatorColumn> 
            <HeaderStyle Width="20px"></HeaderStyle> 
            </RowIndicatorColumn> 
 
            <ExpandCollapseColumn> 
            <HeaderStyle Width="20px"></HeaderStyle> 
            </ExpandCollapseColumn> 
            </MasterTableView> 
        </telerik:RadGrid> 
    </div> 
    </form> 
</body> 
</html> 
 

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
 
public partial class site_admin_page2 : System.Web.UI.Page 
    protected void Page_Load(object sender, EventArgs e) 
    { 
 
    } 
    protected void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e) 
    { 
        DynamicData01DataContext dc = new DynamicData01DataContext(); 
 
        var products = from p in dc.tbl_Products 
                       select new 
                       { 
                           p.ProductID, 
                           p.ProductName, 
                           p.ProductPrice, 
                           p.ProductActive 
                       }; 
 
        e.Result = products; 
    } 
 

here is the complete error
Server Error in '/site' Application. 
The state information is invalid for this page and might be corrupted. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
 
Exception Details: System.Web.HttpException: The state information is invalid for this page and might be corrupted. 
 
Source Error: 
 
[No relevant source lines] 
 
 
Source File: c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\f1255035\ee4d6829\App_Web_page2.aspx.c2099ada.oslnjh5d.0.cs    Line: 0 
 
Assembly Load Trace: The following information can be helpful to determine why the assembly 'App_Web_page2.aspx.c2099ada.phfinkbb, Version=0.0.0.0, Culture=neutralPublicKeyToken=null' could not be loaded. 
 
WRN: Assembly binding logging is turned OFF. 
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. 
Note: There is some performance penalty associated with assembly bind failure logging. 
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. 
 
 
Stack Trace: 
 
[FileNotFoundException: Could not load file or assembly 'App_Web_page2.aspx.c2099ada.phfinkbb, Version=0.0.0.0, Culture=neutralPublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.] 
   System.RuntimeTypeHandle._GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, Boolean loadTypeFromPartialName) +0 
   System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +64 
   System.RuntimeType.PrivateGetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark) +58 
   System.Type.GetType(String typeName, Boolean throwOnError) +59 
   System.Web.UI.ObjectStateFormatter.DeserializeType(SerializerBinaryReader reader) +153 
   System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +8625890 
   System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +291 
   System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +291 
   System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +291 
   System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +784 
   System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +392 
   System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +291 
   System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +404 
   System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +291 
   System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +404 
   System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +404 
   System.Web.UI.ObjectStateFormatter.DeserializeValue(SerializerBinaryReader reader) +392 
   System.Web.UI.ObjectStateFormatter.Deserialize(Stream inputStream) +135 
 
[ArgumentException: The serialized data is invalid.] 
   System.Web.UI.ObjectStateFormatter.Deserialize(Stream inputStream) +199 
   System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +291 
   System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) +4 
   System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) +37 
   System.Web.UI.HiddenFieldPageStatePersister.Load() +113 
 
[ViewStateException: Invalid viewstate.  
    Client IP: 122.111.98.153 
    Port: 57393 
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729) 
    ViewState: /wEPDwUJMTU0NjY3OTgxD2QWAgIDD2QWBAIBDw9kPCsABgBkAgUPPCsADQIAFCsAAg8WCB4LXyFJdGVtQ291bnQCAR4LXyFEYXRhQm91bmRnHhdFbmFibGVBamF4U2tpblJlbmRlcmluZ2geC0VkaXRJbmRleGVzFgBkFwEFD1NlbGVjdGVkSW5kZXhlcxYAARYCFgpkFCsABBQrAAUWEB4KSGVhZGVyVGV4dAUJUHJvZHVjdElEHglEYXRhRmllbGQFCVByb2R1Y3RJRB4DX3NlBQlQcm9kdWN0SUQeCFJlYWRPbmx5Zx4IRGF0YVR5cGUZKwEeBG9pbmQCAh4EX2NmdmQeBF9jZmZkZGRkBQlQcm9kdWN0SUQUKwAFFhAfBAULUHJvZHVjdE5hbWUfBQULUHJvZHVjdE5hbWUfBgULUHJvZHVjdE5hbWUfB2cfCBkrAh8JAgMfCmQfC2RkZGQFC1Byb2R1Y3ROYW1lFCsABRYQHwtkHwpkHwYFDFByb2R1Y3RQcmljZR8EBQxQcm9kdWN0UHJpY2UfBQUMUHJvZHVjdFByaWNlHwgZKVtTeXN0ZW0uRGVjaW1hbCwgbXNjb3JsaWIsIFZlcnNpb249Mi4wLjAuMCwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj1iNzdhNWM1NjE5MzRlMDg5HwdnHwkCBGRkZAUMUHJvZHVjdFByaWNlFCsABRYQHwQFDVByb2R1Y3RBY3RpdmUeA19kZgUNUHJvZHVjdEFjdGl2ZR8GBQ1Qcm9kdWN0QWN0aXZlHwdnHwgZKwMfCQIFHwpkHwtkZGRkBQ1Qc...] 
 
[HttpException (0x80004005): The state information is invalid for this page and might be corrupted.] 
   System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +106 
   System.Web.UI.ViewStateException.ThrowViewStateError(Exception inner, String persistedState) +14 
   System.Web.UI.HiddenFieldPageStatePersister.Load() +217 
   System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +105 
   System.Web.UI.Page.LoadAllState() +43 
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785 
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242 
   System.Web.UI.Page.ProcessRequest() +80 
   System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21 
   System.Web.UI.Page.ProcessRequest(HttpContext context) +49 
   ASP.site_admin_page2_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\site\f1255035\ee4d6829\App_Web_page2.aspx.c2099ada.oslnjh5d.0.cs:0 
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181 
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75 
 
 
Version Information: Microsoft .NET Framework Version:2.0.50727.4016; ASP.NET Version:2.0.50727.4016  

I've looked everywhere to see what the problem to this is... the following link is the closest to help identify the problem that I've come across even though it's an old post seems to be the same sort of problem
http://www.telerik.com/community/forums/aspnet-ajax/grid/does-current-futures-build-support-linq-datasources.aspx

To test I've created the same page but linked the LinqDataSource to a GridView and don't get the error paging and sorting work fine.
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
    <title></title
</head> 
<body> 
    <form id="form1" runat="server"
    <div> 
        <asp:LinqDataSource ID="LinqDataSource1" runat="server"  
            onselecting="LinqDataSource1_Selecting"
        </asp:LinqDataSource> 
         
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True"  
            AllowSorting="True" DataSourceID="LinqDataSource1"
        </asp:GridView> 
    </div> 
    </form> 
</body> 
</html> 
 

also if I just change the LinqDataSource1_Selecting to not use "select new { ... } I also don't get the error... e.g.
    protected void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e) 
    { 
        DynamicData01DataContext dc = new DynamicData01DataContext(); 
 
        var products = from p in dc.tbl_Products 
                       select p; 
 
        e.Result = products; 
    } 


Please help... I really need to fix this problem.
Have I missed something obvious?
Could this have something to do with the Production server running as a webfarm?
Has anyone else experienced this problem?



Peter
Top achievements
Rank 1
 answered on 13 Apr 2015
4 answers
845 views
Hi, I am able to export radgrid to excel and pdf. But for excel exporting my grouped column is not exported. Could you please let me know how that works.
I am attaching my radgrid code. Also, i just want HA rollout as group header column and not HAtype. how to do that?
<telerik:RadGrid ID="rgCurrentPromo" runat="server"   Skin="Windows7" OnBiffExporting="rgCurrentPromo_BiffExporting" PageSize="30"  AllowPaging="true" AllowSorting="True">
           <%-- <telerik:RadGrid ID="rgCurrentPromo" runat="server" GridLines="None" AllowSorting="true" Skin="Windows7" Width="745px"  OnItemCreated="rgCurrentPromo_ItemCreated" AutoGenerateColumns="False" AllowPaging="true"> --%>
           <ExportSettings IgnorePaging="true" OpenInNewWindow="true">
         <Pdf PageHeight="210mm" PageWidth="330mm" DefaultFontFamily="Arial Unicode MS" PageTopMargin="30mm" 
              BorderStyle="Medium" BorderColor="#666666"
          </Pdf>
                      
      </ExportSettings>
          <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
              <MasterTableView AutoGenerateColumns="False"  CommandItemDisplay="Top" UseAllDataFields="true">
                  <CommandItemSettings ShowExportToExcelButton="true"   ShowExportToPdfButton="true" />
                  <CommandItemTemplate>
                       <asp:Button ID="ExporttoExcel" runat="server" Text="Export To Excel" CommandName="ExporttoExcel"   OnClick="b1_Click"/>
                     <asp:Button ID="ExportoPDF" runat="server" CommandName="ExporttoPDF" Text="Export To PDF" OnClick="b2_Click" />
                     <%--<asp:ImageButton ID="DownloadPDF" runat="server" OnClick="DownloadPDF_Click" ImageUrl="~/Grid/Examples/Functionality/Exporting/Export-Word-CSV/images/file-extension-pdf-icon.png"
      CssClass="pdfButton"></asp:ImageButton>--%>
                  </CommandItemTemplate>
                     <GroupByExpressions>
              <telerik:GridGroupByExpression>
                  <SelectFields>
                      <telerik:GridGroupByField FieldName="HA" FieldAlias="HAType" />
                  </SelectFields>
                  <GroupByFields>
                      <telerik:GridGroupByField FieldName="HA" />
                  </GroupByFields>
              </telerik:GridGroupByExpression>
          </GroupByExpressions>
          <GroupHeaderItemStyle Font-Bold="true" Font-Size="120%" />
              <Columns>
                    <telerik:GridBoundColumn DataField="CUSTOMER_NAME"  FilterControlAltText="Filter CUSTOMER_NAME column" HeaderText="Customer" ReadOnly="True" SortExpression="CUSTOMER_NAME" UniqueName="CUSTOMER_NAME">
                      <ColumnValidationSettings>
                          <ModelErrorMessage Text="" />
                      </ColumnValidationSettings>
                  </telerik:GridBoundColumn>
                  <telerik:GridBoundColumn DataField="PROMO_NO" DataType="System.Int32" FilterControlAltText="Filter PROMO_NO column" HeaderText="PN" ReadOnly="True" SortExpression="PROMO_NO" UniqueName="PROMO_NO">
                      <ColumnValidationSettings>
                          <ModelErrorMessage Text="" />
                      </ColumnValidationSettings>
                  </telerik:GridBoundColumn>
                  <telerik:GridBoundColumn DataField="PROMO_NM" FilterControlAltText="Filter PROMO_NM column" HeaderText="Promo Name" SortExpression="PROMO_NM" UniqueName="PROMO_NM">
                      <ColumnValidationSettings>
                          <ModelErrorMessage Text="" />
                      </ColumnValidationSettings>
                  </telerik:GridBoundColumn>
                  
                  <telerik:GridBoundColumn DataField="PROMO_DATE" DataType="System.DateTime" FilterControlAltText="Filter PROMO_DATE column" HeaderText="Start Dt" SortExpression="PROMO_DATE"  UniqueName="PROMO_DATE"  DataFormatString="{0:dd/MM/yyyy}">
                      <ColumnValidationSettings>
                          <ModelErrorMessage Text="" />
                      </ColumnValidationSettings>
                  </telerik:GridBoundColumn
                 <telerik:GridBoundColumn DataField="HA" FilterControlAltText="Filter HA column" HeaderText="HA" SortExpression="HA" UniqueName="HA">
                      <ColumnValidationSettings>
                          <ModelErrorMessage Text="" />
                      </ColumnValidationSettings>
                  </telerik:GridBoundColumn>
                  <telerik:GridBoundColumn DataField="PROMO_DESC" FilterControlAltText="Filter PROMO_DESC column" HeaderText="Description" SortExpression="PROMO_DESC" UniqueName="PROMO_DESC">
                      <ColumnValidationSettings>
                          <ModelErrorMessage Text="" />
                      </ColumnValidationSettings>
                  </telerik:GridBoundColumn>
                  <telerik:GridBoundColumn DataField="PROMO_END_DT" DataType="System.DateTime" FilterControlAltText="Filter PROMO_END_DT column" HeaderText="End Dt" SortExpression="PROMO_END_DT" UniqueName="PROMO_END_DT" DataFormatString="{0:dd/MM/yyyy}">
                      <ColumnValidationSettings>
                          <ModelErrorMessage Text="" />
                      </ColumnValidationSettings>
                  </telerik:GridBoundColumn>
                </Columns>
          </MasterTableView>
          <ClientSettings AllowDragToGroup="true" />
  <GroupingSettings ShowUnGroupButton="true" />
      </telerik:RadGrid>
Protected Sub rgCurrentPromo_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles rgCurrentPromo.NeedDataSource
     Using dbContext As New AthenaModel.EntitiesModel()
         Dim firstDate As Date = New DateTime(Now.Year, Now.Month, 1)
         'Select
         'Case when AUTH_CODE is  null Then 'Non-HA Rollout' Else 'HA Rollout' End  AS HA,CUSTOMER.CUSTOMER_NAME, PLUTO.TBLPROMOTIONCODE.PROMO_NO, PLUTO.TBLPROMOTIONCODE.PROMO_NM, PLUTO.TBLPROMOTIONCODE.PROMO_DATE, PLUTO.TBLPROMOTIONCODE.PROMO_END_DT, PLUTO.TBLPROMOTIONCODE.PROMO_DESC
         'FROM PLUTO.TBLPROMOTIONCODE INNER JOIN CUSTOMER ON PLUTO.TBLPROMOTIONCODE.CUSTOMER_ID = CUSTOMER.CUSTOMER_ID
         'WHERE PLUTO.TBLPROMOTIONCODE.PROMO_END_DT>=TRUNC (SYSDATE, 'month') Or PLUTO.TBLPROMOTIONCODE.PROMO_END_DT Is Null;
         Dim query = (From p In dbContext.TBLPROMOTIONCODEs
                 Join c In dbContext.CUSTOMERs On p.CUSTOMER_ID Equals c.CUSTOMER_ID
                 Where p.PROMO_END_DT >= firstDate Or p.PROMO_END_DT Is Nothing
                 Select c.CUSTOMER_NAME, p.PROMO_NO, p.PROMO_NM, p.PROMO_END_DT, p.PROMO_DATE, p.PROMO_DESC, HA = If(p.AUTH_CODE Is Nothing, "Non-HA Rollout", "HA Rollout")).ToList()
         ' Select c.CUSTOMER_NAME, p.PROMO_NO, p.PROMO_NM, promo_enddt = String.Format("{0:MM/dd/yyyy}", p.PROMO_END_DT), promo_dt = String.Format("{0:MM/dd/yyyy}", p.PROMO_DATE), p.PROMO_DESC, HA = IIf(p.AUTH_CODE Is Nothing, "Non-HA Rollout", "HA Rollout")).ToList()
         rgCurrentPromo.DataSource = query
         'rgCurrentPromo.DataBind()
     End Using
 End Sub
 Private isPdfExport As Boolean = False
 Protected Sub rgCurrentPromo_ItemCreated(sender As Object, e As GridItemEventArgs)
     If isPdfExport Then
         FormatGridItem(e.Item)
     End If
     'If TypeOf e.Item Is GridHeaderItem Then
     '    Dim row As RowElement = New RowElement()
     '    Dim cell As CellElement = New CellElement()
     '    cell.MergeAcross = e.Row.Cells.Count - 1
     '    cell.Data.DataItem = "VETS-100A Detail Report from " & AsofReportFromDate & " To " & AsofReportToDate & "  Reporting Time : " & Date.Now.ToString("MM-dd-yyyy H:mm:ss")
     '    cell.StyleValue = "headStyle"
     '    row.Cells.Add(cell)
     '    e.Worksheet.Table.Rows.Insert(0, row)
     '    e.Worksheet.AutoFilter.Range = e.Worksheet.AutoFilter.Range.Replace("R1", "R2")
     'End If
 End Sub
 Protected Sub FormatGridItem(item As GridItem)
     item.Style("color") = "#eeeeee"
     If TypeOf item Is GridDataItem Then
         item.Style("vertical-align") = "middle"
         item.Style("text-align") = "center"
     End If
     Select Case item.ItemType
         'Mimic RadGrid appearance for the exported PDF file 
         Case GridItemType.Item
             item.Style("background-color") = "#4F4F4F"
             Exit Select
         Case GridItemType.AlternatingItem
             item.Style("background-color") = "#494949"
             Exit Select
         Case GridItemType.Header
             item.Style("background-color") = "#2B2B2B"
             Exit Select
         Case GridItemType.CommandItem
             item.Style("background-color") = "#000000"
             Exit Select
     End Select
     If TypeOf item Is GridCommandItem Then
         'needed to span the image over the CommandItem cells 
         item.PrepareItemStyle()
     End If
 End Sub
 'Protected Sub rgCurrentPromo_ItemCommand(ByVal sender As Object, ByVal e As GridCommandEventArgs) Handles rgCurrentPromo.ItemCommand
 '    If e.CommandName = RadGrid.ExportToPdfCommandName Then
 '        isPdfExport = True
 '        rgCurrentPromo.MasterTableView.GetColumn("CUSTOMER_NAME").HeaderStyle.Width = Unit.Pixel(120)
 '        rgCurrentPromo.MasterTableView.GetColumn("PROMO_NO").HeaderStyle.Width = Unit.Pixel(100)
 '        rgCurrentPromo.MasterTableView.GetColumn("PROMO_NM").HeaderStyle.Width = Unit.Pixel(100)
 '        rgCurrentPromo.MasterTableView.GetColumn("PROMO_END_DT").HeaderStyle.Width = Unit.Pixel(100)
 '        rgCurrentPromo.MasterTableView.GetColumn("PROMO_DATE").HeaderStyle.Width = Unit.Pixel(100)
 '        rgCurrentPromo.MasterTableView.GetColumn("PROMO_DESC").HeaderStyle.Width = Unit.Pixel(100)
 '        rgCurrentPromo.MasterTableView.GetColumn("HA").HeaderStyle.Width = Unit.Pixel(120)
 '    End If
 'End Sub
 Protected Sub DownloadPDF_Click(sender As Object, e As EventArgs)
     isPdfExport = True
     rgCurrentPromo.MasterTableView.ExportToPdf()
 End Sub
 Protected Sub rgCurrentPromo_ItemCommand(sender As Object, e As Telerik.Web.UI.GridCommandEventArgs)
     If e.CommandName = RadGrid.ExportToExcelCommandName Then
         rgCurrentPromo.ExportSettings.HideStructureColumns = False
         rgCurrentPromo.Rebind()
     End If
 End Sub
 Private isExporting As Boolean = False
 Protected Sub b1_Click(ByVal sender As Object, ByVal e As EventArgs)
     isExporting = True
     rgCurrentPromo.ExportSettings.Excel.Format = GridExcelExportFormat.Biff
     rgCurrentPromo.ExportSettings.IgnorePaging = True
     rgCurrentPromo.ExportSettings.ExportOnlyData = False
     rgCurrentPromo.MasterTableView.AllowPaging = False
     ' rgCurrentPromo.ExportSettings.
     rgCurrentPromo.ExportSettings.FileName = "Current_Promotions"
     rgCurrentPromo.ExportSettings.OpenInNewWindow = True
     rgCurrentPromo.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None
     rgCurrentPromo.MasterTableView.HierarchyDefaultExpanded = True
     rgCurrentPromo.ExportSettings.HideStructureColumns = "false"
     ' rgCurrentPromo.MasterTableView.GroupHeaderTemplate.
  
     'Response.Clear()
     'Response.Buffer = True
     'Response.ContentType = "application/vnd.ms-excel"
     'Response.Charset = ""
     'Me.EnableViewState = False
     'Dim oStringWriter As New System.IO.StringWriter()
     'Dim oHtmlTextWriter As New System.Web.UI.HtmlTextWriter(oStringWriter)
     'rgCurrentPromo.RenderControl(oHtmlTextWriter)
     'Response.Write(oStringWriter.ToString())
     'Response.End()
     rgCurrentPromo.Rebind()
     rgCurrentPromo.MasterTableView.ExportToExcel()
 End Sub
 Protected Sub b2_Click(ByVal sender As Object, ByVal e As EventArgs)
     isExporting = True
     rgCurrentPromo.ExportSettings.ExportOnlyData = False
     rgCurrentPromo.ExportSettings.FileName = "Current_Promotions"
     rgCurrentPromo.ExportSettings.OpenInNewWindow = True
     rgCurrentPromo.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None
     rgCurrentPromo.MasterTableView.HierarchyDefaultExpanded = True
     rgCurrentPromo.ExportSettings.Pdf.PageHeader.LeftCell.Text = headerLeftCell
     rgCurrentPromo.ExportSettings.Pdf.PageHeader.LeftCell.TextAlign = GridPdfPageHeaderFooterCell.CellTextAlign.Center
     rgCurrentPromo.MasterTableView.GroupHeaderItemStyle.BackColor = Drawing.Color.Red
     rgCurrentPromo.MasterTableView.ExportToPdf()
 End Sub
 Protected Sub rgCurrentPromo_ItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs) Handles rgCurrentPromo.ItemDataBound
     If isExporting Then
         If e.Item.ItemType = GridItemType.Header Then
             e.Item.BackColor = System.Drawing.Color.White
             e.Item.ForeColor = System.Drawing.Color.Blue
             ' e.Item.Font.Bold = True
             e.Item.Height = Unit.Point(20)
             e.Item.Font.Size = 11
             e.Item.HorizontalAlign = HorizontalAlign.Left
         End If
         If e.Item.ItemType = GridItemType.Item Then
             e.Item.HorizontalAlign = HorizontalAlign.Left
         End If
         If e.Item.ItemType = GridItemType.AlternatingItem Then
             e.Item.HorizontalAlign = HorizontalAlign.Left
         End If
         If e.Item.ItemType = GridItemType.GroupHeader Then
             e.Item.ForeColor = System.Drawing.Color.Red
         End If
     End If
 End Sub
 Protected Sub rgCurrentPromo_BiffExporting(ByVal sender As Object, ByVal e As GridBiffExportingEventArgs)
Daniel
Telerik team
 answered on 10 Apr 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?