Hi. i am required to export the data from RadGrid into excel on Sharepoint 2013 custom webpart. i have the following issue
ascx markup
01.
<
telerik:RadGrid
RenderMode
=
"Lightweight"
runat
=
"server"
ID
=
"gridCourse"
AllowPaging
=
"True"
AutoGenerateColumns
=
"False"
AllowSorting
=
"true"
PageSize
=
"14"
02.
OnSortCommand
=
"gridCourse_SortCommand"
OnPageIndexChanged
=
"gridCourse_PageIndexChanged"
OnExcelMLExportRowCreated
=
"gridCourse_ExcelMLExportRowCreated"
03.
OnPageSizeChanged
=
"gridCourse_PageSizeChanged"
AllowMultiRowSelection
=
"true"
>
04.
<
MasterTableView
PagerStyle-Mode
=
"NumericPages"
PagerStyle-Position
=
"TopAndBottom"
PagerStyle-HorizontalAlign
=
"Right"
UseAllDataFields
=
"true"
>
05.
<
Columns
>
06.
<
telerik:GridTemplateColumn
HeaderStyle-Font-Bold
=
"true"
SortExpression
=
"id"
UniqueName
=
"id"
HeaderText
=
"Course ID"
ItemStyle-HorizontalAlign
=
"Center"
ItemStyle-VerticalAlign
=
"Middle"
>
07.
<
ItemTemplate
>
08.
<
asp:HyperLink
ID
=
"lnkId"
runat
=
"server"
NavigateUrl='<%# string.Format(manageCourseURL, HttpUtility.UrlEncode(Eval("id").ToString())) %>' Text='<%# Eval("id") %>'></
asp:HyperLink
>
09.
<
asp:Label
runat
=
"server"
ID
=
"lblCourseId"
Visible
=
"false"
Text='<%# Eval("id") %>'></
asp:Label
>
10.
</
ItemTemplate
>
11.
</
telerik:GridTemplateColumn
>
12.
<
telerik:GridBoundColumn
HeaderStyle-Font-Bold
=
"true"
UniqueName
=
"courseCode"
ItemStyle-Width
=
"150"
ItemStyle-HorizontalAlign
=
"Center"
ItemStyle-VerticalAlign
=
"Middle"
13.
SortExpression
=
"courseCode"
HeaderText
=
"Course Code"
DataField
=
"courseCode"
>
14.
</
telerik:GridBoundColumn
>
15.
<
telerik:GridBoundColumn
HeaderStyle-Font-Bold
=
"true"
UniqueName
=
"courseTitle"
ItemStyle-Width
=
"250"
ItemStyle-HorizontalAlign
=
"Center"
ItemStyle-VerticalAlign
=
"Middle"
16.
SortExpression
=
"courseTitle"
HeaderText
=
"Course Title"
DataField
=
"courseTitle"
>
17.
</
telerik:GridBoundColumn
>
18.
<
telerik:GridBoundColumn
HeaderStyle-Font-Bold
=
"true"
UniqueName
=
"courseType"
ItemStyle-Width
=
"150"
ItemStyle-HorizontalAlign
=
"Center"
ItemStyle-VerticalAlign
=
"Middle"
19.
SortExpression
=
"courseType"
HeaderText
=
"Course Type"
DataField
=
"courseType"
>
20.
</
telerik:GridBoundColumn
>
21.
<
telerik:GridBoundColumn
HeaderStyle-Font-Bold
=
"true"
UniqueName
=
"courseTemplate"
ItemStyle-Width
=
"150"
ItemStyle-HorizontalAlign
=
"Center"
ItemStyle-VerticalAlign
=
"Middle"
22.
SortExpression
=
"courseTemplate"
HeaderText
=
"Course Template"
DataField
=
"courseTemplate"
>
23.
</
telerik:GridBoundColumn
>
24.
<
telerik:GridBoundColumn
HeaderStyle-Font-Bold
=
"true"
UniqueName
=
"duration"
ItemStyle-Width
=
"80"
ItemStyle-HorizontalAlign
=
"Center"
ItemStyle-VerticalAlign
=
"Middle"
25.
SortExpression
=
"duration"
HeaderText
=
"Duration"
DataField
=
"duration"
>
26.
</
telerik:GridBoundColumn
>
27.
<
telerik:GridBoundColumn
HeaderStyle-Font-Bold
=
"true"
UniqueName
=
"status"
ItemStyle-Width
=
"60"
ItemStyle-HorizontalAlign
=
"Center"
ItemStyle-VerticalAlign
=
"Middle"
28.
SortExpression
=
"status"
HeaderText
=
"Status"
DataField
=
"status"
>
29.
</
telerik:GridBoundColumn
>
30.
<
telerik:GridBoundColumn
HeaderStyle-Font-Bold
=
"true"
UniqueName
=
"modifiedDate"
ItemStyle-Width
=
"200"
ItemStyle-HorizontalAlign
=
"Center"
ItemStyle-VerticalAlign
=
"Middle"
31.
SortExpression
=
"modifiedDate"
HeaderText
=
"Last Modified Date"
DataField
=
"modifiedDate"
DataFormatString
=
"{0:d MMMM yyyy hh:mm tt}"
htmlencode
=
"false"
>
32.
</
telerik:GridBoundColumn
>
33.
<
telerik:GridClientSelectColumn
UniqueName
=
"chkCell"
ItemStyle-Width
=
"10"
>
34.
</
telerik:GridClientSelectColumn
>
35.
</
Columns
>
36.
</
MasterTableView
>
37.
<
ClientSettings
>
38.
<
Selecting
AllowRowSelect
=
"true"
></
Selecting
>
39.
</
ClientSettings
>
40.
</
telerik:RadGrid
>
code behind
01.
protected
void
btnExport_Click(
object
sender, EventArgs e)
02.
{
03.
gridCourse.ExportSettings.Excel.Format = GridExcelExportFormat.ExcelML;
04.
gridCourse.ExportSettings.ExportOnlyData =
true
;
05.
gridCourse.ExportSettings.IgnorePaging =
true
;
06.
gridCourse.ExportSettings.OpenInNewWindow =
true
;
07.
gridCourse.ExportSettings.FileName = export.getResourceString(
"litExportFilename"
);
08.
gridCourse.ExportToExcel();
09.
}
10.
11.
protected
void
gridCourse_ExcelMLExportRowCreated(
object
sender, Telerik.Web.UI.GridExcelBuilder.GridExportExcelMLRowCreatedArgs e)
12.
{
13.
e.Worksheet.Name = export.getResourceString(
"litExcelDefaultWorksheetName"
);
14.
}
Hi There,
I have a 3-Month view RadCalender in my page, however, the control crossed the border of my page. As shown in the attached screenshot, I would like to set the RadCalendar inside the the Red area. I figured that the width of the Calendar control can only set to the value larger than "280px". The control size does not change at all when I set the width value to "220px". Is there any way to make the RadCalendar fit my page?
My second question is, the look and feel of the RadCalendar in my page is not the same as shown in the Telerik RadCalendar demos, please see the attached screenshot files. I use the same code as the Telerik demos, how to make it looks the same as the demos? Please help.
Any suggestions is much appreciated.
Today I ran into an issue with a grid that is linked to a LinqDataSource via DataSourceId and no ViewState.
Initially, everything works fine but after a postback (paging, sorting, filtering), the Selecting event of the LinqDataSource is fired twice, once before page_load and once after. The problem is that this will cause an expensive query to run twice.
Anybody experienced this problem? With ViewState enabled, everything works fine.
Thanks, Martijn
Hi
We use RadGrid as a single Grid for many tables.
We bind the radGrid at runtime at the OnInit event, and showing the values is not an issue, it works fine.
We have for example table of Users with some columns such as: Name, ID, Phone number and UserType, this UserType column holds a foreign key number in DB, but those keys represent text from another table, let's say "UserTypeTable".
The grid should show the text - so we bind the grid with a view, and it works great.
The problem starts when we need to allow to edit, then we should know whether it's a "Normal" field or "ForeignKey" field and if it's ForeignKey field, it should be a combobox with relevant values.
Same about filters, for normal fields the filter is normal, but for ForeignKey fields, the filter should be combobox.
All this should be dynamically and work at runtime.
Is it possible at all?
Thanks,
Eliran
I have two RadDatePicker control for Start Date and End Date selections. The tabbing should be in order from Start Date textbox (tabindex=1), then to Start Date calendar icon(tabindex=2), then to End Date textbox(tabindex=3) and to End Date calendar icon(tabindex=4).
My issues were every time I hit the Start Date calendar icon and select a date, the focus always appear on the Textbox of Start Date and the tabbing start in Start Date textbox. Even I hit the End Date calendar icon and after selecting a date, the tabbing start in Start Date textbox again.
I want the focus stay in the calendar icon every time I select a date, so that the tabbing will be in order.
Please help...I spent a lot of time of searching a solutions in the internet and can't find anything that I can use. Thanks in advance....
<tr>
<td width="160px">Start Date</td>
<td>
<telerik:RadDatePicker ID="dtFrom" runat="server" title="Start Date Entry" TabIndex="1" >
<DatePopupButton ToolTip="Open Start Date Calendar popup" />
<Calendar ID="Calendar1" runat="server" NavigationNextToolTip="NextMonth" NavigationPrevTooltip="PreviousMonth" FastNavigationNextToolTip="NextMonth3" FastNavigationPrevToolTip="PreviousMonth3" EnableKeyboardNavigation="true" TabIndex="2" CalendarCaption="Start Date Calendar">
</Calendar>
</telerik:RadDatePicker>
<asp:RequiredFieldValidator ID="rvStart" runat="server" ErrorMessage="Travel Start Date is Required" ControlToValidate="dtFrom"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>End Date
</td>
<td>
<telerik:RadDatePicker ID="dtTo" name="dtTo" runat="server" title="End Date Entry" TabIndex="3">
<DatePopupButton ToolTip="Open End Date Calendar popup" />
<Calendar ID="Calendar2" runat="server" NavigationNextToolTip="NextMonth" NavigationPrevTooltip="PreviousMonth" FastNavigationNextToolTip="NextMonth3" FastNavigationPrevToolTip="PreviousMonth3" EnableKeyboardNavigation="true" TabIndex="4" CalendarCaption="End Date Calendar">
</Calendar>
</telerik:RadDatePicker>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Travel End Date is Required" ControlToValidate="dtTo"></asp:RequiredFieldValidator>
</td>
</tr>