Telerik Forums
UI for ASP.NET AJAX Forum
6 answers
552 views
Hello,

I have a RadUpload control on a web form.  However, I'm storing a lot of additional information with regard to the file that is being uploaded in additional text boxes, combo boxes, etc.  Some of these values cause the page to post back, which normally would be fine because all of the information get's put into ViewState.  However, every time the page posts back, the Upload control loses the file that was selected and I have to select the file again.

Is there a way to preserve the value of the file selected between post backs?

Thanks,
Warren
July
Top achievements
Rank 2
 answered on 22 Jul 2011
5 answers
207 views
I have a RadListBox, where, inside the ItemTemplate, I have a RadComboBox, another RadComboBox, and a RadTextBox.  Based on the selected value in the first RadComboBox (captured in ClientSelectedIndexChanged), I want to show or hide the other controls.  That is, if the value in the first RadComboBox is "apple," I want to show the second RadComboBox and hide the RadTextBox.  However, if the value in the first RadComboBox is "banana," I want to hide the second RadComboBox and show the RadTextBox.

What is the normal way of doing this from this event handler?

Thanks
KN425000
Top achievements
Rank 1
 answered on 22 Jul 2011
4 answers
228 views
Hello,

I'm trying to implement dynamic conditional formatting in the RadGrid.  The conditional formatting settings are supplied dynamically as a collection of filters that I need to apply on the server and have the grid display the corresponding styling.  I can't find any relevant documentation that could enable me to do so.  There's this example:
protected void RadGrid1_ItemDataBound(object sender, Telerik.WebControls.GridItemEventArgs e)
{
     //Is it a GridDataItem
     if (e.Item is GridDataItem)
     {
           //Get the instance of the right type
           GridDataItem dataBoundItem = e.Item as GridDataItem;
 
           //Check the formatting condition
             if (int.Parse(dataBoundItem["Size"].Text) > 100 )
           {
                 dataBoundItem[ "Received"].ForeColor = Color.Red;
                 dataBoundItem[ "Received"].Font.Bold = true;
                 //Customize more...
           }
     }
}

But the problem is that I don't know if it will be one boolean clause or three.  So the condition may be "Title == "Home"" or it could be "Title == Home AND Amount <= 10"  So I need to be able to dynamically build out the filter conditions.

I tried using the OnRowDataBound client side event and construct the javascript dynamically in C#, but the event is not firing because I'm not binding on the client side, but in the OnNeedDataSource event.

Any ideas?
Dasha
Top achievements
Rank 1
 answered on 22 Jul 2011
2 answers
219 views
I have a RadGrid (along with a RadAjaxManager). The version is 2010.1.415.35

There is a 'Refresh' button on the page, which eventually calls __doPostBack.
Everything was working fine until I upgraded the website from .NET 3.5 to 4.0.
But now, after the AJAX call sender.get_masterTableView() returns null in the GridDestroying function.

Is there a fix for this version?

Attila
 
<telerik:RadGrid 
            ID="grid"
            CellPadding="1"
            CellSpacing="0"
            EnableEmbeddedSkins="false"
            AlternatingItemStyle-Height="20"
            ItemStyle-Height="20"
            ShowFooter="True"
            AllowSorting="False"            
            runat="server"
            EnableEmbeddedBaseStylesheet="false"
            AutoGenerateColumns="false"
            AllowMultiRowEdit="true"
            GridLines="None"
            Width="100%"            
            ExportSettings-FileName="Summary"
            ExportSettings-Excel-FileExtension="xls"
            ExportSettings-Excel-Format="HTML"
            ExportSettings-OpenInNewWindow="true"
            ExportSettings-ExportOnlyData="true"             
            ExportSettings-IgnorePaging="true">             
            <ClientSettings>
                <Scrolling AllowScroll="True" UseStaticHeaders="true" />
            </ClientSettings>             
            <HeaderContextMenu EnableEmbeddedSkins="False"></HeaderContextMenu>
        <MasterTableView 
                ClientDataKeyNames="ROW_ID"
                DataKeyNames="ROW_ID"
                EditMode="InPlace"
                CommandItemDisplay="Bottom"
                AllowMultiColumnSorting="False"                
               >
            <EditFormSettings>
                <EditColumn InsertImageUrl="Update.gif" UpdateImageUrl="Update.gif" EditImageUrl="Edit.gif"
                    CancelImageUrl="Cancel.gif">
                </EditColumn>
            </EditFormSettings>
                <CommandItemTemplate>
                    <asp:Button ID="btnSave" runat="server" OnClientClick="AddNew();return false;" Text="Add" />  
                </CommandItemTemplate>
            </MasterTableView>
            <ClientSettings>
                <ClientEvents OnRowCreated="RowCreated" OnGridCreated="GridCreated" OnRowClick="RowClick" OnRowContextMenu="showMenu" OnColumnContextMenu="showHeaderMenu" OnCommand="RadGrid1_Command" OnGridDestroying="GridDestroying" />
            </ClientSettings>
        </telerik:RadGrid>

