Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
123 views
Hi,

I have a page that has a normal asp button and a radgrid. My radgrid uses the NeedDataSource command which is used because my radgrid has paging. However, when my page loads, the needdatasource will trigger and bind my radgrid with data. Is there any way I can load my page and not have the grid bind anything until the user clicks the button thats on my page?

In other words when the page is loaded, the radgrid will be empty, and only have data when the user clicks the button. It works if I remove the needdatasource, but I need this because of my paging. Any advice?

Thanks!
Daniel
Telerik team
 answered on 07 Apr 2011
3 answers
209 views
I need a grid where all rows are in Edit Mode. Then I want  with Update button all rows to updateWhat should I add in code-behind?
<body>
    <form id="form1" runat="server">
    <div>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
 
 
 
 
<telerik:RadGrid ID="RadGrid1" runat="server" AllowAutomaticUpdates="True"
            CellSpacing="0" DataSourceID="SqlDataSource1" GridLines="None">
<MasterTableView AutoGenerateColumns="False" CommandItemDisplay="Top" DataKeyNames="id"
                DataSourceID="SqlDataSource1">
<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>
 
    <Columns>
        <telerik:GridBoundColumn DataField="id" DataType="System.Int32"
            FilterControlAltText="Filter id column" HeaderText="id" ReadOnly="True"
            SortExpression="id" UniqueName="id">
        </telerik:GridBoundColumn>
        <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn column"
            HeaderText="f1" UniqueName="f1">
            <ItemTemplate>
                <telerik:RadTextBox ID="RadTextBox1" Runat="server" Text='<%# Bind("f1") %>'
                    Width="125px">
                </telerik:RadTextBox>
            </ItemTemplate>
        </telerik:GridTemplateColumn>
        <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn1 column"
            HeaderText="f2" UniqueName="f2">
            <ItemTemplate>
                <telerik:RadNumericTextBox ID="RadNumericTextBox1" Runat="server"
                    Culture="de-DE" DbValue='<%# Bind("f2") %>' Width="125px">
                </telerik:RadNumericTextBox>
            </ItemTemplate>
        </telerik:GridTemplateColumn>
    </Columns>
 
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
    <CommandItemTemplate>
         <asp:LinkButton ID="btnUpdateEdited" runat="server" CommandName="UpdateEdited" >Update</asp:LinkButton>
    </CommandItemTemplate>
</MasterTableView>
 
<FilterMenu EnableImageSprites="False"></FilterMenu>
 
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
        </telerik:RadGrid>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server"
            ConnectionString="<%$ ConnectionStrings:webzeus %>"
            SelectCommand="SELECT * FROM [TestTable]"
            UpdateCommand="UPDATE [TestTable] SET [f1] = @f1, [f2] = @f2  WHERE [id] = @original_id ">
            <UpdateParameters>
                <asp:Parameter Name="f1" Type="String" />
                <asp:Parameter Name="f2" Type="Int16" />
                <asp:Parameter Name="original_id" Type="Int16" />
            </UpdateParameters>           
            </asp:SqlDataSource>
    </div>
    </form>
</body>
Thanks, Evgeny
Princy
Top achievements
Rank 2
 answered on 07 Apr 2011
2 answers
162 views
I am trying to change the color of a disabled rad tree node to something other then the default.  I attempted the following

.Custom{
    color:red !important;
}
 
Protected Sub rtvNav_NodeDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadTreeNodeEventArgs) Handles rtvNav.NodeDataBound
        e.Node.Enabled = False
        e.Node.DisabledCssClass = "Custom"
    End Sub

but this did not override the color, i.e. the node is still gray.  I found the following post http://www.telerik.com/community/forums/aspnet-ajax/treeview/disabled-node-font-color.aspx but it is almost two years old and not sure if it still applies.  The solution is problematic for me as well.  The solution says to define 

.RadTreeView_Default .rtDisabled .rtIn
{
    color: black !important;
}

Problems:
1.  The user is allowed to select their own theme so I'd have to define this for all of Telerik's themes
2.  I only want to apply this to a specific tree in my application and not all the trees in my application.  There could be multiple trees on the same page, one with the new style, and multiple that should behave in the default way (i.e. disabled nodes grey).

What can I do to get disabled nodes to color differently in one situation and not the next?
Nikolay Tsenkov
Telerik team
 answered on 07 Apr 2011
2 answers
189 views
I'm seeing some weird behavior with the SelectedValue in the RadComboBox not being properly rendered as "selected" when the page is initially loaded.  Instead of the SelectedValue being shown in the dropdown menu, the first item in the RadComboBox is "selected."  Through debugging, I have verified that the SelectedValue propery *is* set correctly when the page loads.  Additionally, if I click on the combobox and click off, it scrolls down to the correct value and selects it.  Therefore, I don't think it's an issue with the SelectedValue property not getting set.  I think it's an issue with the HTML and java-script not rendering the control properly on the initial page load.

