Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
112 views
Hi,

I Need trigger Server event Load for RadTextbox without page postback, using client side javascript.
I tried sender.raise_load(Sys.EventArgs.Empty); in javascript function from button click event, but not work.
Any help is welcome.

Thanks advanced.

Roberto
Roberto
Top achievements
Rank 1
 answered on 02 Feb 2011
1 answer
56 views
Hi,

I currently have a PanelBar with 4 PanelBarItems. I recently started adding AJAX to my page using AJAX Manger, AJAX Manager Proxy, and AJAX Loading Panel. All has gone well until I tried AJAXifying my RadPanelBar.

To start off, lets call my  4 PanelBarItems Item1, Item2, Item3, and Item4.

In Item1, Users are given a bunch of options to Create a report the way they want it. After choosing their options they can click the "Build Report" button to Generate the Report. After the user has clicked the button a number of things happen:

1. The options of the report are inputted, starting the Method to dynamically create the Report.
2. Item1 is closed
3. The Report is then Viewed in a ReportViewer in Item4
4. Item4 is expanded to show the dynamic report.

Now, this all works fine without using AJAX and doing a full postback, but unfortunately it would be a lot smoother if this could happen with AJAX.
I have set up Panels around the contents of each item for Refreshing Panels and such, and this all works great, but I am having trouble Closing and Opening RadPanelItems with AJAX. I have also tried setting up a Panel around the whole PanelBar, but had no such luck getting this to work properly. I have also tried setting the UpdatedControls to the PanelBar ID itself, but also no luck.

Is it possible to expand, contract and update PanelBarItems with AJAX?

Best Regards,

Landon
Yana
Telerik team
 answered on 02 Feb 2011
1 answer
858 views
Hello,

please give me some information about loading a bitmap from memory.

I have tried it with

 

Dim stream As New System.IO.MemoryStream

 

Bmp1.Save(stream, System.Drawing.Imaging.ImageFormat.Png)

Image1.DataValue = stream.GetBuffer()

Image1.DataBind()


in CodeBehind. Bmp1 is a bitmap that is created and modified in code before.

No image is displayed. What do I have to do? I think I have not already understood the idea of binary image.

Thanks in advance

René
Rene
Top achievements
Rank 1
 answered on 02 Feb 2011
1 answer
81 views
Is there an example showing how to implement the recent provider changes for sending additional information to the provider? I'm working on a custom provider that does NOT use an XML data source and I'm looking mainly at the Implementing A Provider That Supports Multi-valued Resources example, but it is still using the old implementation. I understand what the changes are, but I'm having trouble converting the old "GetResourceTypes" and "GetResourceByType" methods to the new "GetResources" method.

Basically I need help converting the following code to the new "GetResources" implementation. Any help would be greatly appreciated.

public override IEnumerable<ResourceType> GetResourceTypes(RadScheduler owner)
{
  ResourceType[] resourceTypes = new ResourceType[2];
  resourceTypes[0] = new ResourceType("Teacher", false);
  resourceTypes[1] = new ResourceType("Student", true);
  return resourceTypes;
}
public override IEnumerable<Resource> GetResourcesByType(RadScheduler owner, string resourceType)
{
  switch (resourceType)
  {
     case "Teacher" :
         return Teachers.Values;
     case "Student" :
         return Students.Values;
     default:
         throw new InvalidOperationException( "Unknown resource type: " + resourceType);
  }
}
private IDictionary<int, Resource> Teachers
{
   get
   {
       if (_teachers == null)
       {
           _teachers = new Dictionary<int, Resource>();
           foreach (Resource teacher in LoadTeachers())
           {
               _teachers.Add((int)teacher.Key, teacher);
           }
       }
       return _teachers;
   }
}
private IDictionary<int, Resource> Students
{
   get
   {
       _students = new Dictionary<int, Resource>();
       foreach (Resource student in LoadStudents())
       {
           _students.Add((int)student.Key, student);
       }
       return _students;
   }
}
private IEnumerable<Resource> LoadTeachers()
{
  List<Resource> resources = new List<Resource>();
  using (DbConnection conn = OpenConnection())
  {
      DbCommand cmd = DbFactory.CreateCommand();
      cmd.Connection = conn;
      cmd.CommandText = "SELECT [TeacherID], [Name], [Phone] FROM [DbProvider_Teachers]";
      using (DbDataReader reader = cmd.ExecuteReader())
      {
         while (reader.Read())
         {
            Resource res = new Resource();
            res.Type = "Teacher";
            res.Key = reader["TeacherID"];
            res.Text = Convert.ToString(reader[ "Name" ]);
            res.Attributes["Phone"] = Convert.ToString(reader["Phone"]);
            resources.Add(res);
         }
      }
  }
  return resources;
}
 
