Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
195 views
I am needing that depending on a condition verified in the code behind, I update certain controls by ajax. I researched some ways and I believe that would solve, is to add AJAX settings dynamically. But still could not solve the problem.

I have based on this example http://demos.telerik.com/aspnet-ajax/ajax/examples/manager/dynamicajaxsettings/defaultcs.aspx

An example to demonstrate the problems that can not solve, basically a ComboBox that selects which of the divs should be updated:

<telerik:RadScriptManager ID="telerik_ajax_manager" runat="server" OutputCompression="Forced" />
<telerik:RadAjaxLoadingPanel ID="ajax_Loaging_Panel" Enabled="true" runat="server" MinDisplayTime="1000" BackColor="#cccccc" Transparency="50" />
 
<div id="div_1" runat="server">
    <asp:Label ID="lbl_1" runat="server" Text="Div 1"></asp:Label>
    <br />
    Update:
    <telerik:RadComboBox ID="cbx_update" runat="server">
        <Items>
            <telerik:RadComboBoxItem Value="div_2" Text="Div 2" />
            <telerik:RadComboBoxItem Value="div_3" Text="Div 3" />
        </Items>
    </telerik:RadComboBox>
</div>
<br />
<div id="div_2" runat="server">
    <asp:Label ID="lbl_2" runat="server" Text="Div 2"></asp:Label>
</div>
<br />
<div id="div_3" runat="server">
    <asp:Label ID="lbl_3" runat="server" Text="Div 3"></asp:Label>
</div>
<br />
<telerik:RadButton ID="btn_submit" runat="server" onclick="btn_submit_Click" Text="Submit"></telerik:RadButton>
 
<telerik:RadAjaxManager ID="ajax_manager" runat="server" DefaultLoadingPanelID="ajax_Loaging_Panel">
<AjaxSettings>
    <telerik:AjaxSetting AjaxControlID="btn_submit">
        <UpdatedControls>
            <telerik:AjaxUpdatedControl ControlID="div_1" />
        </UpdatedControls>
    </telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>

protected void btn_submit_Click(object sender, EventArgs e)
{
    if (cbx_update.SelectedValue == "div_2")
    {
        lbl_2.Text = "Div 2 Updated";
        ajax_manager.AjaxSettings.AddAjaxSetting(btn_submit, div_2);
    }
    else
    {
        lbl_3.Text = "Div 3 Updated";
        ajax_manager.AjaxSettings.AddAjaxSetting(btn_submit, div_3);
    }
}

That the error occurs:
Erro: Sys.InvalidOperationException: Could not find UpdatePanel with ID 'ctl00_MainContent_ctl00_MainContent_div_2Panel'. If it is being updated dynamically then it must be inside another UpdatePanel.
Arquivo-fonte: http://localhost:10677/Telerik.Web.UI.WebResource.axd?_.......

This occurs because the telerik previously did not know what I would update divs. So do not create the Panels.

If I add these tags, even if this case does not make sense. works because the telerik creates the Panels, but I think we can bring me some trouble in the future.

<telerik:AjaxSetting AjaxControlID="div_3">
    <UpdatedControls>
        <telerik:AjaxUpdatedControl ControlID="div_2" />
        <telerik:AjaxUpdatedControl ControlID="div_3" />
    </UpdatedControls>
</telerik:AjaxSetting>


I think that's why the example of the telerik site works. (<telerik:AjaxUpdatedControl ControlID="DivExternalForm"...)

Following the recommendation of the error, add RadAjaxPanels on divs:

<telerik:RadAjaxPanel ID="pnl_2" runat="server">
    <div id="div_2" runat="server">
        <asp:Label ID="lbl_2" runat="server" Text="Div 2"></asp:Label>
    </div>
</telerik:RadAjaxPanel>
<br />
<telerik:RadAjaxPanel ID="pnl_3" runat="server">
    <div id="div_3" runat="server">
        <asp:Label ID="lbl_3" runat="server" Text="Div 3"></asp:Label>
    </div>
</telerik:RadAjaxPanel>