To give some context, this RadComboBox is inside of a User Control that gets dynamically loaded into a RadTabStrip/RadMultiPage at runtime.  The issue happens regardless of whether the RadComboBox is populated/bound directly on the ascx control or programatically on the code-behind for the control.

From the DOM inspector built into Firefox, here is the HTML source of the control when I first click on the tab for this page:

    <div id="ctl00_bodyContent_beneficiaryinfo_ddlJurisdictionId" class="RadComboBox RadComboBox_Web20" skinspath="~/RadControls/ComboBox/Skins" style="width: 150px;">
    <table class="" summary="combobox" style="border-width: 0pt; border-collapse: collapse;">
        <tbody><tr>
            <td style="width: 100%;" class="rcbInputCell rcbInputCellLeft"><input autocomplete="off" name="ctl00$bodyContent$beneficiaryinfo$ddlJurisdictionId" class="rcbInput" id="ctl00_bodyContent_beneficiaryinfo_ddlJurisdictionId_Input" value="(select one)" type="text"></td>
            <td class="rcbArrowCell rcbArrowCellRight"><a id="ctl00_bodyContent_beneficiaryinfo_ddlJurisdictionId_Arrow" style="overflow: hidden; display: block; position: relative; outline: medium none;">select</a></td>
 
        </tr>
    </tbody></table>
    <div class="rcbSlide" style="z-index: 6000;"><div id="ctl00_bodyContent_beneficiaryinfo_ddlJurisdictionId_DropDown" class="RadComboBoxDropDown RadComboBoxDropDown_Web20 " style="display: none;"><div class="rcbScroll rcbWidth" style="height: 100px; width: 100%;"><ul class="rcbList" style="list-style: none outside none; margin: 0pt; padding: 0pt;"><li class="rcbItem ">(select one)</li><li class="rcbItem ">None</li><li class="rcbItem ">Alabama</li><li class="rcbItem ">Alaska</li><li class="rcbItem ">Arizona</li><li class="rcbItem ">Arkansas</li><li class="rcbItem ">California</li><li class="rcbItem ">Colorado</li><li class="rcbItem ">Connecticut</li><li class="rcbItem ">Delaware</li><li class="rcbItem ">District of Columbia</li><li class="rcbItem ">Florida</li><li class="rcbItem ">Georgia</li><li class="rcbItem ">Hawaii</li><li class="rcbItem ">Idaho</li><li class="rcbItem ">Illinois</li><li class="rcbItem ">Indiana</li><li class="rcbItem ">Iowa</li><li class="rcbItem ">Kansas</li><li class="rcbItem ">Kentucky</li><li class="rcbItem ">Louisiana</li><li class="rcbItem ">Maine</li><li class="rcbItem ">Maryland</li><li class="rcbItem ">Massachusetts</li><li class="rcbItem ">Michigan</li><li class="rcbItem ">Minnesota</li><li class="rcbItem ">Mississippi</li><li class="rcbItem ">Missouri</li><li class="rcbItem ">Montana</li><li class="rcbItem ">Nebraska</li><li class="rcbItem ">Nevada</li><li class="rcbItem ">New Hampshire</li><li class="rcbItem ">New Jersey</li><li class="rcbItem ">New Mexico</li><li class="rcbItem ">New York</li><li class="rcbItem ">North Carolina</li><li class="rcbItem ">North Dakota</li><li class="rcbItem ">Ohio</li><li class="rcbItem ">Oklahoma</li><li class="rcbItem ">Oregon</li><li class="rcbItem ">Pennsylvania</li><li class="rcbItem ">Rhode Island</li><li class="rcbItem ">South Carolina</li><li class="rcbItem ">South Dakota</li><li class="rcbItem ">Tennessee</li><li class="rcbItem ">Texas</li><li class="rcbItem ">Utah</li><li class="rcbItem ">Vermont</li><li class="rcbItem ">Virginia</li><li class="rcbItem ">Washington</li><li class="rcbItem ">West Virginia</li><li class="rcbItem ">Wisconsin</li><li class="rcbItem ">Wyoming</li></ul></div></div></div><input value="{"logEntries":[],"value":"34","text":"(select one)","enabled":true}" autocomplete="off" id="ctl00_bodyContent_beneficiaryinfo_ddlJurisdictionId_ClientState" name="ctl00_bodyContent_beneficiaryinfo_ddlJurisdictionId_ClientState" type="hidden">
 
