
| <tel:RadComboBox ID="ChooseCustomer" runat="server" Width="200" DropDownWidth="300" EmptyMessage="Type a customer name" AllowCustomText="true" MarkFirstMatch="true" > |
| <CollapseAnimation Duration="50" /> |
| <ExpandAnimation Duration="50" /> |
| </tel:RadComboBox> |
| IList<Customer> all = EntityPersister.GetAll<Customer>(); |
| ChooseCustomer.DataSource = all; |
| ChooseCustomer.DataTextField = "CustomerName"; |
| ChooseCustomer.DataValueField = "ID"; |
| ChooseCustomer.DataBind(); |
var
tableView = $find("<%= MedicationGrid.ClientID %>").get_masterTableView();
tableView.set_dataSource(result);
tableView.dataBind();
var grid = $find("<%= MedicationGrid.ClientID %>");
grid.repaint();
When I am debugging, I am able to see the newly added record in the result object, But it is not displaying the newly added row in the grid.In place it is displaying a blank row.When I am clicking on edit button on any of the gridrow it is displaying the record in the grid as I have stored the data in the session.
Am I doing anything wrong ?
Regards,
Arabinda
Hello,
I have a Radeditor which is used to edit HTML Newsletter templates. I have a button on whose click event i have to save the template in database(So later i could mail those templates), also i have to convert the html content to PDF format. I tried the below Pasted code, but the PDF i obtained is showing out to be blank.
Please refer the following code snippet:
ASPX Page:
| <%@ Page Language="C#" AutoEventWireup="true" CodeFile="CreateNewsletter.aspx.cs" Inherits="_Default" %> |
| <%@ 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"> |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| <title>Template 2 - Left Sidebar</title> |
| <link href="CSS/screen.css" rel="stylesheet" type="text/css" /> |
| </head> |
| <body> |
| <form id="form1" runat="server" style="height: 100%"> |
| <telerik:RadScriptManager ID="RadScriptManager1" Runat="server"> |
| </telerik:RadScriptManager> |
| <telerik:RadEditor ID="Template_content" runat="server" Height="600px" |
| Width="100%" ContentFilters="MakeUrlsAbsolute" OnExportContent="Template_content_ExportContent"> |
| <MediaManager ViewPaths="~/PDF/" UploadPaths="~/PDF/" /> |
| <ExportSettings OpenInNewWindow="true"></ExportSettings> |
| <Content> |
| <table style="background-color: #99cc00;" cellspacing="0" cellpadding="10" width="100%"> |
| <tbody> |
| <tr> |
| <td valign="top" align="center"> |
| <table cellspacing="0" cellpadding="0" width="600"> |
| <tbody> |
| <tr> |
| <td style="border-top: #000000 0px solid; border-bottom: #ffffff 1px solid; background-color: #ffcc66; text-align: center;" align="center"><span style="font-size: 10px; color: #996600; line-height: 200%; font-family: verdana; text-decoration: none;">Email not displaying correctly? <a href="*|ARCHIVE|*" style="font-size: 10px; color: #996600; line-height: 200%; font-family: verdana; text-decoration: none;">View it in your browser.</a></span></td> |
| </tr> |
| <tr> |
| <td style="border-top: #333333 0px solid; border-bottom: #ffffff 10px solid; background-color: #ffffff;" valign="middle" align="left"><center><a href=""><img id="editableImg1" title="Your Company" style="border: 0px solid; " alt="Your Company" src="img/logo_2column.jpg" /></a></center></td> |
| </tr> |
| </tbody> |
| </table> |
| <table style="background-color: #ffffff;" cellspacing="0" cellpadding="20" width="600"> |
| <tbody> |
| <tr> |
| <td style="border-right: #cccccc 1px dashed; width: 200px; background-color: #ffffff; text-align: left;" valign="top"><span style="font-weight: normal; font-size: 11px; color: #999999; line-height: 150%; font-family: arial;"><span style="font-weight: bold; font-size: 15px; color: #333333; line-height: 150%; font-family: arial;">Grooming Tips:</span><br /> |
| Tick picking novice? Lorem ipsum dolor sit amet, <a href="#">consectetuer adipiscing elit</a>. Sed at erat. Phasellus condimentum. Nullam sed magna. Donec quis tellus in neque congue porttitor. Proin sit amet ligula id leo porta rutrum. <br /> |
| <br /> |
| <span style="font-weight: bold; font-size: 15px; color: #333333; line-height: 150%; font-family: arial;">Waterhole Dangers</span><br /> |
| Watery oasis, or crocodilian cesspool from hell? As the dry season approaches, lorem ipsum dolor sit amet, <a href="#">consectetuer adipiscing elit</a>. Sed at erat. Phasellus condimentum. Nullam sed magna. Donec quis tellus in neque congue porttitor. Proin sit amet ligula id leo porta rutrum. </span></td> |
| <td style="font-size: 12px; width: 400px; color: #000000; line-height: 150%; font-family: trebuchet ms; background-color: #ffffff;" valign="top"> |
| <p><span style="font-weight: bold; font-size: 20px; color: #cc6600; line-height: 110%; font-family: arial;">Why Are Tigers So Mean?</span><br /> |
| <span style="font-weight: normal; font-size: 11px; color: #666666; font-style: italic; font-family: arial;">by Frederick Von Chimpenheimer</span><br /> |
| Recent psychological studies and brain scans have shown that tigers have naturally violent tendencies toward chimpanzees. "There's sort of a banana-envy thing going on, which makes the average tiger very self-conscious around chimpanzees" says Dr. Chimpfried Brown. Lorem ipsum dolor sit amet, <a href="#">consectetuer adipiscing elit</a>. Sed at erat. Phasellus condimentum. Nullam sed magna. Donec quis tellus in neque congue porttitor. Proin sit amet ligula id leo porta rutrum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In suscipit, pede a rutrum malesuada, lacus massa euismod neque, a hendrerit justo ante at eros. <a href="#">Clickitus heritus.</a> </p> |
| <p><span style="font-weight: bold; font-size: 20px; color: #cc6600; line-height: 110%; font-family: arial;">Plantains vs. Bananas</span><br /> |
| <span style="font-weight: normal; font-size: 11px; color: #666666; font-style: italic; font-family: arial;">by Francine Chimperson</span><br /> |
| Throwing a party? There's no better way to anger your dinner guests than by accidentally serving them plantains instead of bananas. Avoid the poo flinging with these handy guidelines. Plantains look like over ripe bananas, and must be cooked before eaten. Bananas are softer, and don't cook very well (they get mushy). In suscipit, pede a rutrum malesuada, lacus massa euismod neque <a href="#">Clickitus heritus.</a> </p> |
| </td> |
| </tr> |
| <tr> |
| <td style="border-top: #ffffff 10px solid; background-color: #ffffcc;" valign="top" colspan="2"><span style="font-size: 10px; color: #996600; line-height: 100%; font-family: verdana;">*|LIST:DESCRIPTION|* <br /> |
| <br /> |
| <a href="*|UNSUB|*">Unsubscribe</a> *|EMAIL|* from this list.<br /> |
| <br /> |
| Our mailing address is:<br /> |
| *|LIST:ADDRESS|*<br /> |
| <br /> |
| Our telephone:<br /> |
| *|LIST:PHONE|*<br /> |
| <br /> |
| Copyright (C) 2007 *|LIST:COMPANY|* All rights reserved.<br /> |
| <br /> |
| <a href="*|FORWARD|*">Forward</a> this email to a friend </span></td> |
| </tr> |
| </tbody> |
| </table> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </Content> |
| <ImageManager ViewPaths="~/img" UploadPaths="~/img" MaxUploadFileSize="1024000" /> |
| </telerik:RadEditor> |
| <asp:Button ID="btn_createNewsletter" runat="server" Text="Save" |
| onclick="btn_createNewsletter_Click" /> |
| </form> |
| </body> |
| </html> |
| using System; |
| using System.Configuration; |
| using System.Data; |
| using System.Linq; |
| using System.Web; |
| using System.Web.Security; |
| using System.Web.UI; |
| using System.Web.UI.HtmlControls; |
| using System.Web.UI.WebControls; |
| using System.Web.UI.WebControls.WebParts; |
| using System.Xml.Linq; |
| using System.Data.SqlClient; |
| using System.Web.Configuration; |
| using Telerik.Web.UI; |
| using System.IO; |
| public partial class _Default : System.Web.UI.Page |
| { |
| string connectionString = WebConfigurationManager.ConnectionStrings["ConnectionString2"].ConnectionString; |
| string url, path = ""; |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| url = String.Format("~/PDF/{0}.pdf", Template_content.ExportSettings.FileName); |
| path = Server.MapPath(url); |
| } |
| protected void btn_createNewsletter_Click(object sender, EventArgs e) |
| { |
| string str = Template_content.Content; |
| str = str.Replace("'","''"); |
| DateTime dt = new DateTime(); |
| string InsertSQL = "Insert Into Newsletter(Template,CreatedDate,NewsLetterName) Values ('" + str + "',@CreatedDate,'Template8') "; |
| SqlConnection conn = new SqlConnection(connectionString); |
| SqlCommand cmd = new SqlCommand(InsertSQL, conn); |
| cmd.Parameters.AddWithValue("@CreatedDate", DateTime.Now.Date); |
| conn.Open(); |
| try |
| { |
| cmd.ExecuteNonQuery(); |
| conn.Close(); |
| //Template_content.ExportSettings.FileName = "MyPDFChinmay"; |
| Template_content.ExportToPdf(); |
| } |
| catch(Exception err) |
| { |
| conn.Close(); |
| } |
| } |
| protected void Template_content_ExportContent(object sender, Telerik.Web.UI.EditorExportingArgs e) |
| { |
| if (File.Exists(path)) |
| { |
| File.Delete(path); |
| } |
| using (FileStream fs = File.Create(path)) |
| { |
| Byte[] info = System.Text.Encoding.Default.GetBytes(e.ExportOutput); |
| fs.Write(info, 0, info.Length); |
| } |
| Response.Redirect("Newsletter.aspx"); |
| } |
| } |
Please provide the workaround that solves my problem.
Regards,
Vipin Ajmera.