private IEnumerable<Resource> LoadStudents()
{
  List<Resource> resources = new List<Resource>();
  using (DbConnection conn = OpenConnection())
  {
      DbCommand cmd = DbFactory.CreateCommand();
      cmd.Connection = conn;
      cmd.CommandText = "SELECT [StudentID], [Name] FROM [DbProvider_Students]";
      using (DbDataReader reader = cmd.ExecuteReader())
      {
          while (reader.Read())
          {
              Resource res = new Resource();
              res.Type = "Student";
              res.Key = reader["StudentID"];
              res.Text = Convert.ToString(reader[ "Name" ]);
              resources.Add(res);
          }
      }
  }
  return resources;
}
Peter
Telerik team
 answered on 02 Feb 2011
1 answer
255 views
Hello people,

I have a proble regarding RadAjaxManager.
I am using 2 RadComboBoxes on a page. The first one loads Locations and the second one loads Events. I use the SelectedIndexChange Event to fill the events comboBox with event according to the selected location and vice versa. ALthough I am using RAdAjaxManager, I am getting a full postback when I select either a location or an event. I should mention that I am using a master page where I have the RadScriptManager. Here is my code:

<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
<telerik:RadAjaxManager runat="server" id="RadAjaxManager1">
         <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="pnlSearchBox" >
                <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="pnlSearchBox"  LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
            </telerik:AjaxSetting>
         </AjaxSettings>
            <AjaxSettings >
                <telerik:AjaxSetting AjaxControlID="pnlScheduler" >
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="pnlScheduler" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
          <telerik:RadAjaxLoadingPanel id="RadAjaxLoadingPanel1" runat="server" transparency="60" Height="950px"
                    backcolor="White">
                     <br /><br /><br /><br /><br /><br /><br />
                <asp:Image ID="loadingPicture" runat="server" ImageUrl="../App_Themes/myOBIS/picts/loading.gif" />
        </telerik:RadAjaxLoadingPanel>
.
.
.
.
.
 <asp:Panel ID="pnlSearchBox" runat="server">
    <asp:Label ID="lblStandorte" runat="server" Text="<%$ Resources:GlobalLocalization, Standort_%>" />
    <telerik:RadComboBox ID="rcbLocations" runat="server"  AutoPostBack="true"
           EnableEmbeddedSkins="false" Skin="myOBIS" DataTextField="LocationName" DataValueField="LocationId"
                CssClass="field_long" onselectedindexchanged="Locations_SelectedIndexChange" ></telerik:RadComboBox>                                              
 <asp:Label ID="lblProdukte" runat="server" Text="<%$ Resources:GlobalLocalization, Produkt_%>" />
   <telerik:RadComboBox ID="rcbProducts" runat="server"  DataTextField="InternalProductName" DataValueField="ProductId"  EnableEmbeddedSkins="false" Skin="myOBIS"   CssClass="field_long" AutoPostBack="true"
    onselectedindexchanged="Products_SelectedIndexChange" ></telerik:RadComboBox>                                                  
          <asp:Panel/>  
                                              
...

I have also tried to put the locations ComboBox directly as AjaxControlId and updating the Events ComboBox directly but still I get a full postback. I am using the AjaxManager in almost all pages of our Business Application but it doesn't seem to work.
I'd be glad to get some help
Tsvetina
Telerik team
 answered on 02 Feb 2011
3 answers
79 views
I saw the demo from this link http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/clienteditbatchupdates/defaultcs.aspx that user can double click on the RadGridView cells to edit them. I tried to learn from the sample code to create the grid for cell editing, but it is not working.  See the code below.  What did I miss?  Thanks.