</div>


Here is the HTML source of the control if I simply click on the combobox and then click off (without selecting a new value):

    <div id="ctl00_bodyContent_beneficiaryinfo_ddlJurisdictionId" class="RadComboBox RadComboBox_Web20" skinspath="~/RadControls/ComboBox/Skins" style="width: 150px;">
    <table class="" summary="combobox" style="border-width: 0pt; border-collapse: collapse;">
        <tbody><tr>
            <td style="width: 100%;" class="rcbInputCell rcbInputCellLeft"><input autocomplete="off" name="ctl00$bodyContent$beneficiaryinfo$ddlJurisdictionId" class="rcbInput" id="ctl00_bodyContent_beneficiaryinfo_ddlJurisdictionId_Input" value="(select one)" type="text"></td>
            <td class="rcbArrowCell rcbArrowCellRight"><a id="ctl00_bodyContent_beneficiaryinfo_ddlJurisdictionId_Arrow" style="overflow: hidden; display: block; position: relative; outline: medium none;">select</a></td>
 
        </tr>
    </tbody></table>
    <input value="{"logEntries":[],"value":"","text":"Nebraska","enabled":true}" autocomplete="off" id="ctl00_bodyContent_beneficiaryinfo_ddlJurisdictionId_ClientState" name="ctl00_bodyContent_beneficiaryinfo_ddlJurisdictionId_ClientState" type="hidden">
</div>

Notice how "Nebraska" (the SelectedValue in this case) is properly selected as the state in the 2nd example.

Here is the code that is setting the SelectedValue:

if (ddlJurisdictionId.Items.FindItemByValue(JurisdictionId.ToString()) != null)
{
    ddlJurisdictionId.SelectedValue = JurisdictionId.ToString();
}
else
{
    ddlJurisdictionId.Items[0].Selected = true;
}

I am seeing this exact behavior in *every* browser I've tried (IE8, Firefox 3.6.8, Chrome 10.0.648.133).  I am developing using version 2011_1_315 of the RadControls.  If I use an asp.net DropDownList in place of the RadComboBox, this issue does *not* happen.

Any ideas what would cause this?
Dimitar Terziev
Telerik team
 answered on 07 Apr 2011
2 answers
124 views
Hi,
I'm having trouble with AJAX (yet again).
I have a RadAjaxManager on the master page which is meant to ajaxify a panel:
<telerik:RadAjaxManager ID="DarRadAjaxManager" DefaultLoadingPanelID="DarRadAjaxLoadingPanel" runat="server">       
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="MainPagePanel">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="MainPagePanel" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>

Inside the panel is a RadTabstrip which has a SiteMap as a Datasource:
<asp:Panel ID="MainPagePanel" CssClass="mainBody" runat="server">
    <telerik:RadTabStrip ID="DARRadTabStrip" runat="server" DataSourceID="ApplicationSiteMap" CausesValidation="false">
    </telerik:RadTabStrip>
 
    <asp:SiteMapDataSource ID="ApplicationSiteMap" runat="server"
                            SiteMapProvider="XmlSiteMapProvider"
                            ShowStartingNode="False" />
 
    <asp:ContentPlaceHolder id="MainContentPlaceHolder" runat="server">
    </asp:ContentPlaceHolder>
</asp:Panel>

It all works fine. There's just no ajax. A quick call to the IsAjaxRequest method of the RadAjaxManager proved that.

How can I get that working with Ajax?
David
Top achievements
Rank 1
 answered on 07 Apr 2011
14 answers
1.6K+ views
Hello,

I am using the 

telerik:RadAjaxManager

in my main.aspx page which, in turn, loads usercontrols. In my usercontrol I have a 

RadTabStrip

which also calls other usercontrols which i also want  AJAXified. So I'm trying the RadAjaxManagerProxy but as soon as I put in my user control I get this error message:

Server Error in '/' Application.
--------------------------------------------------------------------------------

Collection was modified; enumeration operation may not execute.

Any clues?

Thank you

Bodevain Svensson
Top achievements
Rank 1
 answered on 07 Apr 2011
2 answers
250 views
Is it possible to add an event handler to the grid (e.g. for the RowSelected event) from the client-side javascript?

Example:

<telerik:RadGrid ID="grid" runat="server" ...>
    ...
    <ClientSettings>
        <ClientEvents OnGridCreated="gridCreated" />
    </ClientSettings>
</telerik:RadGrid>
...
<script>
function gridCreated(sender, eventArgs) {
    if (someCondition) {
        //
        Can I add function rowSelected() as a handler to
        the grid's OnRowSelected event?
        //
    }
}
 
function rowSelected(sender, eventArgs) {
    // do stuff
}

