Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
160 views
Hi
i use radGrid with GridTemplateColumn, which hold link buttons for doing many action, but when i try to sort any column, and then click at any of these buttons, the grid forget the sort order,
here is my grid
<telerik:RadGrid ID="grdNewContent" runat="server" AllowPaging="True" AllowSorting="True"
                        CssClass="listItems" AutoGenerateColumns="False" GridLines="None" AutoGenerateEditColumn="false"
                        Skin="SitefinityItems" EnableEmbeddedSkins="false" PageSize="50" AllowMultiRowSelection="true"
                        AllowFilteringByColumn="false">
                        <PagerStyle AlwaysVisible="true" Mode="NumericPages" />
                        <ClientSettings>
                            <Selecting AllowRowSelect="true" />
                        </ClientSettings>
                        <MasterTableView>
                            <RowIndicatorColumn Visible="false">
                            </RowIndicatorColumn>
                            <ExpandCollapseColumn Resizable="false" Visible="false">
                            </ExpandCollapseColumn>
                            <Columns>
                                <telerik:GridClientSelectColumn ItemStyle-CssClass="gridActions">
                                </telerik:GridClientSelectColumn>
                                <telerik:GridTemplateColumn UniqueName="Action" HeaderText="<%$Resources:Action %>"
                                    ItemStyle-CssClass="gridActions edit" Reorderable="true">
                                    <ItemTemplate>
                                        <asp:LinkButton ID="btnPublish" Text="<%$Resources:Publish %>" runat="server" CommandName="Publish"
                                            Visible="false" />
                                        <asp:LinkButton ID="btnEdit" Text="<%$Resources:Edit %>" runat="server" CommandArgument='<%#Eval("Id") %>'
                                            Visible="false" />
                                        <asp:LinkButton ID="btnReject" Text="<%$Resources:Reject %>" runat="server" CommandName="Reject"
                                            Visible="false" CommandArgument='<%#Eval("Id")%>' />
                                        <asp:LinkButton ID="btnRestore" Text="<%$ Resources:Restore %>" runat="server" CommandArgument='<%#Eval("Id") %>'
                                            Visible="false" />
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridButtonColumn ConfirmText="<%$ Resources:AreYouSure %>" CommandName="Delete"
                                    ItemStyle-CssClass="gridActions delete" HeaderText="<%$ Resources:Delete %>"
                                    ButtonType="LinkButton" UniqueName="Delete">
                                </telerik:GridButtonColumn>
                                <telerik:GridTemplateColumn HeaderText='<%$Resources:PostTitle %>' UniqueName="Title"
                                    SortExpression="Title" ItemStyle-CssClass="gridContentTitle">
                                    <ItemTemplate>
                                        <asp:LinkButton runat="server" ID="btnPreview" CommandArgument='<%# Eval("Id") %>'
                                            Text='<%# Eval("TruncatedTitle") %>'></asp:LinkButton>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridBoundColumn HeaderText="<%$Resources:Author %>" UniqueName="Author"
                                    SortExpression="AuthorName" DataField="Author">
                                    <FilterTemplate>
                                    </FilterTemplate>
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn HeaderText="<%$Resources:Created %>" UniqueName="Created"
                                    SortExpression="PostDate" DataField="PostDate" DataFormatString="<%$Resources:DateFormat %>">
                                </telerik:GridBoundColumn>
                                <telerik:GridTemplateColumn UniqueName="Status" SortExpression="StatusId" HeaderText="<%$Resources:Status %>">
                                    <ItemTemplate>
                                        <asp:Label ID="lblStatus" runat="server" Text='<%#Eval("Status.Title") %>'> </asp:Label>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                            </Columns>
                            <EditFormSettings>
                                <EditColumn UniqueName="EditCommandColumn1">
                                </EditColumn>
                            </EditFormSettings>
                        </MasterTableView>
                    </telerik:RadGrid>

can you help me at this issue,
than you in advance


Schlurk
Top achievements
Rank 2
 answered on 06 Aug 2009
1 answer
124 views
Hi,

I have a RadWindow in which I have radGrid with three radio buttons(CSV,Excel and PDF). I have two buttons SaveAs and Close. When the user selects any radio button(export type) and click on SaveAs, the user should be able to download the file and SaveAs  should be closed automatically. If the user clicks on Close without clicking on SaveAs, the window should close.

I am able to close radwindow when I click on close button. But, when I click on SaveAs, the file download is popping up and the RadWindow is not closing. Is there any issue with my code???

Default.aspx.cs

        protected void btnSaveAs_Click(object sender, EventArgs e)
        {
           if (Session["ReportPager"] != null)
            {
                reportPager = (ReportPager)Session["ReportPager"];
                SetExportSettings();
                DownloadData();
                lblCloseWindow.Text = StringHelper.GetRadWindowCloseScript();
            }
        }

        protected void btnClose_Click(object sender, EventArgs e)
        {
            lblCloseWindow.Text = StringHelper.GetRadWindowCloseScript();
        }

        private void DownloadData()
        {
            //CSV
            if (SelRadioButtonList1.SelectedItem.Text == SelRadioButtonList1.Items[0].Text)
                this.radGrid.MasterTableView.ExportToCSV();
            //Excel
            else if (SelRadioButtonList1.SelectedItem.Text == SelRadioButtonList1.Items[1].Text)
                this.radGrid.MasterTableView.ExportToExcel();
            //PDF
            else if (SelRadioButtonList1.SelectedItem.Text == SelRadioButtonList1.Items[2].Text)
                this.radGrid.MasterTableView.ExportToPdf();
        }

        private void SetExportSettings()
        {
            this.radGrid.ExportSettings.ExportOnlyData = true;
            this.radGrid.ExportSettings.IgnorePaging = true;
            this.radGrid.ExportSettings.OpenInNewWindow = true;
        }

         /// <summary>
        /// This function returns script which is used to close RadWindow at runtime.
        /// </summary>
        /// <returns></returns>
        private static string GetRadWindowCloseScript()
        {
            return @"
            <script type='text/javascript'>
                var oWindow = null;
                if (window.radWindow)
                    oWindow = window.radWindow;
                else if(window.frameElement.radWindow)
                    oWindow = window.frameElement.radWindow;
                var currentWindow = oWindow;
                currentWindow.Close();
            </script>";
        }
