Telerik Forums
UI for ASP.NET AJAX Forum
7 answers
205 views
I'm trying to extend the "XmlHttpPanel / Initiating content load client-side" example. I would like to have a few form fields and a RadEditor inside the XmlHttpPanel. Essential I would like very similar functionality to the "Use as container" RadWindow example with the additioon of a RadEditor and no window.

Unfortunately when placing the RadEditor inside the XmlHttpPanel the editor does not behave as expected. In IE the RadEditor toolbars disappear and the content is never updated. In FireFox the content is update.

Am I doing something wrong or is this just not possible? Or is there a better alternative solution?

ASPX

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ContentEditor.aspx.cs" Inherits="ContentEditor" %> 
 
<!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"
    <title></title> 
    <telerik:radscriptblock id="RadScriptBlock" runat="server"
    <script type="text/javascript"
         function rowSelected(sender, args) { 
             var key = args.getDataKeyValue("ContentId"); 
             var panel = $find("<%=RadXmlHttpPanel.ClientID%>"); 
             panel.set_value(key); 
         } 
    </script> 
    </telerik:radscriptblock> 
</head> 
<body> 
    <form id="form1" runat="server"
    <div> 
        <asp:scriptmanager id="ScriptManager" runat="server" /> 
        <div style="margin-bottom: 10px;"
            <label style="font-family:'segoe ui', arial, sans-serif;font-size:13px;">Group:</label> 
            <telerik:radcombobox id="ContentGroupRadComboBox" runat="server" datasourceid="ContentGroupDataSource" datatextfield="ContentGroupName" datavaluefield="ContentGroupId" appenddatabounditems="true" autopostback="true" width="210" > 
                <items> 
                    <telerik:radcomboboxitem text="All" value="0" selected="true" /> 
                </items> 
            </telerik:radcombobox> 
        </div> 
        <telerik:radgrid id="ContentRadGrid" runat="server" datasourceid="ContentDataSource" allowpaging="true" autogeneratecolumns="false" width="250px" style="overflow:hidden"
            <mastertableview clientdatakeynames="ContentId"
                <columns> 
                    <telerik:gridboundcolumn uniquename="ContentName" datafield="ContentName" headertext="Name" itemstyle-wrap="false" /> 
                </columns> 
            </mastertableview> 
            <clientsettings enablerowhoverstyle="true" selecting-allowrowselect="true"
                <clientevents onrowselected="rowSelected" ondatabound="" /> 
            </clientsettings> 
            <pagerstyle mode="NumericPages" showpagertext="false" /> 
        </telerik:radgrid> 
        <telerik:radajaxmanager id="RadAjaxManager" runat="server" enableajax="true" defaultloadingpanelid="RadAjaxLoadingPanel"
            <ajaxsettings> 
                <telerik:ajaxsetting ajaxcontrolid="ContentGroupRadComboBox"
                    <updatedcontrols> 
                        <telerik:ajaxupdatedcontrol controlid="ContentRadGrid" loadingpanelid="RadAjaxLoadingPanel" /> 
                        <telerik:ajaxupdatedcontrol controlid="ContentGroupRadComoboBox" /> 
                    </updatedcontrols> 
                </telerik:ajaxsetting> 
            </ajaxsettings> 
        </telerik:radajaxmanager> 
        <div style="margin-top: 25px;border: dashed 2px red;"
            <telerik:radxmlhttppanel id="RadXmlHttpPanel" runat="server" onservicerequest="RadXmlHttpPanel_ServiceRequest"
                <asp:label id="selectContentLabel" runat="server" text="Select a content item." /> 
                <asp:label id="selectedContentIdLabel" runat="server" /> 
                <telerik:radeditor id="RadEditor" runat="server" /> 
            </telerik:radxmlhttppanel> 
        </div> 
        <telerik:radajaxloadingpanel id="RadAjaxLoadingPanel" runat="server" /> 
        <asp:sqldatasource id="ContentGroupDataSource" runat="server" connectionstring="<%$ ConnectionStrings:InternationalConnectionString %>" selectcommand="SELECT [ContentGroupId], [ContentGroupName] FROM [IS].[ContentGroupInfo] WITH (NOLOCK) WHERE [StoreId] = '49D4B1F4-236B-DE11-870E-001A6465230E' AND [CultureId] = 1033" /> 
        <asp:sqldatasource id="ContentDataSource" runat="server" connectionstring="<%$ ConnectionStrings:InternationalConnectionString %>" /> 
    </div> 
    </form> 