<telerik:RadGrid ID="DistributorRadGrid" runat="server" GridLines="Both" >
                <MasterTableView EditMode="InPlace" >
                <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
  
                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                <HeaderStyle Width="20px"></HeaderStyle>
                </RowIndicatorColumn>
  
                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                <HeaderStyle Width="20px"></HeaderStyle>
                </ExpandCollapseColumn>
  
                <EditFormSettings>
                <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
                </EditFormSettings>
                </MasterTableView>
  
                <FilterMenu EnableImageSprites="False"></FilterMenu>
  
                <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
            </telerik:RadGrid>

var varDistributors =
                 from d in MORContext.GetTable<Distributor>()
                 where (d.Active == true && d.Distributor_Type_id == 1 )
                 orderby d.Distributor_Name
                 select new {  Distributor_Name = d.Distributor_Name, 
                               DistributorID = d.Destributor_ID };
Tsvetina
Telerik team
 answered on 02 Feb 2011
1 answer
77 views
I have a RadTreeView where I enabled Drag and Drop using ClientSettings.  The RadTreeView uses a NodeTemplate, and within each node template I have a RadGrid with the idea of dragging a row from one grid to a grid in another node.  When I attempt to drag a RadGrid row, its also attempting to drag a RadTreeView node, is there anyway to prevent this?  

Thanks,
Neil
Pavlina
Telerik team
 answered on 02 Feb 2011
8 answers
387 views
Hi All,

Am facing the problem with ajax implementation in Telerik Rad Grid.

In my page i implement RadAjaxmanager and RadAjaxPanel and RadGrid. Inside RadGrid. I want to edit details so am using EditFormSettings to edit details. In this EditFormSettings am calling a user control form.

My problem is, i dont want to allow unsafe script inside my edit form.
  1. So i turn on in web config file <%@ page Validate Request=True %>
  2.  If user enters unsafe script in any text box am catching exception in my Global application_error event and redirecting to another normal aspx page.
  3. if i use RadGrid and Update details i use  <EditFormSettings UserControlName="~/editform.ascx" EditFormType="WebUserControl" >. And i type any unsafe script message "<b>example</b>" inside the textbox.
    Error was capturing in Global.aspx file, But not redirecting to Error page and throwing a javasscript error


