Hi,
I am using RadDatePicker and I want to make whole week selectable. When user click on any date then whole week row will be selected and input field will be filled with Monday's date. Also I can set default week by date.
In my page, depending on some settings (SomeSettings), I want just the week days be selected (weekends be excluded) when the user clicks on one of the week numbers. Below you can find my solution. As I am calling $(".RadAjax").hide(); currently to solve the AutoPostBack problem after calling sender.selectDate() function, I was wondering if anyone can provide a better solution:
<
div
id
=
"uxSmallCalendarPanel"
style
=
"width: 220px;"
runat
=
"server"
>
<
Telerik:RadCalendar
DayCellToolTipFormat
=
""
EnableNavigationAnimation
=
"true"
Style
=
"text-align: center;"
AutoPostBack
=
"true
CalendarTableStyle-BorderWidth
=
"0"
Width="100%" EnableMultiSelect="true" BorderStyle="None" runat="server" ID="uxCalendar" SkinID="imcrm" CultureInfo="" >
<
ClientEvents
OnRowHeaderClick
=
"confirmRowSelection"
/>
</
Telerik:RadCalendar
>
</
div
>
<
Telerik:RadAjaxManagerProxy
runat
=
"server"
ID
=
"uxAjaxManager"
>
<
AjaxSettings
>
<
Telerik:AjaxSetting
AjaxControlID
=
"uxSmallCalendarPanel"
>
<
UpdatedControls
>
<
Telerik:AjaxUpdatedControl
ControlID
=
"uxSmallCalendarPanel"
LoadingPanelID
=
"uxSmallLoadingPanel"
/>
</
UpdatedControls
>
</
Telerik:AjaxSetting
>
</
AjaxSettings
>
</
Telerik:RadAjaxManagerProxy
>
<
script
type
=
"text/javascript"
>
function confirmRowSelection(sender, eventArgs)
{
eventArgs.set_cancel(true);
var year = sender.get_focusedDate()[0];
var weekNumber = eventArgs.get_domElement().innerHTML;
var firstDayOfSelectedWeek = new Date(year, 0, (weekNumber - 1) * 7);
for (var i = 0; i < (SomeSettings ? 5 : 7); i++)
{
var selectedDate = new Date(firstDayOfSelectedWeek);
selectedDate.setDate(selectedDate.getDate() + i);
sender.selectDate([selectedDate.getFullYear(), selectedDate.getMonth() + 1, selectedDate.getDate()]);
}
$(".RadAjax").hide();
</
script
>
Dear Sir/Madam,
i am using telerik ajax dll version (Telerik.web.ui.dll) 2019.1.215.45 in asp.net application. i
have dynamically created radgrid which has more than 70 rows, so when i am
trying to export radgrid to pdf using RadClientExportManager [exporting html
content to pdf]. The lengthy radgrid is not continuing to next page in pdf. the
first 50 rows are printed in first page the rest of the rows are not getting
printed in second page.
Hi There,
Simple scenario, probably seen multiple times but couldn't find a solution for my case.
On my aspx page, I'm loading RadTabStrips along with RadMultiPage. Both are being defined from my DB, very basic, so far it's ok.
Within each pageView, I'm dynamically creating RadGrids, bound to OnNeedDataSource and OnItemCommand.
I tried multiple methods and the current one, generates the PageViews (embedding the grids) on the OnTabDataBound event from the RadTabStrip object.
Everything works like a charm until I click on some command from my Grids (refresh / export / sort whatever). When I click on any command, all of my page views disappear and I need to refresh the whole page to get them back.
How come my OnItemCommand handler is never called while OnNeedDataSource works fine (at least when it loads)? I tried to ajaxified the postback but it's not working any better. Anyone would have some recommendation ?
Cheers
Chris
Simple right ?
01.
<
div
id
=
"dataProcessingContent"
>
02.
<
telerik:RadTabStrip
ID
=
"rtsTabs"
runat
=
"server"
MultiPageID
=
"rmpTables"
SelectedIndex
=
"0"
DataSourceID
=
"dsPageViews"
DataTextField
=
"Name"
DataFieldID
=
"ID"
DataValueField
=
"ID"
OnTabDataBound
=
"rtsTabs_TabDataBound"
>
03.
</
telerik:RadTabStrip
>
04.
<
telerik:RadMultiPage
ID
=
"rmpTables"
runat
=
"server"
SelectedIndex
=
"0"
>
05.
</
telerik:RadMultiPage
>
06.
</
div
>
07.
<
asp:SqlDataSource
ID
=
"dsPageViews"
runat
=
"server"
SelectCommand
=
"P_GetSomeData"
SelectCommandType
=
"StoredProcedure"
ConnectionString="<% $ConnectionStrings:MyDB %>">
08.
<
SelectParameters
>
09.
<
asp:SessionParameter
SessionField
=
"SID"
DbType
=
"Int32"
DefaultValue
=
"0"
Name
=
"sid"
/>
10.
</
SelectParameters
>
11.
</
asp:SqlDataSource
>
My code behind:
001.
protected
void
rtsTabs_TabDataBound(
object
sender, RadTabStripEventArgs e)
002.
{
003.
try
004.
{
005.
var pv =
new
RadPageView();
006.
rmpTables.PageViews.Add(pv);
007.
var sdg =
new
SummaryDataGrid((
int
)Session[
"SID"
], (
string
)Session[
"StudyName"
],
int
.Parse(e.Tab.Value), e.Tab.Text);
008.
sdg.InstantiateIn(pv);
009.
010.
}
011.
catch
(Exception ex)
012.
{
013.
throw
ex;
014.
}
015.
}
016.
017.
private
class
SummaryDataGrid : ITemplate
018.
{
019.
private
int
_sid;
020.
private
string
_studyName;
021.
private
int
_effortId;
022.
private
string
_effortName;
023.
private
RadGrid _grid;
024.
025.
public
SummaryDataGrid()
026.
{ }
027.
public
SummaryDataGrid(
int
sid,
string
studyName,
int
effortId,
string
effortName)
028.
{
029.
this
._sid = sid;
030.
this
._effortId = effortId;
031.
this
._effortName = effortName;
032.
this
._studyName = studyName;
033.
}
034.
035.
public
void
InstantiateIn(Control container)
036.
{
037.
_grid =
new
RadGrid();
038.
_grid.ID = $
"dataGrid_{Guid.NewGuid()}"
;
039.
_grid.AllowMultiRowSelection =
true
;
040.
_grid.AllowSorting =
true
;
041.
_grid.AutoGenerateColumns =
true
;
042.
_grid.AllowFilteringByColumn =
false
;
043.
044.
_grid.MasterTableView.TableLayout = GridTableLayout.Auto;
045.
_grid.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;
046.
_grid.MasterTableView.CommandItemSettings.ShowExportToCsvButton =
true
;
047.
_grid.MasterTableView.CommandItemSettings.ShowExportToExcelButton =
true
;
048.
_grid.MasterTableView.CommandItemSettings.ShowExportToPdfButton =
true
;
049.
_grid.MasterTableView.CommandItemSettings.ShowRefreshButton =
true
;
050.
_grid.MasterTableView.CommandItemSettings.ShowAddNewRecordButton =
false
;
051.
_grid.MasterTableView.CommandItemSettings.ShowCancelChangesButton =
false
;
052.
053.
_grid.ExportSettings.HideStructureColumns =
false
;
054.
_grid.ExportSettings.IgnorePaging =
true
;
055.
_grid.ExportSettings.OpenInNewWindow =
true
;
056.
_grid.ExportSettings.ExportOnlyData =
true
;
057.
_grid.ExportSettings.FileName = $
"Data Summary_{_studyName}_{_effortName}_{DateTime.Now.ToString("
dd-MMM-yyyy
")}"
;
058.
_grid.ExportSettings.SuppressColumnDataFormatStrings =
true
;
059.
_grid.ExportSettings.Excel.Format = GridExcelExportFormat.Biff;
060.
_grid.ExportSettings.Csv.ColumnDelimiter = GridCsvDelimiter.Semicolon;
061.
_grid.ExportSettings.Csv.EncloseDataWithQuotes =
true
;
062.
_grid.ExportSettings.Csv.FileExtension =
"csv"
;
063.
_grid.ExportSettings.Pdf.Creator =
"Me"
;
064.
_grid.ExportSettings.Pdf.Author =
"Me"
;
065.
066.
_grid.ClientSettings.EnableRowHoverStyle =
true
;
067.
_grid.ClientSettings.Scrolling.AllowScroll =
true
;
068.
_grid.ClientSettings.Scrolling.UseStaticHeaders =
true
;
069.
_grid.ClientSettings.Selecting.AllowRowSelect =
true
;
070.
_grid.ClientSettings.Resizing.AllowResizeToFit =
true
;
071.
_grid.ClientSettings.AllowColumnsReorder =
true
;
072.
_grid.ClientSettings.ReorderColumnsOnClient =
true
;
073.
_grid.ClientSettings.ColumnsReorderMethod = GridClientSettings.GridColumnsReorderMethod.Reorder;
074.
_grid.ClientSettings.AllowColumnHide =
true
;
075.
_grid.ClientSettings.ClientEvents.OnDataBound =
"gridDataBound"
;
076.
077.
_grid.NeedDataSource += Grid_NeedDataSource;
078.
_grid.ItemCommand += Grid_ItemCommand;
079.
080.
container.Controls.Add(_grid);
081.
}
082.
083.
private
void
Grid_ItemCommand(
object
sender, GridCommandEventArgs e)
084.
{
085.
try
086.
{
087.
switch
(e.CommandName)
088.
{
089.
case
"Refresh"
:
090.
break
;
091.
}
092.
}
093.
catch
(Exception ex)
094.
{
095.
ex.GetDetails(Assembly.GetExecutingAssembly(), MethodBase.GetCurrentMethod().Name, MethodBase.GetCurrentMethod().DeclaringType.Name, _sid);
096.
throw
ex;
097.
}
098.
}
099.
100.
private
void
Grid_NeedDataSource(
object
sender, GridNeedDataSourceEventArgs e)
101.
{
102.
try
103.
{
104.
var sda =
new
SqlDataAdapter(
"P_GetMyOtherData"
,
new
SqlConnection(MyConnectionString);
105.
sda.SelectCommand.CommandType = CommandType.StoredProcedure;
106.
sda.SelectCommand.Parameters.AddWithValue(
"@sid"
, _sid);
107.
sda.SelectCommand.Parameters.AddWithValue(
"@effortID"
, _effortId);
108.
109.
sda.SelectCommand.Connection.Open();
110.
if
(sda.SelectCommand.Connection.State != ConnectionState.Open)
111.
throw
new
Exception($
"Woopsy... Something failed while trying to connect to DB"
);
112.
113.
var data =
new
DataTable(
this
._effortName);
114.
try
115.
{
116.
sda.Fill(data);
117.
}
118.
finally
119.
{
120.
sda.SelectCommand.Connection.Close();
121.
}
122.
123.
_grid.DataSource = data;
124.
}
125.
catch
(Exception ex)
126.
{
127.
_grid.DataSource =
null
;
128.
ex.GetDetails(Assembly.GetExecutingAssembly(), MethodBase.GetCurrentMethod().Name, MethodBase.GetCurrentMethod().DeclaringType.Name, _sid);
129.
throw
ex;
130.
}
131.
}
132.
}
Grid_ItemCommand is never called .... ????
I am using a RadGrid as a tool for searching through a table. The table itself has 30 columns. If I bring it directly into the grid (e.g. select *), its width spans three screens, which is unacceptable to the client.
So instead of loading the entire table, I've written the grid's select statement to bring in only the 10 most useful columns for searching. I would like to capture something like an OnClick event on the server side that fires immediately after the user clicks on the grid's edit image (the pencil) or insert command link. These events would fire before there is any attempt to bring up a custom edit/insert form or the default in-place form for edits/inserts.
In that event, I plan to redirect to another page (X) to be used for inserting and updating. Within the event, I would need to know if the edit or insert command had been fired. When editing, I would need to be able to get the record id so I could get all the record's data to display in the edit form. Remember the grid only knows about the 10 columns. I would handle saving back to the DB in X and on success would redirect back to the grid page, which would refresh itself naturally.
Is this possible? I can't find anything like OnClick events for edit and insert, and don't know where and how to determine if I'm in Edit or Insert mode, or if in Edit how to find the current record ID.
Any help would be much appreciated.
Hello,
I have a web page which is using RadTreeView. It works well, now we want to support WCAG 2.0 after set EnableAriaSupport = True the RadTreeView doesn't work as before it causes the page scrolls back to the top because the tree jumps to the previous selected node when expand/select nodes at very last of the tree.
See attached files for details
You also find this issue on the page https://demos.telerik.com/aspnet-ajax/treeview/examples/accessibility/defaultcs.aspx.
Could you please advise how to keep the tree doesn't jump back to previous selected node
Thanks
ScriptManager.RegisterStartupScript(
this
, GetType(), ClientID,
string
.Format(
"Sys.Application.add_load(function(){{$find('{0}').get_element().focus();}}, 0);"
, AppTreeView.ClientID),
true
);
We have been using the ASP.NET AJAX UI product for a client since 2012. I have had 8 staff members working on it full time since 2012 so as you can imagine, this is a gigantic application. Over the years the client has requested more and more features and the most important page in the application is now very heavy and taking a minute and a half to load out in the field on a tablet. The frustration level is at a breaking point. We absolutely must improve performance.
1. Do you think upgrading to the latest version would give us a significant performance boost?
2. If we upgrade are we going to introduce a whole host of new issues?
3. What are the best tips/tricks for optimising pages heavey with telerik grids, tabs and dropdowns?
-Lance Keene
I increased font on the legend, but stick color marker didn't increase accordingly.
Is there a way to access this through css or otherwise.
Attached current and desired pics
Thank you