I tried calling the grid's add_rowSelected() function, but couldn't get it to work.
Thanks for your help.

-Martin
Martin
Top achievements
Rank 1
 answered on 07 Apr 2011
1 answer
123 views
What I have is a grid that I am loading questions with a asp radiobutton with a go or a no\go.  I have a set of questions and then some question might have sub questions that i load into the grid.  a nested radgrid with the main question and sub questions.  What I need to happen if a sub question radio button is picked as a no\go I need the main question button to automatically be changed to a no\go as well.  Is this possible with a nested grid.  Here is an example of my radgrid.  I also need to save all of them to a table with the question answer on a asp submit button, how do you itterate through the main and then sub tables to save the information.


<table width="100%">
                <tr>
                    <td align="center"><telerik:RadGrid ID="RadGrid2" runat="server" CellSpacing="0" GridLines="both" Skin="WebBlue" Width="90%" GroupingSettings-ShowUnGroupButton="false"  >
                        <MasterTableView AutoGenerateColumns="false" DataKeyNames="intQuestionID">
                            <Columns>
                                <telerik:GridBoundColumn DataField="strQuestion" HeaderText="Question" UniqueName="strQuestion" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Left" />
                                <telerik:GridTemplateColumn HeaderText="GO\NOGO" HeaderStyle-HorizontalAlign="Center" ShowSortIcon="True" Visible="True">
                                    <ItemTemplate>
                                        <asp:RadioButtonList ID="rblAnswer" runat="server" RepeatDirection="Horizontal" TextAlign="Right" CellPadding="5" >
                                            <asp:ListItem Value="0">GO</asp:ListItem>
                                            <asp:ListItem Value="1">NO\GO</asp:ListItem>
                                        </asp:RadioButtonList>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn HeaderText="Data" HeaderStyle-HorizontalAlign="Center">
                                    <ItemTemplate>
                                        <telerik:RadTextBox runat="server" Width="100"></telerik:RadTextBox>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                 <telerik:GridTemplateColumn HeaderText="Remarks" HeaderStyle-HorizontalAlign="Center">
                                    <ItemTemplate>
                                        <telerik:RadTextBox ID="txtRemarks" runat="server" Width="100"></telerik:RadTextBox>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn HeaderText="Date" HeaderStyle-HorizontalAlign="Center">
                                      <ItemTemplate>
                                        <telerik:RadDatePicker ID="radDate" runat="server"></telerik:RadDatePicker>
                                      </ItemTemplate>
                                </telerik:GridTemplateColumn>
                            </Columns>
                            <DetailTables>
                                <telerik:GridTableView Name="RadGrid2Sub" runat="server" DataKeyNames="intsubQID" TableLayout="Fixed" AutoGenerateColumns="false">
                                    <ParentTableRelation>
                                        <telerik:GridRelationFields DetailKeyField="intQuestionID" MasterKeyField="intQuestionID" />
                                    </ParentTableRelation>
                                    <Columns>
                                        <telerik:GridBoundColumn DataField="strSubQ" HeaderText="Sub-Question" UniqueName="strSubQ" HeaderStyle-HorizontalAlign="Center" />
                                         <telerik:GridTemplateColumn HeaderText="GO\NOGO" HeaderStyle-HorizontalAlign="Center" ShowSortIcon="True" Visible="True">
                                            <ItemTemplate>
                                                <asp:RadioButtonList ID="rblAnswer2" runat="server" RepeatDirection="Horizontal" TextAlign="Right" CellPadding="5" >
                                                    <asp:ListItem Value="0">GO</asp:ListItem>
                                                    <asp:ListItem Value="1">NO\GO</asp:ListItem>
                                                </asp:RadioButtonList>
                                            </ItemTemplate>
                                        </telerik:GridTemplateColumn>
                                    </Columns>
                                    </telerik:GridTableView>
                            </DetailTables>
                        </MasterTableView>
                    </telerik:RadGrid></td>
                </tr>
            </table>
Marin
Telerik team
 answered on 07 Apr 2011
1 answer
444 views
Has anything improved with Q1 2011 on filtering of Enums ?

Unfortunately it's quite common to use eNums in C# and to need to bind objects containing enum properties to the Telerik grid.

Whilst the values display ok in the grid the filters offer integer choices only rather than a selection list of the string equivalents. Also when editing values in cells it is the integer values that are requested (unfamiliar to the users of a system).

Martin
Veli
Telerik team
 answered on 07 Apr 2011
1 answer
133 views
I installed the developer version of Ajax control over the demo version and I still get a Trial Noticiation. How can I remove this?
Sebastian
Telerik team
 answered on 07 Apr 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?