p
rotected override void RaisePostBackEvent( IPostBackEventHandler source, string eventArgument ) {     base.RaisePostBackEvent( source, eventArgument );     if ( source == this. )     {         if ( eventArgument.IndexOf( "Refresh" ) != -1 )         {             grid.Rebind();         }     } }

function GridDestroying(sender, eventArgs) {
    for (var i = 0; i < sender.get_masterTableView().get_dataItems().length; i++) {
        var curRow = sender.get_masterTableView().get_dataItems()[i];
        for (var j = 0; j < curRow.get_element().cells.length; j++) {
            var cell = curRow.get_element().cells[j];
            if (cell) {
                $clearHandlers(cell);
            }
        }
    }
}
Attila
Top achievements
Rank 1
 answered on 22 Jul 2011
1 answer
191 views
Hi,

i am Srinivas

In my project i have a RadTreeView to displays a nodes form Backend database. it shown in first attachment. Here i want to change the node back color based on the condition. it was executed successfully at first time when i expand the parent node. there after when i check on the  node then it displays the data in RadGrid successfully but it removes the Node BackColor automatically.  it shown in second attachment.

The following is the code for Change the Node Back Color.

Protected Sub RadTreeView1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadTreeView1.PreRender
    If Session("parentnode") Is Nothing Then
    Else
         Dim data As DataTable = GetChildNode(Session("parentnode").ToString())
        For Each row As DataRow In data.Rows
       Dim node As New RadTreeNode()
       If row("job_status").ToString() = "NS" Then
      node.BackColor = Color.LightSkyBlue
End If
Next

Please Help me

Thank You
D.Srinivas
Plamen
Telerik team
 answered on 22 Jul 2011
4 answers
196 views
In my Custom ContentProvider, is there a way to return an error string from StoreFile()?
Dobromir
Telerik team
 answered on 22 Jul 2011
3 answers
138 views
Is there a way to override default dialog settings, like the crop's height and width, so that I can force a particular height and width from the start?

Thanks,
Joe
Joseph Roberts
Top achievements
Rank 1
 answered on 22 Jul 2011
2 answers
166 views
Hi

Please how can I use image sprite to show icons of radtreeview and radpanelbar , I did it with radtoolbar and radmenu but I can't find
EnableSpriteImage property  of radtreeview and radpanelbar.

Thank you 
Kate
Telerik team
 answered on 22 Jul 2011
1 answer
630 views
I have a simple web page, with one RadGrid being populated by a combination of three SQL data sources. The code I use is shown below:
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<div>
    <telerik:RadGrid ID="rgdTLCarrierLocations" runat="server" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="True" CellSpacing="0" DataSourceID="sdsTLCarrierLocations" GridLines="None" ShowGroupPanel="True">
        <ClientSettings AllowDragToGroup="True">
        </ClientSettings>
        <MasterTableView DataKeyNames="CarrierLocation_ID" DataSourceID="sdsTLCarrierLocations" CommandItemDisplay="Bottom" PageSize="20">
            <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="CarrierLocation_ID" DataType="System.Int32" FilterControlAltText="Filter CarrierLocation_ID column" HeaderText="CarrierLocation_ID" ReadOnly="True" SortExpression="CarrierLocation_ID" UniqueName="CarrierLocation_ID" Visible="False">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="CarrierLocation_CarrierID" DataType="System.Int32" FilterControlAltText="Filter CarrierLocation_CarrierID column" HeaderText="CarrierLocation_CarrierID" ReadOnly="True" SortExpression="CarrierLocation_CarrierID" UniqueName="CarrierLocation_CarrierID" Visible="False">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="CarrierLocation_LocationID" DataType="System.Int32" FilterControlAltText="Filter CarrierLocation_LocationID column" HeaderText="CarrierLocation_LocationID" ReadOnly="True" SortExpression="CarrierLocation_LocationID" UniqueName="CarrierLocation_LocationID" Visible="False">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Carrier_Name" FilterControlAltText="Filter Carrier_Name column" HeaderText="Carrier" SortExpression="Carrier_Name" UniqueName="Carrier_Name" ReadOnly="True">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="LocationName" FilterControlAltText="Filter LocationName column" HeaderText="Location" ReadOnly="True" SortExpression="LocationName" UniqueName="LocationName">
                </telerik:GridBoundColumn>
                <telerik:GridDropDownColumn DataField="CarrierLocation_CarrierID" DataSourceID="sdsCarriers" FilterControlAltText="Filter column column" HeaderText="Carrier" ListTextField="Carrier_Name" ListValueField="Carrier_ID" SortExpression="Carrier_Name" UniqueName="column" Visible="False">
                </telerik:GridDropDownColumn>
                <telerik:GridDropDownColumn DataField="CarrierLocation_LocationID" DataSourceID="sdsTLLocations" FilterControlAltText="Filter column1 column" HeaderText="Location" ListTextField="LocationName" ListValueField="Location_ID" SortExpression="LocationName" UniqueName="column1" Visible="False">
                    <ItemStyle Width="200px" />
                </telerik:GridDropDownColumn>
            </Columns>
            <EditFormSettings>
                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                </EditColumn>
            </EditFormSettings>
        </MasterTableView>
        <FilterMenu EnableImageSprites="False">
        </FilterMenu>
        <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
        </HeaderContextMenu>
    </telerik:RadGrid>