</body> 
</html> 

Codebehind

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using Telerik.Web.UI; 
 
public partial class ContentEditor : System.Web.UI.Page 
    protected void Page_Init(Object sender, EventArgs e) 
    { 
 
    } 
 
    protected void Page_Load(object sender, EventArgs e) 
    { 
        if (ContentGroupRadComboBox.SelectedValue == "0"
        { 
            ContentDataSource.SelectCommand = "SELECT [CI].[ContentGroupId], [CI].[ContentGroupName], [CI].[ContentId], [CI].[ContentName] FROM [IS].[ContentInfo] AS [CI] WITH (NOLOCK) WHERE [CI].[StoreId] = '49D4B1F4-236B-DE11-870E-001A6465230E' AND [CI].[CultureId] = 1033"
            ContentRadGrid.DataBind(); 
        } 
        else 
        { 
            ContentDataSource.SelectCommand = "SELECT [CI].[ContentGroupId], [CI].[ContentGroupName], [CI].[ContentId], [CI].[ContentName] FROM [IS].[ContentInfo] AS [CI] WITH (NOLOCK) WHERE [CI].[StoreId] = '49D4B1F4-236B-DE11-870E-001A6465230E' AND [CI].[ContentGroupId] = '" + ContentGroupRadComboBox.SelectedValue + "' AND [CI].[CultureId] = 1033"
            ContentRadGrid.DataBind(); 
        } 
 
    } 
 
    protected void RadXmlHttpPanel_ServiceRequest(Object sender, RadXmlHttpPanelEventArgs e) 
    { 
        String selectedContentId = e.Value; 
        selectedContentIdLabel.Text = selectedContentId; 
        selectContentLabel.Visible = false
        RadEditor.Content = selectedContentId; 
    } 
 

Pero
Telerik team
 answered on 23 Dec 2009
2 answers
185 views
hi

I have this code:

  <telerik:RadMaskedTextBox ID="DOBTextBox"  Text='<%# Bind("DOB") %>'  runat="server" Mask="##/##/####">
                </telerik:RadMaskedTextBox> &nbsp; day/month/year

But when i looked at the stored value in the DB, it show 23122009. How can i capture 23/12/2009 format in the DB?

I am using Nvarchar(20) for my DOB field. thanks
Shinu
Top achievements
Rank 2
 answered on 23 Dec 2009
3 answers
74 views
Hi all,

With Firefox 3.0.16 recent update, I have found a strange issue using RadDatepicker. When typing "020202" in the dateinput and then press tab to exit the input, with Firefox 3.0.16 the input "020202" is not parsed and is not replaced with the desired string : "2/2/2002". The behavior can be seen on Telerik demo site here. This scenario works with IE and FF 3.5.6. If anybody has a workaround for this, it will be greatly appreciated.

Bye,

Morgan
Pavel
Telerik team
 answered on 23 Dec 2009
3 answers
389 views

I have a grid with client-side row selection turned on. After selecting a row, I want to click a button to access the row and the various individual fields in that row. How can do I do this in JavaScript? Basically, I want something like the following where I can access a column by name or index, but I don't have the syntax figured out, so it crashes...


                var grid = $find("<%= RadGrid1.ClientID %>");  
                var masterTable = grid.get_masterTableView();  
                var row = masterTable.SelectedRow;
                var colid = row.Column["SupplierID"];  // access by name
                alert(colid);  
                var col3 = row.Column[2];  // access by index
                alert(col3);  
Princy
Top achievements
Rank 2
 answered on 23 Dec 2009
1 answer
188 views
After I save the content in radeditor, I run the report and export the report to the PDF file.  Here is what I got the content from the PDF file:

<P><FONT style="BACKGROUND-COLOR: #ff0000">test test
test</FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; test</P>


Is there some kind convertor I need to use before it is exported to pdf?
I also attach the a picture file. Please let me know how to solve this issue.

thanks
Kevin
Rumen
Telerik team
 answered on 23 Dec 2009
1 answer
298 views
Is it possible to utilize GridCheckBoxColumn if the underlying datafield value stores string Y and N instead of 1 and 0?
I would like to display a read only version of the checkbox that is still legible.   If I use the template to set it to Enabled="false", it's very light.  (and the GridTemplateColumn's ReadOnly property doesn't work)

                    <telerik:GridTemplateColumn UniqueName="emailprimaryuser" HeaderText="Email Primary User"  
                        ReadOnly="true" DataField="emailprimaryuser" SortExpression="emailprimaryuser"
                        <ItemTemplate>  
                            <asp:CheckBox Enabled="false" ID="chkemailprimaryuser" runat="server" Checked='<%# DataBinder.Eval (Container.DataItem,"emailprimaryuser").ToString()="Y" %>' 
                             /> 
                        </ItemTemplate>                                                   
                    </telerik:GridTemplateColumn>    

Princy
Top achievements
Rank 2
 answered on 23 Dec 2009
4 answers
140 views
My situation :
My Web Page has many Tab (dynamic tabs) and 1 RadGrid (grid).  When I changed position tab, grid auto generate dynamic columns.
(I must set property grid.MasterTableView.EnableViewState = false to create dynamic columns). But I can't keep settings of gird when changed to another page and move back

My code :
<code>
private int tabIndex = 0;       // variable to define tab is selected
protected void Page_Init(....)
{
          if(! string.IsNullOrEmpty(Request.QueryString["tabIndex"] )
          {
                    tabIndex = Convert.ToInt32(Request.QueryString["tabIndex"]);
          }
          else
                   tabIndex = 0;
         
          // This method create grid corresponding tab is selected
          CreateGrid(tabIndex);
}

protected void OnUnload(....)
{
       GridPersistSetting gridSetting = new GridPersistSetting (grid);
       Session["grid" + tabIndex] = gridSetting.SaveSettings();
}

protected voi Page_Load(....)
{
        if (!IsPostBack)
        {
                  ....................
                  if(Session["grid" + tablndex] !=null)
                  {
                              GridPersistSetting gridSetting = new GridPersistSetting (grid);
                              gridSetting.LoadSettings(Session["grid" + tabIndex].ToString());
                  }
        }
}

protected void Tab_Click(...)
{
         Response.Redirect("Demo.aspx?tabIndex = " + e.tabIndex)
}
</code>

I do same as your example (gridSetting.LoadSettings() in Page_Init() and and gridSetting.SaveSettings in Render()) but it not success so I must changed as above (on PageLoad and UnLoad)
Can you give me a solution ?
Thanks you.
ysea
Top achievements
Rank 1
 answered on 23 Dec 2009
4 answers
278 views

When a GridDateTimeColumn is bound to a nested object (e.g. DataField="SomeObject.DateField"), column sorting is broken. The sorting appears to be based on the alphanumeric order. Here is the test code below with a workaround and a workaround attempt that causes an exception:

default.aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml">  
<head runat="server">  
    <title>Untitled Page</title> 
</head> 
<body> 
    <form id="form1" runat="server">  
        <asp:ScriptManager ID="ScriptManager1" runat="server" /> 
        <div> 
            <telerik:RadGrid AllowSorting="true" AllowPaging="true" PageSize="25" ID="RadGrid1" runat="server"   
                OnNeedDataSource="RadGrid1_NeedDataSource">  
                <MasterTableView AutoGenerateColumns="false">  
                    <Columns> 
                        <telerik:GridDateTimeColumn   
                            DataFormatString="{0:MM/dd/yyyy}" 
                            DataField="RefDate"   
                            UniqueName="Column0"   
                            HeaderText="ParentObj">  
                        </telerik:GridDateTimeColumn> 
                        <telerik:GridDateTimeColumn   
                            DataFormatString="{0:MM/dd/yyyy}" 
                            DataField="Dobj.RefDate1"   
                            UniqueName="Column1"   
                            HeaderText="ChildObj">  
                        </telerik:GridDateTimeColumn> 
                        <telerik:GridTemplateColumn  
                            SortExpression='Dobj.RefDate1.ToString("s")' 
                            UniqueName="Column2"   
                            HeaderText="WorkAround1">  
                            <ItemTemplate> 
                                <asp:Label ID="Label1" runat="server"   
                                    Text='<%# String.Format("{0:MM/dd/yyyy}", Eval("Dobj.RefDate1")) %>' 
                                > 
                                </asp:Label> 
                            </ItemTemplate> 
                        </telerik:GridTemplateColumn> 
                        <telerik:GridDateTimeColumn  
                            SortExpression='Dobj.RefDate2.ToString("s")' 
                            DataFormatString="{0:MM/dd/yyyy}" 
                            DataField="Dobj.RefDate2"   
                            UniqueName="Column3"   
                            HeaderText="WorkAround2">  
                        </telerik:GridDateTimeColumn>                    
                    </Columns> 
                </MasterTableView> 
            </telerik:RadGrid> 
        </div> 
    </form> 
</body> 
</html> 
 

default.aspx.cs:

using System;  
using System.Data;  
using System.Configuration;  
using System.Web;  
using System.Web.Security;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using System.Web.UI.WebControls.WebParts;  
using System.Web.UI.HtmlControls;  
using System.Collections.Generic;  
 
public partial class _Default : System.Web.UI.Page   
{  
    protected void Page_Load(object sender, EventArgs e)  
    {  
 
    }  
    protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)  
    {  
        RadGrid1.DataSource = GetDataList();  
    }  
 
    protected List<PObject> GetDataList()  
    {  
        DateTime refdt = new DateTime(2008, 12, 20);  
        var dlist = new List<PObject>();  
        for (int i = 1; i < 20; i++)  
        {  
           var dt = refdt.AddDays(i);  
           dlist.Add(   
                        new PObject   
                        {  
                            Dobj = new DObject { RefDate1 = dt, RefDate2 = dt },  
                            RefDate = dt  
                        }  
                    );  
        }  
        return dlist;  
    }  
}  
 
public class PObject  
{  
    public DObject Dobj { getset; }  
    public DateTime RefDate { getset; }  
}  
 
public class DObject  
{  
    public DateTime RefDate1 { getset; }  
    public DateTime RefDate2 { getset; }  

You will notice that the first column "ParentObj" sorts fine since the bound property is part of the data object. The second column "ChildObj" is bound to a nested/child object of the main data object. This one does not sort properly. The third column "WorkAround1" is a way to work around the problem using a GridTemplateColumn and a SortExpression using .ToString("s"). Since using a GridTemplateColumn is kind of cumbersome, I thought I'd try adding the .ToString("s") to the SortExpression of a GridDateTimeColumn, but this causes an exception. This is demonstrated when trying sort the "WorkAround2" column. Although this exception should probably fixed anyway (it doesn't make sense that it works for a GridTemplateColumn and not any other kind of bound column), getting the grid to support sorting on a DateTime property of a nested object either way is fine with me.

Mohan Bhandari
Top achievements
Rank 1
 answered on 22 Dec 2009
2 answers
99 views
Hi guys,

I just got a issue with RadComboBox + RadAjaxManager.
The Scenaria:

Two cbb1 and cbb2 on the web page.
I use RadAjaxManager to update cbb2 when cbb1 posted back.
And when cbb1 selectedindex changed, pop up an new window.

but whatever I setup for RadAjaxManager the new window never popup.


<Format Code Block>
form id="form1" runat='server'>        
             <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
             </telerik:RadScriptManager>
             <telerik:RadAjaxManager id="amgr1" runat="server" >
                  <AjaxSettings>
                        
                      <telerik:AjaxSetting AjaxControlID="rcbbTest1">
                        <UpdatedControls>
                           <telerik:AjaxUpdatedControl ControlID="rcbbTest2" />
                           <telerik:AjaxUpdatedControl ControlID="rcbbTest1" />
                        </UpdatedControls>
                     </telerik:AjaxSetting>
                     <telerik:AjaxSetting AjaxControlID="rcbbTest2">
                        <UpdatedControls>
                           <telerik:AjaxUpdatedControl ControlID="rcbbTest2" />
                         
                        </UpdatedControls>
                     </telerik:AjaxSetting>
                     <telerik:AjaxSetting AjaxControlID="rcbbTest3">
                        <UpdatedControls>
                           <telerik:AjaxUpdatedControl ControlID="rcbbTest3" />
                        </UpdatedControls>
                     </telerik:AjaxSetting>
                  </AjaxSettings>
             </telerik:RadAjaxManager>
            <table>
               <tr>
                  <td>
                     <telerik:RadComboBox ID="rcbbTest1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="rcbbTest1_OnSelectedIndexChanged">
                        <Items>
                           <telerik:RadComboBoxItem Text="1"  />
                            <telerik:RadComboBoxItem Text="11"  />
                        </Items>
                     </telerik:RadComboBox>
                  </td>
               </tr>
                <tr>
                  <td>
                     <telerik:RadComboBox ID="rcbbTest2" runat="server" AutoPostBack="true"  OnSelectedIndexChanged="rcbbTest2_OnSelectedIndexChanged">
                        <Items>
                           <telerik:RadComboBoxItem Text="2"  />
                            <telerik:RadComboBoxItem Text="22"  />
                        </Items>
                     </telerik:RadComboBox>
                  </td>
               </tr>
                <tr>
                  <td>
                     <telerik:RadComboBox ID="rcbbTest3" runat="server" AutoPostBack="true"  OnSelectedIndexChanged="rcbbTest3_OnSelectedIndexChanged">
                        <Items>
                           <telerik:RadComboBoxItem Text="3"  />
                            <telerik:RadComboBoxItem Text="33"  />
                        </Items>
                     </telerik:RadComboBox>
                  </td>
               </tr>
            </table>              
      </form>
-- C#
protected void rcbbTest1_OnSelectedIndexChanged(object sender, EventArgs e)
      {
         string url = "Request.aspx?subject='Request Client Access1'";

         Telerik.Web.UI.RadWindow newWindowClient = new Telerik.Web.UI.RadWindow();
         newWindowClient.NavigateUrl = url;
         newWindowClient.VisibleOnPageLoad = true; // Set the VisibleOnPageLoad to true
         newWindowClient.Title = "1";
         this.Page.Form.Controls.Add(newWindowClient);
      }
</Format Code Block>

Thanks for your help


Alex
Alex Zhang
Top achievements
Rank 1
 answered on 22 Dec 2009
1 answer
150 views

I have to generate simple graph at the run time which is based on couple of group and I have problem with it.

 

Here is the Data

 

Total

Year

Type

4

2009

Type1

1

2008

Type1

2

2008

Type2

3

2008

Type3

 

 

 So my X – axis will have Year and Y axis will be Total. I need to show Type for each Year. Since Type is missing for the Year 2009, I have seeing this issue.

 

 

Schlurk
Top achievements
Rank 2
 answered on 22 Dec 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?