protected
void
RadGrid1_ItemCommand(
object
source, GridCommandEventArgs e)
{
if
(e.CommandName.Contains(
"Export"
))
{
RadGrid theGrid = (RadGrid)source;
theGrid.MasterTableView.HierarchyDefaultExpanded =
false
;
}
}
Hi Team,
I am using Rad Grid in my project. I want to expand row template on click of row from client side. The code runs fine but when I put ASP .Net Update panel, code stops running after page postback. Below is my code. I am implementing this under DNN site.
Update panel code:
<asp:UpdatePanel ID="updOnlinePaymentHistory" runat="server">
<ContentTemplate>
..........
</ContentTemplate>
</asp:UpdatePanel>
javascript function:
function RowClick(sender, args) {
var item = args.get_item();
var lastState = item.get_expanded();
var Grid = $find("<%= gridPayment.ClientID %>");
var MasterTable = Grid.get_masterTableView();
for (var i = 0; i < MasterTable.get_dataItems().length; i++) {
var row = MasterTable.get_dataItems()[i];
row.set_expanded(false);
}
item.set_expanded(!lastState);
}
HTML defining Rad Grid:
<telerik:RadGrid ID="gridPayment"
AllowPaging="true"
PageSize="24"
runat="server"
AllowSorting="true"
CellSpacing="0"
GridLines="Horizontal"
CssClass="table-responsive"
OnItemDataBound="grdPayment_ItemDataBound"
OnPageIndexChanged="gridPayment_PageIndexChanged"
EnableGroupsExpandAll="false"
RegisterWithScriptManager="False">
<!-- column and template code here -->
<ClientSettings>
<ClientEvents OnRowClick="RowClick" />
</ClientSettings>
</telerik:RadGrid>
When I load page, row expand works fine. but after postback of page, it stops working.
Can you please help me out on this.
Chirag Khunti
Hi,
I am having major problems with the RadEditor control.
What makes this particularly troublesome is that it works in IE11
but not Chrome.
I have a RadEditor which is embedded within an asp:ListView control (see below) whic in turn, is embedded into ans ascx user control.
The general idea is that the code behind hides and shows different controls in the ListView rows according to the configuration of a property panel.
When the user makes a selection on the page, the user control is made visible and the asp:ListView below is updated with a new DataBind().
<asp:ListView ID="lveProperties" runat="server"
OnItemDataBound="lveProperties_ItemDataBound">
<ItemTemplate>
<asp:Panel ID="pnlProperty" runat="server">
<div class="row">
<asp:Literal ID="litBannerSpacer1"
runat="server" Text="<br />"
Visible="false"></asp:Literal>
<div class="<%=col1Width%>
coursenames">
<asp:Label ID="lblPropertyName"
runat="server"></asp:Label>
</div>
<div class="<%=col2Width%>
coursenames">
<asp:CheckBox ID="chkCheck"
runat="server" Visible="False"></asp:CheckBox>
<telerik:RadTextBox ID="txtText"
runat="server" Visible="false"></telerik:RadTextBox>
<telerik:RadNumericTextBox ID="txtNumber"
runat="server" Type="Number"
Visible="false"></telerik:RadNumericTextBox>
<telerik:RadComboBox ID="ddlList"
runat="server" Visible="false"
MaxHeight="200"></telerik:RadComboBox>
<telerik:RadDatePicker ID="dpDate"
runat="server" Visible="false"
MinDate="1900/01/01"></telerik:RadDatePicker>
<telerik:RadEditor ID="txtNText"
runat="server" Visible="false" EditModes="Design,Html"
NewLineMode="Br">
<CssFiles>
<telerik:EditorCssFile
Value="/Styles/RadEditorContentAreaStyles.css" />
</CssFiles>
<Languages>
<telerik:SpellCheckerLanguage
Code="en-US" Title="English (US)" />
<telerik:SpellCheckerLanguage
Code="fr-FR" Title="French" />
<telerik:SpellCheckerLanguage
Code="de-DE" Title="German" />
</Languages>
<Tools>
<telerik:EditorToolGroup>
<telerik:EditorTool
Name="Cut" />
<telerik:EditorTool
Name="Copy" ShortCut="CTRL+C" />
<telerik:EditorTool
Name="Paste" ShortCut="CTRL+V" />
<telerik:EditorSeparator
Visible="true" />
<telerik:EditorTool
Name="Undo" />
<telerik:EditorTool
Name="Redo" />
</telerik:EditorToolGroup>
<telerik:EditorToolGroup>
<telerik:EditorTool
Name="Bold" />
<telerik:EditorTool
Name="Underline" />
<telerik:EditorTool
Name="Italic" />
<telerik:EditorTool
Name="StrikeThrough" />
<telerik:EditorSeparator
Visible="true" />
<telerik:EditorTool
Name="JustifyLeft" />
<telerik:EditorTool
Name="JustifyCenter" />
<telerik:EditorTool
Name="JustifyRight" />
<telerik:EditorSeparator
Visible="true" />
<telerik:EditorTool
Name="InsertOrderedList" />
<telerik:EditorTool
Name="InsertUnorderedList" />
<telerik:EditorSeparator
Visible="true" />
<telerik:EditorTool
Name="Indent" />
<telerik:EditorTool
Name="Outdent" />
</telerik:EditorToolGroup>
<telerik:EditorToolGroup>
<telerik:EditorTool
Name="ForeColor" />
<telerik:EditorTool
Name="BackColor" />
<telerik:EditorTool
Name="InsertTable" />
</telerik:EditorToolGroup>
<telerik:EditorToolGroup>
<telerik:EditorTool
Name="FontName" />
<telerik:EditorTool
Name="RealFontSize" />
</telerik:EditorToolGroup>
<telerik:EditorToolGroup>
<telerik:EditorTool
Name="AjaxSpellCheck" />
</telerik:EditorToolGroup>
</Tools>
</telerik:RadEditor>
</div>
<asp:Literal ID="litBannerSpacer2"
runat="server" Text="<br /><br />"
Visible="false"></asp:Literal>
</div>
</asp:Panel>
Part of this process sets the RadEditor properties:
txtNText.Visible = true;
txtNText.Width =
Unit.Parse(property.ControlWidth); // eg "100%"
txtNText.Height =
Unit.Parse(property.ControlHeight); // eg "300"
txtNText.MaxTextLength = property.MaxLength;
currentValue = GetZoneProperty(0,
languageId, property.PropertyName);
if (currentValue == "") currentValue =
defaultValue;
txtNText.Content = currentValue;
txtNText.Enabled = enabled;
// Spell checking
txtNText.SpellCheckSettings.AllowAddCustom =
true;
txtNText.SpellCheckSettings.SpellCheckProvider =
SpellCheckProvider.PhoneticProvider;
In IE11, when the RadEditor appears with text populated, it is
correct, however in Chrome, is appears with a single line (see image
attachment).
While debugging the DOM in both IE11 and Chrome, I note that the
iframe is only a few pixels high. IE11 seems to ignore this whereas
Chrome doesn't. I tried various ways, including all of those on the
Telerik forums to 'get' the iframe and set its height, but for some
reason, none of them worked. The Chrome DOM showed this:
<td
id="ctl00_ContentPlaceHolder_ctlZonePropertyPanel_lveProperties_ctrl1_txtNTextCenter"
class="reContentCell" style="height:100%;">
<label
for="ctl00_ContentPlaceHolder_ctlZonePropertyPanel_lveProperties_ctrl1_txtNTextContentHiddenTextarea"
style="display:none;">RadEditor hidden textarea</label>
<textarea
id="ctl00_ContentPlaceHolder_ctlZonePropertyPanel_lveProperties_ctrl1_txtNTextContentHiddenTextarea"
name="ctl00$ContentPlaceHolder$ctlZonePropertyPanel$lveProperties$ctrl1$txtNText"
rows="4" cols="20" style="display:none;">%3cp
style%3d%22text-align%3a center%3b%22%3e%3cspan style%3d%22color%3a
%23002060%3b font-size%3a 18px%3b%22%3eWelcome to the Bushfire
Safety Package
%3c/span%3e%3c/p%3e
%3cp%3e
%3cspan style%3d%22color%3a %23002060%3b%22%3eLorem ipsum
dolor.....</textarea>
<iframe frameborder="0"
src="javascript:'<html></html>';"
id="ctl00_ContentPlaceHolder_ctlZonePropertyPanel_lveProperties_ctrl1_txtNText_contentIframe"
title="Rich text editor with ID
ctl00_ContentPlaceHolder_ctlZonePropertyPanel_lveProperties_ctrl1_txtNText"
style="width: 100%; height: 35px; margin: 0px; padding:
0px;">Your browser does not support inline frames or is currently
configured not to display inline frames.</iframe>
</td>
My RadEditor control is called txtNText so quite how the name has been changed to ...textNTextCenter I don't know.
Even using document.getElementById on ''ctl00_ContentPlaceHolder_ctlZonePropertyPanel_lveProperties_ctrl1_txtNText_contentIframe"
did not find the iframe - how can this be ? All the sample solutions eg:
var editorIframe = $get(editorClientID).getElementsByTagName('iframe')[0];
editorIframe.style.height = '100%';
$('#' + editorClientID).setSize('100%','300px');
Failed to find the iframe.
How can I fix this please ?
Better still, can we have a JavaScript API added to the RadEditor which can be called which just 'works' and fixes this ?
Thankyou
PS: Why does pasting into this editor cut all my lines in half and why does it insert a blank line between every line ? This is a nuisance!
I've seen this snippet of code on the forums which supposedly moves the gantt view to the current date:
this.RadGantt1.ScrollingService.ScrollToDateTime(DateTime.Today);
Unfortunately it seems to be deprecated and I can't find a suitable option in the help (or in the control methods).
Any help would be appreciated.
thanks.
Hello, Happy New Year everyone.
I set up the scheduler using the example for advanced insert template as described here: http://demos.telerik.com/aspnet-ajax/scheduler/examples/advancedformtemplate/defaultcs.aspx
I added a method for the click event of the insert button, to so some custom code, and appointment validation. For example I'm checking our database to make sure there is no appointment conflict.
The issue i'm having is that if I handle an exception in that event, the advanced insert form template modal still continue to process, closes, and still hits the insert appointment method for the RadScheduler on the default page.
I would like to keep the modal open until all validation passes, then proceed, is there a way to do this? Or is there a way to programatically reopen the modal?
Thanks
<telerik:RadGrid ID="RadGrid1" ShowStatusBar="true" GridLines="None" runat="server" AllowAutomaticDeletes="True" |
AllowAutomaticInserts="True" OnNeedDataSource="RadGrid1_NeedDataSource" PageSize="10" |
AllowAutomaticUpdates="True" AllowPaging="True" MasterTableView-AllowAutomaticInserts="true" |
AutoGenerateColumns="True" AutoGenerateDeleteColumn="true" AutoGenerateEditColumn="true" |
OnInsertCommand="RadGrid1_InsertCommand" OnUpdateCommand="RadGrid1_UpdateCommand" |
Skin="Web20" OnDeleteCommand="RadGrid1_DeleteCommand"> |
<PagerStyle Mode="NextPrevAndNumeric" /> |
<MasterTableView InsertItemDisplay="Top"> |
</MasterTableView> |
</telerik:RadGrid> |