protected void btn_submit_Click(object sender, EventArgs e)
{
    if (cbx_update.SelectedValue == "div_2")
    {
        lbl_2.Text = "Div 2 Updated";
        ajax_manager.AjaxSettings.AddAjaxSetting(btn_submit, pnl_2);
    }
    else
    {
        lbl_3.Text = "Div 3 Updated";
        ajax_manager.AjaxSettings.AddAjaxSetting(btn_submit, pnl_3);
    }
}


But now another error occurs:
Erro: Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object.
Arquivo-fonte: http://localhost:10677/Telerik.Web.UI.WebResource.axd?_TSM_....

Searched these errors on the forums, but have not found a solution, can anyone help?
Iana Tsolova
Telerik team
 answered on 08 Apr 2011
2 answers
123 views
Hi

We are evaluating Telerik ASP.NET AJAX controls for upcoming project. One of the requirements is ability to display grid values in form of a horizontal color bar with its size depends on the cell value and color depends on the sign (positive numbers in green and negative in red). I could think of creating dynamic images based on the values and place them inside the grid which I think it would be very slow, or maybe somehow can use the Rating Column type template but was wondering if there is a better solution for this.

I would appreciate your help in advance.
Ron Farko
Ron
Top achievements
Rank 1
 answered on 08 Apr 2011
1 answer
92 views
Hi,

I installed the RAD Ajax controls MSI on the SP2010 server. I placed the 2 dlls in GAC. And performed the changes in the web.config file as mentioned.

But i get this error now when i try to bring up the site. Pls notice the version information in the last line. Am I  using any unsupported versions ??

thanks
-kiran

 

Server Error in '/' Application.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: This page has encountered a critical error. Contact your system administrator if this problem persists.

Source Error:

Line 1: <%@ Page Inherits="Microsoft.SharePoint.Publishing.TemplateRedirectionPage,Microsoft.SharePoint.Publishing,Version=12.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" %> <%@ Reference VirtualPath="~TemplatePageUrl" %> <%@ Reference VirtualPath="~masterurl/custom.master" %><%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>Line 2:  <html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"><head>
Line 3:  <!--[if gte mso 9]><SharePoint:CTFieldRefs runat=server Prefix="mso:" FieldList="FileLeafRef,Comments,PublishingStartDate,PublishingExpirationDate,PublishingContactEmail,PublishingContactName,PublishingContactPicture,PublishingRollupImage,Audience,HtmlContent,PublishingPageLayout,PublishingVariationGroupID,PublishingVariationRelationshipLinkFieldID,PublishingRollupImage"><xml>

Source File: /Pages/Home.aspx    Line: 1


Version Information: Microsoft .NET Framework Version:2.0.50727.4952; ASP.NET Version:2.0.50727.4955
Maria Ilieva
Telerik team
 answered on 08 Apr 2011
3 answers
224 views
Hi,

I have couple of questions regarding RadTreeList. I would like to have my RadTreeList with the most of the RadGrid´s functionality.

So I am curious if there´s an option to have Header Context Menu in RadTreeList.
Next, if there´s possibility to enableRowHoverStyle and AllowColumnsReorder in RadTreeList.
Finally, is there a way how to have RadToolBar as a CommandItemTemplate like in RadTreeList.


Veli
Telerik team
 answered on 08 Apr 2011
1 answer
131 views
Hi, I use a radmenu with webservice expand mode, on the page load the menu is populated, but after couple of clicks on it back and forth, subitems stop showing up, only root menu items remain.
Web servise is on the same web site and returns radmenuitemdata array.
It's Q1 2011, framework 3.5.
sorry, figured it out
Dimitar Terziev
Telerik team
 answered on 08 Apr 2011
2 answers
112 views
Hi,

you write
Our PDF engine can export all images nevertheless whether they use an absolute or relative path

However, when I use
img src="https://localhost/images/imagename.png" - it says "... is not a valid virtual path"

If i use 127.0.0.1 - it does not work either. I guess the same will be with computer name. But i cannot use some other address, because I have test site mounted on IIS locally!

What should i do?

Btw, I cannot use relative path, too, because i have cookieless session on the site and it throws image not found exception when rendering PDF

