Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
101 views
Hi,

I have a grid that consists of customer details which is populated from a database. One of the customer attributes is the Sort Code. I would like to be able to bind the values of this to the appropriate textboxes when editing a customer. In the database, this item is stored as a single 6 digit code, however, as is convention, the user enters the code in 3, 2 digit text boxes. Usually one uses the

Text='<%# Bind("blah"%>'
 technique, however in this instance this is not possible as there are 3 separate textboxes. When would be the best point to assign the values through codebehind? At the editcommand event (though afaik edit form items are not accessible from here)? Any help would be greatly appreciated.

Cheers,
Christian
Princy
Top achievements
Rank 2
 answered on 04 Jan 2012
0 answers
71 views
Any clue why the callout looks messed up here:  http://www.fronseetechnology.com/EnergyControlAdmin/Reports/EnergyCalculator.aspx

Go to the first text box in the first row of the Radgrid, remove the text and then tab, it will fire the requiredfield.  But notice the callout is messed up.  Any help here?  Thanks.
Joe
Top achievements
Rank 1
 asked on 04 Jan 2012
1 answer
122 views
I've got a basic radgrid like the following That starts out where some of the items are expanded and some are not
When the radbutton clicks, everything resets to expanded= false
I can easily reopen everything but I don't know how to capture when somebody collapses one of the categories before the radbutton click.
I am not seeing one here clientside api  Or is there some serverside event I can force to happen? I don't see a link to serverside api on the demo page.

thanks

<
telerik:RadGrid
    ID="RadGrid1" runat="server"  ShowHeader="false"
    AutoGenerateColumns="false"   
    OnDetailTableDataBind="RadGrid1_DetailTableDataBind"
    OnNeedDataSource="RadGrid1_NeedDataSource"
    GridLines="None"
    ShowStatusBar="true"  Width="300px"
    OnPreRender="RadGrid1_PreRender">
             
 
    <MasterTableView DataKeyNames="CategoryID"  AutoGenerateColumns="true" >
        <DetailTables>
            <telerik:GridTableView Name="Filters"  AutoGenerateColumns="true">
                    <ItemTemplate>
                        <telerik:RadButton Text='<%# Eval("FilterName") %>' runat="server" CategoryID='<%# Eval("CategoryID") %>' FilterID='<%# Eval("FilterID") %>' OnClick="Im_Clicked"  />
                     
                        .....'<%# Eval("CategoryID")%>'
                    </ItemTemplate>
            </telerik:GridTableView>
        </DetailTables>
 
 
        <Columns>
            <telerik:GridBoundColumn DataField="CategoryName" />
        </Columns>
    </MasterTableView>          
             
</telerik:RadGrid>
Steven
Top achievements
Rank 1
 answered on 04 Jan 2012
4 answers
142 views
Hi Folks,

I've come across a problem with the RadGrid where after rebinding, the child columns of an auto-generated hierarchy grid do not update with the new column specifications from the data bind (because the columns are changing in the pivoted data).

Below is the definition of the RadGrid. As you can see the columns are not defined and instead generated automatically on binding (given that they are not known until after having been bound, and does also change depending on the pivot grouping query)

<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="ObjectDataSource1" OnColumnCreated="RadGrid1_ColumnCreated" OnItemCreated="RadGrid1_ItemCreated" OnItemDataBound="RadGrid1_ItemDataBound">
    <MasterTableView HierarchyDefaultExpanded="false" HierarchyLoadMode="Client" AllowSorting="false" DataKeyNames="TypeId, ParentTypeId" Width="100%">
        <SelfHierarchySettings ParentKeyName="ParentTypeId" KeyName="TypeId" />
    </MasterTableView>
    <ClientSettings AllowExpandCollapse="true" />
</telerik:RadGrid>

As an example, if the grid is initially bound using pivoted data grouped by year (say 2009, 2010 and 2011 columns - as well as TypeId, ParentTypeId and a row description field) then a rebind occurs where the new pivoted data is grouped by month, the mastertable autogeneratedcolumns will be correct (say Jan09, Feb09... Dec11 etc) however each of the nested view columns will contain the original year grouped columns (2009, 2010, 2011 etc).

I've spent days searching for anyone with a similar problem but can't find anything. Is there anyway to force the nested views to rebind when the grid/mastertableview rebinds? Or is there any way to flush the existing autogenerated nested view columns so they will be regenerated during the rebind?

The problem that this rebinding issue creates is such that if the pivot query is continued to be grouped by year but the period changes (such that say 2009 is no longer returned in the result dataset), the table header will update correctly, however the expanded nested view will not be aligned as it leaves space as if 2009 is still there. In the generated HTML the extra <td> can be seen in the row. This is even more obvious when multiple years are removed. I have 'got around' the first problem by simply iterating over the nested view columns and hiding any child columns that should no longer be shown. However, if the grouping period for the pivot query is changed (to by the month instead of year) as previously stated, the auto-generated nested view columns remain with the original year column definitions and as such NO data is shown in the grid given that the columns no longer have anything to match to when binding.