Codes am using

  1. My Web config code :
    <pages validateRequest="true"
    My Global File Code :
    Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)  
            Dim ex As Exception = Server.GetLastError().GetBaseException()  
     
            If Not (ex.GetType Is GetType(HttpException)) Then  
                  
                If ex.Message.ToLower.Contains("a potentially dangerous request.form value was detected from the client") Then  
                    Try  
                        My.Log.WriteEntry("Global Error MESSAGE: " & ex.Message & "SOURCE: " & ex.Source & "STACKTRACE: " & ex.StackTrace, EventLogEntryType.Error)  
                    Catch ex1 As Exception  
                        My.Log.WriteEntry("Write event log got problem: " & ex1.Message, EventLogEntryType.Error)  
                    End Try  
                    Server.Transfer("~/UnsafeScriptErrorPage.aspx?returnURL=" & Server.UrlEncode(HttpContext.Current.Request.Url.ToString))  
                  
                ElseIf ex.Message.Trim.ToString <> "" Then  
                    Try  
                        My.Log.WriteEntry("Global Error MESSAGE: " & ex.Message & "SOURCE: " & ex.Source & "STACKTRACE: " & ex.StackTrace, EventLogEntryType.Error, False)  
                    Catch ex1 As Exception  
                        My.Log.WriteEntry("Write event log got problem: " & ex1.Message, EventLogEntryType.Error)  
                    End Try  
                    Server.Transfer("~/GenericErrorPage.aspx?errMsg=" & ex.Message & "&returnURL=" & Server.UrlEncode(HttpContext.Current.Request.Url.ToString), False)  
                End If  
                              
            End If  
              
            Server.ClearError()  
                End Sub 

    My First ASPX Code
  2. <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" 
        CodeFile="Inbox.aspx.vb" Inherits="Inbox" Title="Inbox" %> 
     
     
     
    <%@ Register assembly="RadAjax.Net2" namespace="Telerik.WebControls" tagprefix="radA" %> 
    <%@ Register src="../datagridControl.ascx" tagname="datagridControl" tagprefix="uc1" %> 
     
     
     
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">  
    <radA:RadAjaxPanel ID="RadAjaxPanelAppIn" runat="server" LoadingPanelID="AjaxLoadingPanelAppin" ClientEvents-OnRequestStart="pnlRequestStarted" 
            Width="100%">  
        <table border="0" cellpadding="0" cellspacing="0" class="HeaderBg" width="100%">  
            <tbody> 
                <tr> 
                    <td class="SideSpaceWidth">  
                    </td> 
                    <td class="SideSpaceHeight">  
                    <radA:AjaxLoadingPanel ID="AjaxLoadingPanelAppin" runat="server" IsSticky="True" 
                            MinDisplayTime="1000" Wrap="False">  
                            <asp:Image ID="Image1" runat="server" AlternateText="Loading..." ImageUrl="~/images/indicator.gif" /> 
                            <strong>Loading Content ...</strong></radA:AjaxLoadingPanel> 
                    </td> 
                    <td class="SideSpaceWidth">  
                    </td> 
                </tr> 
                <tr> 
                    <td > 
                    </td> 
                    <td> 
                        <uc1:datagridControl ID="DatagridControl1" runat="server" /> 
                    </td> 
                    <td> 
                    </td> 
                </tr> 
                <tr> 
                    <td> 
                    </td> 
                    <td class="SideSpaceHeight">  
                        &nbsp;</td> 
                    <td> 
                    </td> 
                </tr> 
                
            </tbody> 
        </table> 
        </radA:RadAjaxPanel> 
         
    </asp:Content> 
     
    Inside datagridControl.ascx down is the code for RadGrid
  3. <radG:RadGrid ID="RadGrid1" runat="server" AllowAutomaticDeletes="True" AllowFilteringByColumn="False" 
                    AllowMultiRowSelection="false" AllowPaging="True" AllowSorting="True" BackColor="Transparent" 
                    DataSourceID="GridDataSource" EnableAJAX="false" EnableAJAXLoadingTemplate="false" 
                    EnableViewState="true" GridLines="None" LoadingTemplateTransparency="50" ShowGroupPanel="True" 
                    ShowStatusBar="False" AutoGenerateColumns="true" OnUpdateCommand="RadGrid1_UpdateCommand" 
                    SkinID="myGrid" OnColumnCreated="ColumnCheck" OnPreRender="ReduceFilter" Width="100%" 
                    OnItemDataBound="ColDatabind">  
                    <MasterTableView DataSourceID="GridDataSource" GroupLoadMode="Client">  
                        <Columns> 
                            <radG:GridEditCommandColumn ButtonType="ImageButton" EditImageUrl="~/Images/edit.gif" 
                                UniqueName="EditCommandColumn1" Resizable="False" Reorderable="False">  
                                <HeaderStyle Width="15px" /> 
                            </radG:GridEditCommandColumn> 
                            <radG:GridTemplateColumn UniqueName="AssignUser" AllowFiltering="False" Reorderable="False" 
                                Groupable="False" Resizable="False" Visible="false">  
                                <HeaderStyle Width="20px" /> 
                                <HeaderTemplate /> 
                                <ItemTemplate> 
                                    <asp:ImageButton runat="Server" ID="ibtnAssignMsg" ImageUrl="~/images/Asgn.gif" CommandName="AssignMsgToUser" 
                                        ToolTip="Assign SMS to User" Visible="false" /> 
                                </ItemTemplate> 
                            </radG:GridTemplateColumn> 
                            <radG:GridTemplateColumn UniqueName="myselect" AllowFiltering="False" Reorderable="False" 
                                Groupable="False" Resizable="False">  
                                <HeaderStyle Width="20px" /> 
                                <HeaderTemplate> 
                                    <asp:CheckBox ID="selectall" runat="Server" OnLoad="SelectAll" /> 
                                </HeaderTemplate> 
                                <ItemTemplate> 
                                    <asp:CheckBox runat="Server" ID="myselect" OnLoad="ClearSAll" /> 
                                </ItemTemplate> 
                            </radG:GridTemplateColumn> 
                        </Columns> 
                        <EditFormSettings UserControlName="~/editform.ascx" EditFormType="WebUserControl" > 
                            <EditColumn UniqueName="EditCommandColumn">  
                            </EditColumn>                          
                        </EditFormSettings> 
                        <NoRecordsTemplate> 
                            <table width="100%">  
                                <tr> 
                                    <td align="center">  
                                        There are no items to display. Please check your selection criteria and retry.  
                                    </td> 
                                </tr> 
                            </table> 
                        </NoRecordsTemplate> 
                        <FooterStyle Height="0px" /> 
                        <ExpandCollapseColumn Visible="False">  
                            <HeaderStyle /> 
                        </ExpandCollapseColumn> 
                        <RowIndicatorColumn Visible="False">  
                            <HeaderStyle /> 
                        </RowIndicatorColumn> 
                    </MasterTableView>                 
                    <ClientSettings AllowGroupExpandCollapse="True" AllowDragToGroup="True" AllowColumnsReorder="True" 
                        ColumnsReorderMethod="Reorder" ApplyStylesOnClient="True">  
                        <Selecting AllowRowSelect="True" /> 
                        <Resizing AllowColumnResize="True" ResizeGridOnColumnResize="True" />                     
                    </ClientSettings> 
                </radG:RadGrid> 
    My Third EditForm User Control code
    <tr> 
                                    <td nowrap="nowrap">  
                                        <asp:Label ID="Label3" runat="server" meta:resourcekey="Label3Resource2" Text="Recipient(s)"></asp:Label></td>  
                                    <td> 
                                        <asp:Label ID="Label5" runat="server" CssClass="tips" meta:resourcekey="Label5Resource1" 
                                            Text="use ; to separate multiple numbers"></asp:Label> 
                                        <asp:TextBox ID="txtRecipient" runat="server" Visible="False"></asp:TextBox><asp:RequiredFieldValidator  
                                            ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtRecipient" 
                                            ErrorMessage="RequiredFieldValidator" meta:resourcekey="ContactTextRequiredResource1" 
                                            ToolTip="Mobile Number is required." ValidationGroup="SaveSMS">*</asp:RequiredFieldValidator> 
                                        <asp:RegularExpressionValidator  
                                                ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtRecipient" 
                                                ErrorMessage="Please enter numbers only" meta:resourcekey="contactValidatorResource1" 
                                                ValidationExpression="[0-9]+" ValidationGroup="SaveSMS"></asp:RegularExpressionValidator> 
                                        <asp:HiddenField ID="OutlogID" runat="server" /> 
                                    </td> 
                                </tr> 
    <tr> 
                                    <td> 
                                        <asp:Label ID="Label2" runat="server" meta:resourcekey="Label2Resource2" Text="SMS Text"></asp:Label></td>  
                                    <td> 
                                        <asp:TextBox ID="txtSMS" runat="server" Columns="50" Rows="5" TextMode="MultiLine"></asp:TextBox> 
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtSMS" 
                                            ErrorMessage="RequiredFieldValidator" meta:resourcekey="RequiredFieldValidator2Resource1" 
                                            ValidationGroup="QuickSMS">*</asp:RequiredFieldValidator></td>  
                                </tr> 
    When i type "<b>example</b> in text box. The unsafe script error was capturing in global and writting into event log but not redirecting top error display page and giving me always Javascript Error.
  4. am getting downside Javascript Error.