Could not find a part of the path
file:///C:/TFS/WizardsFramework/Main/Source/B4Restore.Web.Client.TSM-SVC/(S(xxxxxxxxxxx))/images/imagename.png
Daniel
Telerik team
 answered on 08 Apr 2011
5 answers
100 views
<telerik:RadUpload EnableFileInputSkinning="true" EnableEmbeddedSkins="true" Skin="WebBlue" Width="350" InputSize="30" runat="server" ID="RadUpload1" AllowedFileExtensions=".gif,.jpeg,.jpg,.bmp,.png"                                                   OverwriteExistingFiles="true" InitialFileInputsCount="1"OnClientFileSelected="checkExtension"                                                                                        ControlObjectsVisibility="None" MaxFileInputsCount="1">
                                                                                    </telerik:RadUpload>

I have added the above code in the EditFormSettings-<FormTemplate> tag of my aspx page.
The theme for radupload is applyed when i am in the add mode of the grid.
but fails to apply skin when i am in the edit mode.
i have not added any code related to radupload.

plzz help me with this issue.

Thanks
K²
Genady Sergeev
Telerik team
 answered on 08 Apr 2011
2 answers
100 views
What I am trying to do is to dynamically change the viewpath on my fileexplorere based on the selected item in a radgrid.

Unfortunately ItemCommand fires off after the Page_load event.  This means that when the user makes his selection Page_load still does not know that an item has been selected at all.

Which means I cannot update the viewpath for the fileexplorer, as page_load is the latest event that this can be done it seems. 

Does anyone have any other ideas?

I've actually had it sort of working where I dynamically create a fileexplorer in the ItemCommand event. When I do this though, the upload and delete commands do not seem to function properly.  Not to mention if a postback occurs that is not casused by the grids itemcommand event fireing the fileexplorer disappears.

Right now it looks like I will just manually create my own.
Jack Voss
Top achievements
Rank 1
 answered on 08 Apr 2011
1 answer
148 views
Hello,

Maybe just having a bad day, but I can't figure out what I've done wrong.  When I introduced the RadAjaxManager to my page, one of my Javascript functions executes, does not throw any errors, but does not update the document.  If I remove the RadAjaxManager my Javascript executes properly.  The function called is previewStyle, and is called by this button: <asp:Button ID="previewCSS" runat="server" Text="Preview" OnClientClick="previewStyle(); return false;" />

<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadAjaxManager runat="server">
        <ajaxsettings>
            <telerik:AjaxSetting AjaxControlID="rgCampaignThemes">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rgCampaignThemes" LoadingPanelID="radAjaxLoadingPanel1" UpdatePanelHeight="" />
                    <telerik:AjaxUpdatedControl ControlID="editorCSS" LoadingPanelID="radAjaxLoadingPanel1" />
                </UpdatedControls>
                 
            </telerik:AjaxSetting>
        </ajaxsettings>
    </telerik:RadAjaxManager>
     
    <telerik:RadScriptBlock ID="radScriptBlock1" runat="server">
 
        <script src="../Scripts/jquery-1.5.js" type="text/javascript"></script>
 
        <script type="text/javascript" language="javascript">
     
    
    function previewStyle(){
        try{
        var editor = $find("<%=editorCSS.ClientID%>");
       //$('style[type="text/css"]').text(editor.get_html());
       var newStyleSheet = '<style type="text/css">' + editor.get_html() + '</style>';
       var filterVar = $('style[type="text/css"]');
       filterVar.replaceWith(newStyleSheet);
       }
       catch(e){
       alert(e);
       }
       }
        
         </script>
 
    </telerik:RadScriptBlock>
 
<telerik:RadAjaxLoadingPanel ID="radAjaxLoadingPanel1" runat="server">
                </telerik:RadAjaxLoadingPanel>
                <telerik:RadGrid Width="600px" ID="rgCampaignThemes" AllowSorting="True" Skin="WebBlue"
                    EnableLinqExpressions="False" runat="server" GridLines="None" AllowPaging="True"
                    OnNeedDataSource="rgCampaignThemesNeedDataSource" OnItemCreated="rgCampaignTheme_ItemCreated"
                    OnSelectedIndexChanged="rgCampaignThemes_SelectedIndexChanged" MasterTableView-NoDetailRecordsText="No Themes"
                    OnItemCommand="rgCampaignTheme_ItemCommand" OnDetailTableDataBind="rgCampaignTheme_DetailTableDataBind"
                    OnPreRender="rgCampaignTheme_preRender">
                    <mastertableview tablelayout="Fixed" clientdatakeynames="id" datakeynames="id" autogeneratecolumns="False"
                        allowfilteringbycolumn="true" allowsorting="true" allowpaging="true" pagesize="15"
                        pagerstyle-visible="true">
                        <DetailTables>
                            <telerik:GridTableView AutoGenerateColumns="false" NoDetailRecordsText="">
<CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
                            <Columns>
                                <telerik:GridButtonColumn CommandName="Select" Text="Select" UniqueName="Select">
                            </telerik:GridButtonColumn>
                            <telerik:GridBoundColumn DataField="id" HeaderText="Id" SortExpression="id" UniqueName="id"
                                AllowFiltering="true" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" Visible="false" />
                            <telerik:GridBoundColumn DataField="themeName" HeaderText="Theme" SortExpression="themeName"
                                UniqueName="themeName" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left"
                                AllowFiltering="true" />
                            <telerik:GridBoundColumn DataField="paletteName" HeaderText="Palette" SortExpression="paletteName"
                                UniqueName="paletteName" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left"
                                AllowFiltering="true" />
                            <telerik:GridBoundColumn DataField="isActive" HeaderText="Active" SortExpression="isActive"
                                AllowFiltering="true" UniqueName="isActive" DataType="System.Boolean" HeaderStyle-HorizontalAlign="Center"
                                ItemStyle-HorizontalAlign="Center" />
                            <telerik:GridButtonColumn CommandName="ToggleActive" Text="Toggle Active" UniqueName="ToggleActive">
                            </telerik:GridButtonColumn>
                            <telerik:GridButtonColumn CommandName="GenerateImages" Text="Generate Images" UniqueName="GenerateImages">
                            </telerik:GridButtonColumn>
                            </Columns>
                                 
                            </telerik:GridTableView>
                        </DetailTables>
 
<CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
 
<ExpandCollapseColumn Visible="True"></ExpandCollapseColumn>
                        <Columns>
                            <telerik:GridButtonColumn CommandName="Select" Text="Select" UniqueName="Select" ItemStyle-Width="50px">
                            </telerik:GridButtonColumn>
                            <telerik:GridBoundColumn DataField="id" HeaderText="Id" SortExpression="id" UniqueName="id"
                                AllowFiltering="true" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" Visible="false" />
                            <telerik:GridBoundColumn DataField="themeName" HeaderText="Theme" SortExpression="themeName"
                                UniqueName="themeName" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left"
                                AllowFiltering="true" HeaderStyle-Width="150px"/>
                                <telerik:GridBoundColumn DataField="paletteName" HeaderText="Palette" SortExpression="paletteName"
                                UniqueName="paletteName" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left"
                                AllowFiltering="true" />
                             
                            <telerik:GridBoundColumn DataField="isActive" HeaderText="Active" SortExpression="isActive"
                                AllowFiltering="true" UniqueName="isActive" DataType="System.Boolean" HeaderStyle-HorizontalAlign="Center"
                                ItemStyle-HorizontalAlign="Center" />
                             <telerik:GridBoundColumn DataField="ParentId" HeaderText="ParentId" SortExpression="ParentId" UniqueName="ParentId"
                                AllowFiltering="true" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" Visible="false" />
                            <telerik:GridButtonColumn CommandName="ToggleActive" Text="Toggle Active" UniqueName="ToggleActive">
                            </telerik:GridButtonColumn>
                            <telerik:GridButtonColumn CommandName="GenerateImages" Text="Generate Images" UniqueName="GenerateImages">
                            </telerik:GridButtonColumn>
                            <telerik:GridButtonColumn CommandName="Up" Text="Up" UniqueName="Up">
                            </telerik:GridButtonColumn>
                            <telerik:GridButtonColumn CommandName="Down" Text="Down" UniqueName="Down">
                            </telerik:GridButtonColumn>
                        </Columns>
                    </mastertableview>
                </telerik:RadGrid>
                <br />
                <br />
                <asp:Literal runat="server" ID="layoutContent"></asp:Literal>
            </td>
            <td width="15px">
                  
            </td>
            <td width="50%" valign="top">
                <telerik:RadEditor runat="server" ID="editorCSS" EditModes="Html" AllowScripts="true"
                    ContentFilters="IndentHTMLContent" OnClientLoad="onClientLoad" Height="750">
                    <tools>
                        <telerik:EditorToolGroup>
                        </telerik:EditorToolGroup>
                    </tools>
                </telerik:RadEditor>
                Theme Name:
                <asp:TextBox ID="themeName" runat="server"></asp:TextBox>
                <br />
                Palette Name:
                <asp:TextBox ID="paletteName" runat="server"></asp:TextBox>
                <br />
                <asp:Button ID="previewCSS" runat="server" Text="Preview" OnClientClick="previewStyle(); return false;" />