</div>
<asp:SqlDataSource ID="sdsTLCarrierLocations" runat="server" ConflictDetection="CompareAllValues" ConnectionString="<%$ ConnectionStrings:LogisticsConnectionString %>" DeleteCommand="DELETE FROM [log].[TLCarrierLocation] WHERE [CarrierLocation_ID] = @original_CarrierLocation_ID" InsertCommand="INSERT INTO [log].[TLCarrierLocation] ([CarrierLocation_CarrierID], [CarrierLocation_LocationID]) VALUES (@CarrierLocation_CarrierID, @CarrierLocation_LocationID)" OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT [CarrierLocation_ID], [CarrierLocation_CarrierID], [CarrierLocation_LocationID], [Carrier].[Carrier_Name], [TLLocation].Location_City + ' (' + [TLLocation].Location_County + ', ' + [TLState].State_Name + ')' AS LocationName FROM [log].[TLCarrierLocation] INNER JOIN [log].[Carrier] ON Carrier_ID = CarrierLocation_CarrierID INNER JOIN [log].[TLLocation] ON Location_ID = CarrierLocation_LocationID INNER JOIN [log].[TLState] ON State_ID = Location_StateID" UpdateCommand="UPDATE [log].[TLCarrierLocation] SET [CarrierLocation_CarrierID] = @CarrierLocation_CarrierID, [CarrierLocation_LocationID] = @CarrierLocation_LocationID WHERE [CarrierLocation_ID] = @original_CarrierLocation_ID">
    <DeleteParameters>
        <asp:Parameter Name="original_CarrierLocation_ID" Type="Int32" />
    </DeleteParameters>
    <InsertParameters>
        <asp:Parameter Name="CarrierLocation_CarrierID" Type="Int32" />
    </InsertParameters>
    <UpdateParameters>
        <asp:Parameter Name="CarrierLocation_CarrierID" Type="Int32" />
        <asp:Parameter Name="CarrierLocation_LocationID" Type="Int32" />
        <asp:Parameter Name="original_CarrierLocation_ID" Type="Int32" />
    </UpdateParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="sdsTLLocations" runat="server" ConnectionString="<%$ ConnectionStrings:LogisticsConnectionString %>" SelectCommand="SELECT [Location_ID], [TLLocation].Location_City + ' (' + [TLLocation].Location_County + ', ' + [TLState].State_Name + ')' AS LocationName FROM [log].[TLLocation] INNER JOIN [log].[TLState] ON State_ID = Location_StateID"></asp:SqlDataSource>
<asp:SqlDataSource ID="sdsCarriers" runat="server" ConnectionString="<%$ ConnectionStrings:LogisticsConnectionString %>" SelectCommand="SELECT [Carrier_ID], [Carrier_Name] FROM [log].[Carrier] ORDER BY [Carrier_Name]"></asp:SqlDataSource>

Whenever I use this page to add a record I get the "Maximum request length exceeded" error. Does anybody have any ideas what could be causing this? I don't have this problem in any of my other pages, many of which are almost identical in layout/functionality.

Thanks in advance,

Jason
Daniel
Telerik team
 answered on 22 Jul 2011
1 answer
112 views

I have a context menu that I wish to show in response to a client-side click event. This works in IE9 but not in any earlier version, nor if in compatibility mode.

After a bit of digging, and tracing into the "show()" method it appears that the method is relying on the passed event object having a "target" property, which IE appears not to support (at least prior to IE9).  Instead, IE seems to use a property called "srcElement" instead.

So for the benegit of anyone else struggling with this, here's my patched code that now seems to work ok...

function onButtonClickToShowMenu(e) {
    if (!e.target && e.srcElement)
        e.target = e.srcElement;
    var menu = $find('mymenuId');
    menu.show(e);
}

Kate
Telerik team
 answered on 22 Jul 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?