Microsoft JScript runtime error: Unexpected ajax response was received from the server.
This may be caused by one of the following reasons:

 - Server.Transfer.
 - Custom http handler.
- Incorrect loading of an "Ajaxified" user control

Verify that you don't get a server-side exception or any other undesired behavior, by setting the EnableAJAX property to false.



Any one Please help me in this issue. am waiting for your reply.

 

Veli
Telerik team
 answered on 02 Feb 2011
7 answers
197 views
Hi,
I have a requirement where in we show a grid with 100+ columns all with GridTemplateColumns. We either have TextBox, Dropdwon or Radiobutton as edit item template for all the columns. We have a feature where in we invoke a RadWindow (Kept as Content Template with in the same Grid Page) that opens up where in user is shown a drop down that has all the columns that are shown in the grid on selection of any column we need to show the appropriate edit item control for the selected column where in user can enter/select data.

For example if user select "Name" in dropdown, I need to show TextBox if edit item template has text box and if user "Department" in dropdown, I need to show Dropdwon if edit item template has dropdwon...

Looking forward for help
Thanks in Advance
Princy
Top achievements
Rank 2
 answered on 02 Feb 2011
4 answers
72 views
Hi, Telerik...
The PDFExport is giving if i add table......what can i do......
ARUNTHOMAS
Top achievements
Rank 1
 answered on 02 Feb 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?