Please let me know if you need any additional information.

Cheers,

Andrew
ANDREW
Top achievements
Rank 1
 answered on 04 Jan 2012
1 answer
99 views
Is it possible (maybe with pre-render) to change the default view to "group by" (column of choice).

Hope that makes sense. Thanks!

mike
Michael
Top achievements
Rank 1
 answered on 03 Jan 2012
2 answers
256 views
When I click the Submit Button, I'm getting this error:
Script control 'Window' is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors().
Parameter name: scriptControl


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="admin_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">
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server">
    </telerik:RadStyleSheetManager>
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server"/>
     
    <div>
 
 
    <table>
        <tr>
            <td>
            </td>
            <td>
                <asp:Label runat="server" ID="admin_header" Text='<%#Eval("s_title")%>' Font-Bold="true"
                    Font-Names="verdana" Font-Size="Medium" ForeColor="White" ToolTip='<%#Eval("s_title")%>'></asp:Label>
            </td>
            <td>
            </td>
        </tr>
        <tr>
            <td width="761" align="right">
                <asp:FormView ID="fv1" DataSourceID="SqlDataSource1" runat="server" DataKeyNames="cid" DefaultMode="edit">
                    <EditItemTemplate>
                        <div align="left">
                            <asp:Label ID="Label1" runat="server" Text="Page Name:" CssClass="content_text_left_bold"></asp:Label><br />
                            <asp:TextBox ID="s_page_name" runat="server" Text='<%#Bind("s_page_name")%>' Width="761" />
                            <asp:Label ID="Label2" runat="server" Text="Title:" CssClass="content_text_left_bold"></asp:Label><br />
                            <asp:TextBox ID="s_title" runat="server" Text='<%#Bind("s_title")%>' Width="761" />
                            <asp:Label ID="Label4" runat="server" Text="Meta Keywords:" CssClass="content_text_left_bold"></asp:Label><br />
                            <asp:TextBox ID="s_meta_keywords" runat="server" Text='<%#Bind("s_meta_keywords")%>'
                                Width="761" Rows="4" Wrap="true" TextMode="MultiLine" />
                            <asp:Label ID="Label5" runat="server" Text="Meta Description:" CssClass="content_text_left_bold"></asp:Label><br />
                            <asp:TextBox ID="s_meta_description" runat="server" Text='<%#Bind("s_meta_description")%>'
                                Width="761" Rows="4" Wrap="true" TextMode="MultiLine" />
                            <div>
                                <div>
                                    <telerik:RadEditor ID="RadEditor1" runat="server"
                                        ImageManager-UploadPaths="/images/content/"
                                        ImageManager-DeletePaths="/images/content/"
                                        ImageManager-ViewPaths="/images/content/"
                                        Content='<%# Bind("page_content") %>'
                                        Height="800px" Width="690px"
                                        ContentAreaCssFile="~/admin/ContentAreaStyleSheet.css"
                                        OnClientLoad="OnClientLoad"
                                        ContentFilters="FixEnclosingP">
                                        <FontNames>
                                            <telerik:EditorFont Value="Arial" />
                                            <telerik:EditorFont Value="Baskerville Old Face" />
                                            <telerik:EditorFont Value="Bookman old style" />
                                            <telerik:EditorFont Value="Calibri" />
                                            <telerik:EditorFont Value="Century Gothic" />
                                            <telerik:EditorFont Value="Comic Sans MS" />
                                            <telerik:EditorFont Value="Constontia" />
                                            <telerik:EditorFont Value="Cooper Black" />
                                            <telerik:EditorFont Value="Courier New" />
                                            <telerik:EditorFont Value="Garamond" />
                                            <telerik:EditorFont Value="Georgia" />
                                            <telerik:EditorFont Value="Lucida Sans" />
                                            <telerik:EditorFont Value="Lucida Sans Unicode" />
                                            <telerik:EditorFont Value="MS Sans Serif" />
                                            <telerik:EditorFont Value="Segoe UI" />
                                            <telerik:EditorFont Value="Tahoma" />
                                            <telerik:EditorFont Value="Times New Roman" />
                                            <telerik:EditorFont Value="Verdana" />
                                        </FontNames>
                                    </telerik:RadEditor>
                                </div>
                                 
 
                            <asp:Button ID="Button1" runat="server" Text="Submit Changes" CommandName="update" />
                        </div>
                    </EditItemTemplate>
                </asp:FormView>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                    ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"
                    SelectCommand="SELECT * FROM [content]where cid=@cid"
                    UpdateCommand="UPDATE [content] SET [page_content] = @page_content, [s_title] = @s_title, [s_meta_keywords] =@s_meta_keywords, [s_meta_description] =@s_meta_description, [s_page_name] =@s_page_name WHERE cid=@cid"
                    CancelSelectOnNullParameter="false">
                    <SelectParameters>
                        <asp:QueryStringParameter Name="cid" Type="string" QueryStringField="cid" />
                    </SelectParameters>
                </asp:SqlDataSource>
            </td>
            <td>
            </td>
        </tr>
        <tr>
            <td>
            </td>
            <td>
            </td>
            <td>
            </td>
        </tr>
    </table>
    </div>