</td>
....


thanks
Cori
Top achievements
Rank 2
 answered on 08 Apr 2011
3 answers
200 views
I am using the design time interface to create a hierarchical grid 3 tiered. auto update insert delete as well. I am using DB2 SQL to perform these actions, which I have written the same as with the Norhwind database examples except I must use ( instead of [ around the field and variable '?' that appear in the examples. I have defined the parameters to be selected, updated and deleted based on what type of field it is in the AS400. Our numerics are packed with 0 decimals for instance and strings of course. I can perform each action with the character only rows like the first level of my grid. It works perfectly, but when the data to be inserted or updated has a mixture of data in the fields to be updated or inserted I end up getting error messages, and I have Dbtyped these fields every way I can think of to get this message to stop. "Record cannot be updated. Reason: Command parameter[8] '' data value could not be converted for reasons other than sign mismatch or data overflow". I've tried other values like "Decimal" for instance in the update parameter for an AS400 packed field with zero decimals. Any help would be greatly appreciated. Todd

my SQL for update is as follows in the aspx

UpdateCommand

 

="UPDATE XX.WSP060 SET WAPPAC = ?, WAMAXD = ?, WAMAXT = ?, WARSTS = ?, WAATMS = ? WHERE (WABCTP = ?) AND (WABCAT = ?) AND (WADESC = ?) AND (WACMPY = ?) AND (WAIDENT = ?) AND (WACLASS = ?) AND (WASTYLE = ?) AND (WACOLOR = ?) AND (WASIZE = ?)"

my parameters for the update are

 

 

<

 

UpdateParameters>

 

 

 

 

<asp:FormParameter Name="WABCTP" DbType="String" />

 

 

 

 

 

 

 

 

 

<asp:FormParameter Name="WABCAT" DbType="String" />

 

 

 

 

 

 

 

 

 

<asp:FormParameter Name="WADESC" DbType="String" />

 

 

 

 

 

 

 

 

 

<asp:FormParameter Name="WACMPY" DbType="String" />

 

 

 

 

 

 

 

 

 

<asp:FormParameter Name="WAIDENT" DbType="Int32" />

 

 

 

 

 

 

 

 

 

<asp:FormParameter Name="WACLASS" DbType="String" />

 

 

 

 

 

 

 

 

 

<asp:FormParameter Name="WASTYLE" DbType="String" />

 

 

 

 

 

 

 

 

 

<asp:FormParameter Name="WACOLOR" DbType="String" />

 

 

 

 

 

 

 

 

 

<asp:FormParameter Name="WASIZE" DbType="String" />

 

 

 

 

 

 

 

 

 

<asp:FormParameter Name="WAPPAC" DbType="Int32" />

 

 

 

 

 

 

 

 

 

<asp:FormParameter Name="WAMAXD" DbType="Int32" />

 

 

 

 

 

 

 

 

 

<asp:FormParameter Name="WAMAXT" DbType="Int32" />

 

 

 

 

 

 

 

 

 

<asp:FormParameter Name="WARSTS" DbType="String" />

 

 

 

 

 

 

 

 

 

<asp:FormParameter Name="WAATMS" DbType="String" />

 

 

 

 

</UpdateParameters>

 

Iana Tsolova
Telerik team
 answered on 08 Apr 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?