Fiko
Telerik team
 answered on 06 Aug 2009
1 answer
145 views
I'm using a RadComboBox with a definition like this:
<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> 

in the code behind:
During page load and ! postback... something like this:
IList<Customer> all = EntityPersister.GetAll<Customer>(); 
ChooseCustomer.DataSource = all
ChooseCustomer.DataTextField = "CustomerName"
ChooseCustomer.DataValueField = "ID"
ChooseCustomer.DataBind(); 

now... the problem comes when a CustomerName is a blank string.

in a subsequent postback, then SelectedIndex property is set to the first "Blank" databound item.  but the front end still says "Type a customer name" 

Obviously the user has not changed the drop down, but its still reporting erroneously that the selected index is chosen.

Thanks
Sean
Genady Sergeev
Telerik team
 answered on 06 Aug 2009
0 answers
149 views
Hi
I dont want to text wrap in the appointment just like this demo.If the appoint text is large its wraping to the next and next to next line so the appointments are overlapping. how can i avoid this?
http://demos.telerik.com/aspnet-ajax/scheduler/examples/outlook2007/defaultcs.aspx
Regards
Vairamuthu
vairam
Top achievements
Rank 1
 asked on 06 Aug 2009
1 answer
168 views
I have a table with a foreign key which is set via a RadComboBox control on an Edit Form Template.  All works well if a value is picked from the combo box, but it is possible for this field to be null.  To allow this, I have set up an item in the combo which has "unknown" as its text and a blank value property.  The lookup values via a datasource are appended to this in the standard manner.

However, despite Linq defining this field as being nullable, unless I pick a value from the combo box the RadGrid won't save it.  Unbinding the combo box (thus effectively ignoring the field) is fine - the new row is added without fuss, so the field can be null, it's just that a blank value field in the RadComboBox obviously doesn't equate to this at save time.

So my question is, what's the best way to handle lookups for foreign key fields where the foreign key can be null?  (I should add that the foreign key field is an Int32, in case that matters).

Thanks,
Peter
Veli
Telerik team
 answered on 06 Aug 2009
2 answers
94 views
I use Form decorator in a page. And there is also FileUpload in same page.
But in IE7 FileUpload is seen very badly, even FileUpload's textbox isn't seen.

Form decorator's DecoratedControls="Textbox, Buttons, Select"

In Firefox there is no problem.
What am I doing wrong ?

 

Murat Co
Top achievements
Rank 1
 answered on 06 Aug 2009
1 answer
102 views
I have a grid with template columns.I am trying to add new rows using the following client side code.

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

Yavor
Telerik team
 answered on 06 Aug 2009
1 answer
93 views
I'm using the Q1, 2009 distribution of the RadGrid.  I have a GridTemplateColumn that looks like so:

<radG:GridTemplateColumn UniqueName="Reg" HeaderText="Reg" AutoPostBackOnFilter="True" CurrentFilterFunction="Contains">
    <ItemStyle Width="60px" HorizontalAlign="Right" />
    <HeaderStyle Width="60px" />
    <ItemTemplate>
        <%# Eval("wk1_Regular", "{0:0.00}") %>
        <br />
        <%# Eval("wk2_Regular", "{0:0.00}")%>
    </ItemTemplate>
</radG:GridTemplateColumn>

What I want to occur is that when the user enters, say, 16 in to the filter text box, I want the grid be populated with rows where EITHER wk1_Regular OR wk2_Regular have the value 16.

No matter what I try, I cannot get filtering to work.  When I hit enter in the filter textbox, or click the Contains filter menu item, it initiates a call to the server, and fires the ItemCommand event, but the resultant data is never filtered.  Do you have an example of how this should be properly implemented?

Thanks.
Pavlina
Telerik team
 answered on 06 Aug 2009
1 answer
242 views

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? <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, <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, <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. &quot;There&apos;s sort of a banana-envy thing going on, which makes the average tiger very self-conscious around chimpanzees&quot; says Dr. Chimpfried Brown. Lorem ipsum dolor sit amet, <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. <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&apos;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&apos;t cook very well (they get mushy). In suscipit, pede a rutrum malesuada, lacus massa euismod neque <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 /> 
                                <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 /> 
                                <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> 
 


CS Page:
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.

Tervel
Telerik team
 answered on 06 Aug 2009
1 answer
94 views
Recently we've noticed that when a control is added to an Ajax panel weird things are sometimes happening to the layout of the page.  For example, if using the RadDatePicker control the calendar might appear beneath the date text box rather than directly to the right of it.  Buttons at the bottom of a form, instead of laying out from right to left, will appear stacked vertically.  What is the reason for this and how do I correct it?  I've played around with increasing the width of the RadAjaxLoadingPanel to allow sufficient space but it does not seem to solve the problem.

Thanks in advance.

Rich
Sebastian
Telerik team
 answered on 06 Aug 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?