<script type="text/javascript">
    function OnClientLoad(editor) {
        var tool = editor.getToolByName("ForeColor");
 
        //Add the button to the color picker            
        tool.old_renderFooter = tool.renderFooter;
        tool.renderFooter = function () {
            this.old_renderFooter();
            //Create a button and add it to the tool
            var button = document.createElement("button");
            button.innerHTML = "Add custom color..";
            button.onclick = showColorDialog;
            this.get_popupElement().appendChild(button);
        }
 
        function showColorDialog() {
            var myCallbackFunction = function (sender, color) {
                var colors = tool.get_items();
 
                //If no colors are set get the colors from the editor
                if (colors.length == 0) {
                    colors = editor.get_colors();
                }
 
                colors[colors.length] = color;
                tool.set_items(colors);
                //Set the color to the current selection
                editor.get_document().execCommand("ForeColor", false, color);
            }
 
            //Hide the color picker
            tool.hide();
 
            //Show the Custom Color dialog
            editor.showExternalDialog(
                      'ForeColorDialog.aspx',
                      null,
                      600,
                      400,
                      myCallbackFunction,
                      null,
                      'ForeColor',
                      true,
                      Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move,
                      false,
                      false);
        }
    };
</script>
    <telerik:RadAjaxManager runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadEditor1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadEditor1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
     
 
 
    </form>
</body>
</html>
Web.Config
<configuration>
    <connectionStrings>
        <add name="ConnectionString" connectionString="Data Source=SQL2008;Initial Catalog=121212;Persist Security Info=True;User ID=121212;Password=121212" providerName="System.Data.SqlClient" />
    </connectionStrings>
    <location path="Telerik.Web.UI.WebResource.axd">
        <system.web>
            <authorization>
                <allow users="*"/>
            </authorization>
        </system.web>
    </location>
    <system.web>
        <compilation debug="true" targetFramework="4.0">
            <assemblies>
                <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
                <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
                <add assembly="System.Speech, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            </assemblies>
        </compilation>
        <customErrors mode="Off" />
        <httpHandlers>
            <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
            <add path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" validate="false" />
            <add path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false" />
        </httpHandlers>
    </system.web>
    <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
        <handlers>
            <add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" />
            <add name="Telerik_Web_UI_SpellCheckHandler_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" />
            <add name="Telerik_Web_UI_DialogHandler_aspx" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" />
        </handlers>
    </system.webServer>
    </configuration>

M
Top achievements
Rank 1
 answered on 03 Jan 2012
1 answer
85 views
Hi all, I have an usercontrol that contains a treeview, a toolbar and a radwindow.
My goal is simple: when the user clicks on a toolbar button, I want to prompt the user for a node name (using the radwindow), and then begin an ajaxRequest that should add the node to the treeview.
I am not able to get the last step to work.
When I invoke ajaxMan.ajaxRequest from client, the request is correctly handled by the server and the node is added to the treeview, BUT it doesn't show up on the client.
I also tried to wrap the treeview in a RadAjaxPanel, but then I am not able to refresh it server-side.
Any ideas?
Thanks!
Richard
Top achievements
Rank 1
 answered on 03 Jan 2012
1 answer
39 views
I have 4 radlistbox with fixed width and that works fine in IE9,,whenever i execute it in IE 7/8 and IE9 compatiibtiy view these radlistbox width is set back to '0' and my radlistbox get shrinked.....Can anyone help with this issue...


Thanks in advance


Thanks & Regards
Rakesh Patel
Mark Herried
Top achievements
Rank 1
 answered on 03 Jan 2012
3 answers
191 views
I notice in many of your example the cursor will change to a rotating circle, but I don't see any code that's different than my code that doesn't produce the wait cursor. Please what the code top display the rotating cursor.
John
Richard
Top achievements
Rank 1
 answered on 03 Jan 2012
1 answer
77 views
I have a page i am building that I am using a Checkbox to allow the user to see all sales reps "Select * from sales" or if it's not checked "Select * from sales where isnull(term_date)"  I have kind of went through a lot of the postings, but I never found would that kind of matched this scenario.  Should I be searching for firing the postback from the checkbox since that is what is causeing the change?  I will look for that but not sure how I will code it yet.
Stephan
Top achievements
Rank 1
 answered on 03 Jan 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?