Please find below code :
aspx:
<asp:UpdatePanel ID ="upnl" runat ="server" >
<ContentTemplate>
<telerik:RadGrid RenderMode="Lightweight" ID="SupplierPackageDetails" runat="server" ShowStatusBar="true" AutoGenerateColumns="False"
PageSize="7" AllowSorting="false" AllowMultiRowSelection="False" AllowPaging="False"
OnDetailTableDataBind="SupplierPackageDetails_DetailTableDataBind"
OnPreRender="SupplierPackageDetails_PreRender"
OnNeedDataSource="SupplierPackageDetails_NeedDataSource"
OnItemDataBound="SupplierPackageDetails_ItemDataBound"
RetainExpandStateOnRebind="true"
AllowAutomaticInserts ="false"
EnableGroupsExpandAll="true" ClientSettings-EnablePostBackOnRowClick="false" CssClass="RadGridCustomClass" OnItemCommand="SupplierPackageDetails_ItemCommand">
<PagerStyle Mode="NumericPages"></PagerStyle>
<HeaderStyle CssClass="HeaderStyle"></HeaderStyle>
<ClientSettings EnablePostBackOnRowClick="false">
</ClientSettings>
<MasterTableView DataKeyNames="LineItemId" AllowAutomaticInserts ="false" AllowMultiColumnSorting="false" HierarchyLoadMode="Client" HierarchyDefaultExpanded="true" RetainExpandStateOnRebind="true">
<DetailTables>
<telerik:GridTableView DataKeyNames="LineItemId,OrderPackageLineItemId" ExpandCollapseColumn-Display="false" RetainExpandStateOnRebind="true" Name="Performancestep" Width="100%" AlternatingItemStyle-BackColor="White" EditMode="EditForms">
<HeaderStyle CssClass="InnerHeaderStyle"></HeaderStyle>
<%--OIT-1857 Show configuration information in order details like print page for Update Supplier screen--%>
<DetailTables>
<telerik:GridTableView EnableHierarchyExpandAll="true" ExpandCollapseColumn-Display="false" HierarchyDefaultExpanded="true" RetainExpandStateOnRebind="true" DataKeyNames="Config" Width="100%" Name="ConfigDetails"
AutoGenerateColumns="false" runat="server">
<Columns>
<telerik:GridBoundColumn SortExpression="Config" HeaderText="Configuration Details" HeaderButtonType="TextButton"
DataField="Config" UniqueName="Config">
</telerik:GridBoundColumn>
</Columns>
</telerik:GridTableView>
</DetailTables>
<%--OIT-1857--%>
<Columns>
<%-- <telerik:GridExpandColumn UniqueName="ExapandColumn" Visible="false"></telerik:GridExpandColumn>--%>
<telerik:GridBoundColumn HeaderButtonType="TextButton" HeaderText="Product Id"
DataField="PerformanceStepId" HeaderStyle-Width="95px" ItemStyle-Width="95px"
HeaderStyle-Font-Bold="true" UniqueName="PerformanceStepId">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="Title" HeaderButtonType="TextButton"
DataField="Title" HeaderStyle-Width="200px" ItemStyle-Width="200px"
HeaderStyle-Font-Bold="true" ItemStyle-HorizontalAlign="Left">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn ItemStyle-HorizontalAlign="Right"
HeaderText="OneTime Cost" HeaderStyle-Width="80px" ItemStyle-Width="80px"
HeaderStyle-Font-Bold="true">
<ItemTemplate>
<asp:Label ID="Label6" runat="server" Text='<%# PresentationUtils.FormatCurrency((Decimal)Eval("OneTimeCost")) %>'></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn ItemStyle-HorizontalAlign="Right"
HeaderText="Monthly Cost" HeaderStyle-Width="80px" ItemStyle-Width="80px"
HeaderStyle-Font-Bold="true">
<ItemTemplate>
<asp:Label ID="Label7" runat="server" Text='<%# PresentationUtils.FormatCurrency((Decimal)Eval("MonthlyCost")) %>'></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<%--OIT-1754 Changes to Update Supplier Status screen--%>
<telerik:GridBoundColumn HeaderButtonType="TextButton" HeaderText="Part No."
DataField="SupplierPartNo" HeaderStyle-Width="95px" ItemStyle-Width="95px"
HeaderStyle-Font-Bold="true">
</telerik:GridBoundColumn>
<%-- <telerik:GridTemplateColumn ItemStyle-HorizontalAlign="Right"
HeaderText="Part Number" HeaderStyle-Width="80px" ItemStyle-Width="80px"
HeaderStyle-Font-Bold="true">
<ItemTemplate>
<asp:Label ID="Label7" runat="server" Text='<%# Eval("SupplierPartNo") %>'></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridImageColumn HeaderText="View Configuration" HeaderStyle-Width="90px"
HeaderStyle-Font-Bold="true" ItemStyle-HorizontalAlign="Center">
</telerik:GridImageColumn>--%>
<telerik:GridBoundColumn HeaderText="Status" HeaderButtonType="TextButton" HeaderStyle-Font-Bold="true"
DataField="ConfigurableStatusDescription">
</telerik:GridBoundColumn>
<telerik:GridImageColumn HeaderText="History" HeaderStyle-Width="90px" HeaderStyle-Font-Bold="true" ItemStyle-HorizontalAlign="Center"></telerik:GridImageColumn>
<telerik:GridBoundColumn HeaderButtonType="TextButton" HeaderText="Product Id"
DataField="LineItemId" HeaderStyle-Width="90px" ItemStyle-Width="90px" Display="false"
HeaderStyle-Font-Bold="true">
</telerik:GridBoundColumn>
<telerik:GridEditCommandColumn UniqueName="GridEditCommandColumn" ButtonType="ImageButton" EditImageUrl="images/icon_edit.gif">
</telerik:GridEditCommandColumn>
</Columns>
<EditFormSettings EditFormType="Template">
<FormTemplate>
<%-- <asp:UpdatePanel ID ="updEdit" runat="server" UpdateMode ="Always" >
<ContentTemplate >--%>
<table id="Table2" cellspacing="2" cellpadding="1" width="100%" border="0" rules="none"
style="border-collapse: collapse;">
<tr>
<td colspan="2">
<b>Select Supplier Status</b>
</td>
</tr>
<tr>
<td>Supplier Status:</td>
<td style="padding-bottom: 10px">
<asp:DropDownList ID="ddlSupplierStatus" runat="server">
<asp:ListItem Text="In Progress" Value="BOOKED"></asp:ListItem>
<asp:ListItem Text="Delivered" Value="DELIVERED"></asp:ListItem>
<asp:ListItem Text="Cancelled" Value="CANCELLED"></asp:ListItem>
<%--// LSHK1P - OIT-1856 New status in Update order status screen--%>
<asp:ListItem Text="Transferred" Value="TRANSFERRED"></asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
<div style="float: left; width: 150px;">
Enter Comments :
</div>
</td>
<td>
<div style="float: left">
<asp:TextBox ID="txtCommentsforSupplier" TextMode="MultiLine" Width="400px" Height="100px" Enabled="true"
runat="server" MaxLength="800"></asp:TextBox>
</div>
</td>
</tr>
<tr>
<td></td>
<td>(max 800 characters)
</td>
<td colspan="3"></td>
</tr>
<tr>
<td align="center" colspan="2">
<asp:Button ID="btnSave" Text="Save"
runat="server" CommandName="Save" CausesValidation="False" ></asp:Button>
<%--<asp:UpdatePanel runat="server"><Triggers><asp:AsyncPostBackTrigger ControlID="btnSave"/></Triggers></asp:UpdatePanel>--%>
<asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
CommandName="Cancel"></asp:Button>
</td>
</tr>
</table>
<%-- </ContentTemplate>
<Triggers >
<asp:AsyncPostBackTrigger ControlID ="btnSave" EventName="Save" />
</Triggers>
</asp:UpdatePanel>--%>
</FormTemplate>
</EditFormSettings>
</telerik:GridTableView>
</DetailTables>
<Columns>
<telerik:GridBoundColumn HeaderText="Product Id" HeaderButtonType="TextButton"
DataField="PackageId" HeaderStyle-Width="80px" ItemStyle-Width="80px"
ItemStyle-BackColor="#e5e5e5" ItemStyle-HorizontalAlign="Left" HeaderStyle-Font-Bold="true">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn ItemStyle-HorizontalAlign="Left" ItemStyle-BackColor="#e5e5e5"
HeaderText="Title" HeaderStyle-Width="175px" ItemStyle-Width="175px"
ItemStyle-BorderColor="#e5e5e5" HeaderStyle-Font-Bold="true">
<ItemTemplate>
<a id="pkgTitle" runat="server" style="font-weight: bold;" href='javascript:openBrWindowBig("PackageInCart_View.aspx?LineItem=<%# Eval("LineItemId") %>&Mode=<%= order%>&OrderGuid=<%=hdnOrderId.Value%>&UserId=<%=hdnUserId.Value%>&Released=<%=this.IsReleased %>","","")'>
<asp:Label ID="lblPackageTitle" CommandArgument='<%# Eval("LineItemId")%>' runat="server" Text='<%# Eval("Title") %>'></asp:Label>
</a>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn HeaderText="Quantity" HeaderButtonType="TextButton"
DataField="Quantity" HeaderStyle-Width="80px" ItemStyle-Width="80px"
ItemStyle-BackColor="#e5e5e5" HeaderStyle-Font-Bold="true">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn ItemStyle-HorizontalAlign="Right" ItemStyle-BackColor="#e5e5e5"
HeaderText="OneTime Cost" HeaderStyle-Width="100px" ItemStyle-Width="100px"
ItemStyle-BorderColor="#e5e5e5" HeaderStyle-Font-Bold="true">
<ItemTemplate>
<asp:Label ID="Label6" runat="server" Text='<%# PresentationUtils.FormatCurrency((Decimal)Eval("OneTimeCost")) %>'></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn ItemStyle-HorizontalAlign="Right" ItemStyle-BackColor="#e5e5e5"
HeaderText="Monthly Cost" HeaderStyle-Width="100px" ItemStyle-Width="100px"
ItemStyle-BorderColor="#e5e5e5" HeaderStyle-Font-Bold="true">
<ItemTemplate>
<asp:Label ID="Label7" runat="server" Text='<%# PresentationUtils.FormatCurrency((Decimal)Eval("MonthlyCost")) %>'></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn ItemStyle-HorizontalAlign="Center" ItemStyle-BackColor="#e5e5e5"
HeaderText="View Configuration" HeaderStyle-Width="90px" ItemStyle-Width="90px"
HeaderStyle-Font-Bold="true">
<ItemTemplate>
<%-- CR 5555 Config info for Pkg --%>
<asp:Image ID="imgPkgViewConfig" ImageUrl="images/icon_cog.gif" runat="server"
border="0" align="absmiddle" />
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
</ContentTemplate>
<%-- <Triggers>
<asp:PostBackTrigger ControlID="btnSave" />
</Triggers>--%>
</asp:UpdatePanel>
C# code for save button which is inside edit template:
protected void SupplierPackageDetails_ItemCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName == "Save")
{
GridEditableItem editedItem = (GridEditableItem)((e.CommandSource) as Button).NamingContainer;
TextBox txtComment = (TextBox)editedItem.FindControl("txtCommentsforSupplier");
DropDownList ddlStatus = (DropDownList)editedItem.FindControl("ddlSupplierStatus");
string strComment = txtComment.Text;
string strPerformanceStepId = editedItem["PerformanceStepId"].Text;
string strSelectedStatus = ddlStatus.SelectedValue; //SelectedValue
string LineitemID = editedItem.GetDataKeyValue("LineItemId").ToString();
string OrderPackageLineItemId = editedItem.GetDataKeyValue("OrderPackageLineItemId").ToString();
List<PackageLineItem> objListofPackagesInOrder = (List<PackageLineItem>)ViewState["dsPackagesInOrder"];
orderDetails = (OrderInfo)ViewState["Orderdetails"];
if (objListofPackagesInOrder != null)
{
PerformanceStepLineItem performanceStepsLineItemTemp = objListofPackagesInOrder.FirstOrDefault(x => x.LineItemId == OrderPackageLineItemId).PerformanceStepInOrder.FirstOrDefault(y => y.LineItemId == LineitemID);
//if(nullorempty check) for 1709
if (!string.IsNullOrEmpty(strComment))
{
performanceStepsLineItemTemp.SupplierStatusDescription = strComment;
}
else { performanceStepsLineItemTemp.SupplierStatusDescription = ddlStatus.SelectedItem.Text; }
orderDetails.LoggedInUser = this.loggedInUser;
OrderService.HandleOrderRowItemEvent(orderDetails, PerformanceStepsEvent(strSelectedStatus), connection, performanceStepsLineItemTemp);
LoadData(true);
SupplierPackageDetails.MasterTableView.ClearEditItems();
//int countmain = SupplierPackageDetails.MasterTableView.Items.Count;
//for (int j = 0; j < countmain; j++)
//{
// int count = SupplierPackageDetails.MasterTableView.Items[j].ChildItem.NestedTableViews[0].Items.Count;
// for (int i = 0; i < count; i++)
// {
// SupplierPackageDetails.MasterTableView.Items[j].ChildItem.NestedTableViews[0].Items[i].Expanded = true;
// }
//}
}
}
}
I use radscheduler inside a window that can be resized by the user.
I want that the radscheduler use the maximum size possible for each columns but when resized the width of columns shoul not be minor that 100px. (i.e. columnssize NOT < 100px).
Thanks
We're returning a datatable with which to create a line chart. The chart binds fine but we can't figure out how to dynamically create the individual series. These are database driven and can change over time so we don't want to hard code each series into the chart. Is there a way to take data from a bound datatable like the following and have the chart generate correctly?
Value Date User
3 2016-11-21 John
5 2016-11-23 John
1 2016-11-21 Mary
1 2016-11-23 Mary
3 2016-11-21 Tom
2 2016-11-23 Tom
The end result should be a line chart with three lines: one for John, one for Mary, one for Tom. The x-axis would be the dates and the y-axis would be the value. As mentioned, the User Names can change over time in the database so we don't want to hard code them into the chart lineseries if that can be avoided. Is there a way to have the lineseries generate automatically from the datatable that is being bound to the chart?
thanks,
Jeff
Dear all,
I implement function which open the list after click in the control:
var
$ = $telerik.$;
function
pageLoad() {
$(
".racTokenList"
).on(
"click"
,
function
(e) {
var
controlId =
this
.parentElement.id;
var
autoComplete = $find(controlId);
autoComplete.query(
" "
);
})
}
But there is a problem with "Show All Results" button. If I click on it, it gets the value from control which is empty nothing is shown. Is there any event when user invoke this function?
I don't want to put empty space in input field, because if user start typing then it will include the space.
Thank you for any ideas,
Petr
Hi, I'm using a ClientDataSource with a Grid to communicate with a webservice from client-side.
The webservice returns a custom response for any request: {"ErrorMessage":(error message or null),"IsSuccessful":(boolean),"Result":[(result of request)]}.
In the ClientDataSource I defined the schema as follows to check for server errors
<
Schema
DataName
=
"Result"
ResponseType
=
"JSON"
ErrorsName
=
"ErrorMessage"
>
<
Model
ID
=
"id"
>
</
Model
>
</
Schema
>
And this function to show the error:
function
dataSource_error(e) {
e.preventDefault();
console.log(
"Error"
, e);
serverNotification.set_title(
"Server Error"
);
serverNotification.set_text(e.errors);
serverNotification.update();
serverNotification.show();
}
My problem is that when I try to remove an item from the clientdatasource and I get a custom error,the item is still removed from the clientdatasource and the grid which is not an effect I'm looking for.
For the clientdatasource remove/destroy I'm using a function:
dataSource.transport.destroy =
function
(options) {
console.log(
"Options-destroy"
, options);
console.log(dataSource);
$.ajax({
url: (
"<%= WebApp.WebServiceHelper.BASE_WS_URL + WebApp.WebServiceHelper.WS_CLOSE %>"
),
dataType:
"json"
,
data: {
username: sessionStorage[
"username"
],
},
success:
function
(result) {
console.log(
"result-destroy:"
, result);
//if (result.IsSuccessful) {
options.success(result);
//} else {
// options.error(result);
//}
console.log(
"Options-destroy-success"
, options);
console.log(dataSource);
},
error:
function
(result) {
console.log(
"result1-destroy:"
, result);
options.error(result);
}
});
};
Before adding ErrorsName in the schema I was check the IsSuccessful on success and call options.error, in this case the clientDataSource remove the item but the grid did not rebind !
On the same topic is it possible to check if IsSuccessful is false instead of ErrorMessage is null to generate an error and get the error message from ErrorMessage?
In case of remove, the Result will be a boolean, can I also prevent the clientDataSource from removing an element if if Result is false?
I am adding a default initial filter from the code-behind, but I'm getting an error:
System.Web.Query.Dynamic.ParseException
<
telerik:RadGrid
ID
=
"RG_Lst_CS"
runat
=
"server"
DataSourceID
=
"LDS_SuiviCommande"
OnPreRender
=
"RG_Lst_CS_PreRender"
EnableLinqExpressions
=
"true"
EnableHeaderContextFilterMenu
=
"True"
EnableHeaderContextMenu
=
"True"
AllowFilteringByColumn
=
"True"
AllowPaging
=
"True"
AllowSorting
=
"True"
>
<
MasterTableView
AutoGenerateColumns
=
"False"
>
<
Columns
>
<
telerik:GridDateTimeColumn
DataField
=
"CCE_DateReception"
HeaderText
=
"Date Reception"
SortExpression
=
"CCE_DateReception"
UniqueName
=
"CCE_DateReception"
EnableTimeIndependentFiltering
=
"true"
DataType
=
"System.DateTime"
DataFormatString
=
"{0:d}"
/>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
protected
void
RG_Lst_CS_PreRender(
object
sender, EventArgs e)
{
if
(!Page.IsPostBack)
{
var DefaultDateInterval = DateTime.Today.AddDays(
(DayOfWeek.Monday - DateTime.Today.DayOfWeek) - 14);
RG_Lst_CS.MasterTableView.FilterExpression =
"([CCE_DateReception] >= DateTime.Parse(\""
+ DefaultDateInterval +
"\")) "
;
GridColumn column = RG_Lst_CS.MasterTableView.GetColumnSafe(
"CCE_DateReception"
);
column.CurrentFilterFunction = GridKnownFunction.GreaterThanOrEqualTo;
column.CurrentFilterValue = DefaultDateInterval.ToString();
RG_Lst_CS.Rebind();
}
}
"([CCE_DateReception]>=DateTime.Parse(\""+DefaultDateInterval+"\")) "
Is based on Current filter expression when i use the Build-in grid filter.
But I also try:
"([CCE_DateReception] >= \"" + DefaultDateInterval + "\" ) "
The Error occure on RG_Lst_CS.Rebind() or RG_Lst_CS.MasterTableView.Rebind()
And EnableLinqExpressions="true" do not look to do the trick.
Hi
I use RadWizard and create 10 WizardStep, each step content 10 textbox and 10 Custom Validation.
I use client function to validate these textbox, like below , the code will help me to find which textbox are repeated.
My question is when step 2 textbox value and step 1 textbox value repeated, the validator fired. I wish each step just only have it validator, each step will not interference each other. How Can I do ?
<script type="text/javascript">
function validateTxt(sender, args) {
var txts = new Array();
args.IsValid = true;
txts = document.getElementsByTagName('input')
var valus = new Array();
for (i = 0; i < txts.length; i++) {
if (txts[i].type == 'text') {
if (isNaN(txts[i].value)) {
args.IsValid = false;
break;
} else {
for (j = 0; j < valus.length ; j++) {
if (valus[j] == txts[i].value.trim()) {
args.IsValid = false;
break;
}
}
if (txts[i].value.trim() != '') {
valus[valus.length] = txts[i].value.trim();
}
}
}
if (args.IsValid == false) {
break;
}
}
}
</script>
part of server side code
protected void Page_Load(object sender, EventArgs e)
{
NumberOfGroup = tas.Get_Group_Emp("7", "1").Rows.Count;
QuestionNumber = tas.Get_Question_By_Group("1", "1", "7").Rows.Count;
Question = tas.Get_Question_By_Group("1", "1", "7");
//重點是,每一個 RadWizardStep 要有自己的 ValidationGroup Name,WizardStep 底下的元素的 Validation Group 名稱要與上層相同
if (!Page.IsPostBack)
{
RadWizard wizard = new RadWizard() { ID = "Wizard1", Skin = "Sunset" ,EnableAjaxSkinRendering=true, RenderMode=RenderMode.Mobile };
wizard.Culture = new System.Globalization.CultureInfo("zh-TW");
wizard.Localization.Next = "下一題";
wizard.Localization.Previous = "上一題";
wizard.Localization.Finish = "完成";
wizard.WizardStepCreated += RadWizard1_WizardStepCreated;
wizard.FinishButtonClick += Wizard_FinishButtonClick;
RadWizardStep startStep = new RadWizardStep() { ID = "startStep", StepType = RadWizardStepType.Start, Title="評量開始" };
string term1 = "正向思考且有生產力的員工能讓公司充滿幹勁。<br/>個人、團隊及經理的定期績效評估 – 可讓您及時瞭解公司主幹健全與否。<br/> 由人力資源部 進行的員工調查問卷,可讓管理階層蒐集提升業務最需要的意見反應。<br/> 焦點員工評核可讓管理階層及其工作小組,展開關於職涯發展與目標的深度對話。<br/>";
startStep.Controls.Add(new Literal() { Text = "<div id='term1' class='EULA'>"+term1+"</div>" });
wizard.WizardSteps.Add(startStep);
// 依據 QuestionNumber 來決定迴圈大小,一個步驟一題
for (int i = 0; i < QuestionNumber; i++)
{
//這邊長題目
RadWizardStep step = new RadWizardStep() { ID = "step" + (i + 1).ToString(), Title = "問題" + (i + 1).ToString(), ToolTip = "問題" + (i + 1).ToString(), CausesValidation = true, ValidationGroup = "group" + (i + 1).ToString(), StepType = RadWizardStepType.Step };
step.Controls.Add(new Literal() { Text = "<div id='question' style='margin:0 auto;font-family: 'cwTeXFangSong', serif;'>" });
step.Controls.Add(QuestionLabel=new RadLabel() { });
step.Controls.Add(new Literal() { Text = "</div>" });
//這邊長照片 依據 Group 人數
step.Controls.Add(new Literal() { Text = "<div style='margin:0 auto; position: relative; width: 950px ;text-align:center;border:1px solid red;'>" });
for (int j = 0; j < NumberOfGroup; j++)
{
step.Controls.Add(new Literal() { Text= "<div class='HeadPicture'>" });
RadBinaryImage image = new RadBinaryImage() { ID = "RadImage" + (i + 1).ToString() + (j + 1).ToString(), ImageUrl = "/img/2_"+(j+1).ToString()+".png", CssClass = "ImageCSS" , ToolTip="Your Name..User "+(j+1).ToString()};
step.Controls.Add(image);
//TextBox textbox = new TextBox() { ID = "TextBox" + (i + 1).ToString() + (j + 1).ToString(), ValidationGroup = "group" + (i + 1).ToString(), CssClass = "TextBoxCSS" };
//step.Controls.Add(textbox);
RadNumericTextBox RadNumbericText = new RadNumericTextBox() { ID = "RadNumericText" + (i + 1).ToString() + (j + 1).ToString(), ValidationGroup = "group" + (i + 1).ToString(), ShowSpinButtons = true, ButtonsPosition = InputButtonsPosition.Left, MaxValue = NumberOfGroup, MinValue = 1, Type = NumericType.Number, CssClass = "TextBoxCSS", RenderMode = RenderMode.Classic };
RadNumbericText.NumberFormat.DecimalDigits = 0;
RadNumbericText.IncrementSettings.InterceptArrowKeys = true;
RadNumbericText.IncrementSettings.InterceptMouseWheel = true;
RadNumbericText.IncrementSettings.Step = 1;
RadNumbericText.ForeColor = System.Drawing.Color.DarkGreen;
RadNumbericText.Font.Bold = true;
step.Controls.Add(RadNumbericText);
//RequiredFieldValidator ReqValidator = new RequiredFieldValidator() { ID = "validator" + (i + 1).ToString() + (j + 1).ToString(), ValidationGroup = "group" + (i + 1).ToString(), ControlToValidate = RadNumbericText.ID, ErrorMessage = "*", ForeColor = System.Drawing.Color.Red, EnableClientScript = true };
//step.Controls.Add(ReqValidator);
CustomValidator cValidator = new CustomValidator() { ID = "cValidator" + (i + 1).ToString() + (j + 1).ToString(), ValidationGroup = "group" + (i + 1).ToString(), ClientValidationFunction = "validateTxt",Display=ValidatorDisplay.Dynamic, ErrorMessage = "*", ValidateEmptyText = true, ForeColor = System.Drawing.Color.BlueViolet, EnableClientScript = true };
// ValidationSummary vSummary = new ValidationSummary() { ID = "vSummary" + (i + 1).ToString()+(j+1).ToString(), ValidationGroup = "group" + (i + 1).ToString(), ShowMessageBox = true, DisplayMode = ValidationSummaryDisplayMode.List };
step.Controls.Add(cValidator);
// step.Controls.Add(vSummary);
// //剩下換頁換步驟時,CustomValidator 必須重新綁定的問題,不然前後頁的值會互相比對,只希望比單頁的就好
step.Controls.Add(new Literal() { Text="</div>" });
}
step.Controls.Add(new Literal() { Text = "</div></br>" });
wizard.Controls.Add(step);
}
RadWizardStep finalStep = new RadWizardStep() { ID = "finalStep", StepType = RadWizardStepType.Finish, Title="評量結束" };
string term2 = "謝謝你的參與";
finalStep.Controls.Add(new Literal() { Text = "<div id='term1' class='EULA'>" + term2 + "</div>" });
wizard.WizardSteps.Add(finalStep);
this.Form.Controls.Add(wizard);
}
}
private void Wizard_ActiveStepChanged(object sender, EventArgs e)
{
}
private void Wizard_FinishButtonClick(object sender, WizardEventArgs e)
{
// 關閉瀏覽器...
Response.Write("<script language='javascript'>window.open('', '_self', ''); window.close();</script>");
}
protected void RadWizard1_WizardStepCreated(object sender, WizardStepCreatedEventArgs e)
{
// 這裡載入題目
if (!(e.RadWizardStep.ID == "startStep" || e.RadWizardStep.ID == "finalStep"))
{
//RadLabel QuestionLabel = new RadLabel();
QuestionLabel.Text = Question.Rows[Convert.ToInt32(e.RadWizardStep.Index-1)]["Question"].ToString() + "(1 ~ " + NumberOfGroup +" 分)";
QuestionLabel.CssClass = "LabelFont";
}
}
I have a button inside RadAjaxPanel and i want to export it to the Excel Sheet, Below is the code i had written to do this task. If i removed the RadAjaxpanel then i can export the datatable into excel sheet. But when trying to export it to Excel using radajax panel, I'm getting this error: Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed."
<
telerik:RadAjaxPanel
ID
=
"mainPanel"
runat
=
"server"
LoadingPanelID
=
"RadAjaxLoadingPanel"
>
<
table
class
=
"reportSearch"
>
<
tr
>
<
td
>
<
telerik:RadButton
ID
=
"btnExcelDetail"
runat
=
"server"
Text
=
"Excel"
OnClick
=
"btnExcelDetail_Click"
ValidationGroup
=
"SearchValidation"
ClientEvents-OnRequestStart
=
"requestStart"
>
<
Icon
PrimaryIconUrl
=
"~/App_Themes/RnDThemes/images/insert_table_on.gif"
PrimaryIconHeight
=
"15"
/>
</
telerik:RadButton
>
</
td
>
<
td
>
</
table
>
</
telerik:RadAjaxPanel
>
<
script
type
=
"text/javascript"
>
function requestStart(sender, args) {
if (args.get_eventTarget().indexOf("btnExcelDetail") >= 0)
args.set_enableAjax(false);
}
</
script
>
public
void
ExporttoExcel(DataTable table,
string
filename)
{
try
{
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.ClearHeaders();
HttpContext.Current.Response.Buffer =
true
;
HttpContext.Current.Response.ContentType =
"application/ms-excel"
;
HttpContext.Current.Response.Write(@
"<!DOCTYPE HTML PUBLIC "
"-//W3C//DTD HTML 4.0 Transitional//EN"
">"
);
HttpContext.Current.Response.AddHeader(
"Content-Disposition"
,
"attachment;filename="
+ filename +
""
);
HttpContext.Current.Response.Charset =
"utf-8"
;
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding(
"windows-1250"
);
HttpContext.Current.Response.Write(
"<TABLE border='1' bgColor='#ffffff' "
+
"borderColor='#000000' cellSpacing='0' cellPadding='0' "
+
"style='font-size:10.0pt;background:white;'><TR>"
);
int
columnscount = table.Columns.Count;
for
(
int
j = 0; j < columnscount; j++)
{
HttpContext.Current.Response.Write(@
"<TD><B>"
+ table.Columns[j].ToString() +
"</B></TD>"
);
}
HttpContext.Current.Response.Write(
"</TR>"
);
foreach
(DataRow row
in
table.Rows)
{
HttpContext.Current.Response.Write(
"<TR>"
);
for
(
int
i = 0; i < table.Columns.Count; i++)
{
if
(row[i].ToString().Trim().Length > 1 && row[i].ToString().Trim().StartsWith(
"0"
) && row[i].GetType().Name==
"String"
)
HttpContext.Current.Response.Write(
"<TD style=\"mso-number-format:\\@\">"
);
else
HttpContext.Current.Response.Write(
"<TD>"
);
HttpContext.Current.Response.Write(row[i].ToString());
HttpContext.Current.Response.Write(
"</TD>"
);
}
HttpContext.Current.Response.Write(
"</TR>"
);
}
HttpContext.Current.Response.Write(
"</TABLE>"
);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.SuppressContent =
true
;
HttpContext.Current.ApplicationInstance.CompleteRequest();
}
catch
(Exception) { }
Hi, everyone,
As far as I know, RadEditor doesn't have a page break functionality when HTML is exporting to DOCX. I've found a solution for this:
DocxFormatProvider provider = new DocxFormatProvider();
HtmlFormatProvider htmlProvider = new HtmlFormatProvider();
List<string> result = this.PrepareStringToExport(htmlPage); //result is a list with divided "pages"
RadFlowDocument newDoc = new RadFlowDocument();
RadFlowDocumentEditor newEditor = new RadFlowDocumentEditor(newDoc);
RadFlowDocument document;
foreach(string element in result)
{
document = new RadFlowDocument();
document = htmlProvider.Import(element);
newEditor.InsertDocument(document);
newEditor.InsertBreak(BreakType.PageBreak);
}
byte[] byteArray = provider.Export(newEditor.Document);
string fileName = "filename.docx";
Utils.SendBytesAsFileToClientWithAjax(Response, fileName, byteArray);
If there is a cleaner solution, let me know
Best regards
Marcin
Hello,
I have an OrgChart and a couple of labels and an image that I want to export to PDF using the RadClientExportManager.
Code .aspx:
table id="exporttopdf">
<
tr
>
<
td
>
<
asp:image
runat
=
"server"
imageurl
=
"~/styles/images/logo.png"
/>
<
asp:panel
runat
=
"server"
id
=
"Panel1"
visible
=
"false"
>
<
span
class
=
"content"
>
GRUPP: <
asp:Label
runat
=
"server"
ID
=
"Label1"
></
asp:Label
><
br
/>
DATUM: <
asp:Label
runat
=
"server"
ID
=
"Label2"
></
asp:Label
>
</
span
>
</
asp:panel
>
</
td
>
</
tr
>
<
tr
>
<
td
>
<
telerik:RadOrgChart
ID
=
"RadOrgChart2"
runat
=
"server"
GroupColumnCount
=
"1"
DisableDefaultImage
=
"true"
>
<
GroupEnabledBinding
>
<
NodeBindingSettings
DataFieldID
=
"ID"
DataFieldParentID
=
"ParentID"
/>
<
GroupItemBindingSettings
DataFieldNodeID
=
"NodeID"
DataFieldID
=
"ID"
DataTextField
=
"Text"
/>
</
GroupEnabledBinding
>
</
telerik:RadOrgChart
>
</
td
>
</
tr
>
</
table
>
However my swedish special characters doesn't show properly in the PDF.
I've been using this demo http://docs.telerik.com/devtools/aspnet-ajax/controls/clientexportmanager/how-to/exporting-special-characters
and it works as expected.
What do I need to do to get it to work with the orgChart?
Any suggestions appreciated
Regards
Janne