Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
185 views
Dear Friends,

Is there a way we can freeze the last column or last n columns in a RAD Grid? I know we can do this for the first column but I have a business requirement that 1,2 and n, n-1 would appear frozen and other columns can contribute and move within an horizontal scrolling.
Doncho
Telerik team
 updated answer on 05 Oct 2022
1 answer
514 views

I have a RadGrid that displays some images from a database.  I'm trying to add a button to the grid that allows the user to download the image using the original file name and extension saved in the ImageName column.

 


<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSourceImageUpload" OnItemCommand="RadGrid1_ItemCommand"> <MasterTableView DataKeyNames="ImageID" DataSourceID="SqlDataSourceImageUpload" > <Columns> <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="download_file" UniqueName="download" ></telerik:GridButtonColumn> <telerik:GridBoundColumn DataField="ImageName" UniqueName="ImageName" ></telerik:GridBoundColumn> <telerik:GridBinaryImageColumn DataField="ImageData" ></telerik:GridBinaryImageColumn> </Columns> </MasterTableView>

 


                <asp:SqlDataSource ID="SqlDataSourceImageUpload" runat="server"
                                   ConnectionString="<%$ ConnectionStrings:123ConnectionString %>" 
                                   SelectCommand="SELECT * FROM [tbl_Images]" 
                                   DeleteCommand="DELETE FROM [tbl_Images] WHERE [ImageID] = @ImageID" 
                                   InsertCommand="INSERT INTO [tbl_Images] ([ImageData], [ImageName], [Text]) 
                                   VALUES (@ImageData, @ImageName, @Text)" 
                                   UpdateCommand="UPDATE [tbl_Images] SET [Text] = @Text WHERE [ImageID] = @ImageID">
                    <DeleteParameters>
                        <asp:Parameter Name="ImageID" Type="Int32" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:QueryStringParameter Name="IncidentID" QueryStringField="ID" Type="String" />
                        <asp:Parameter Name="Text" Type="String" />
                    </InsertParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="Text" Type="String" />
                        <asp:Parameter Name="ImageID" Type="Int32" />
                    </UpdateParameters>
                </asp:SqlDataSource>

I found this code online, and honestly not sure how to make it all work with what I'm trying to do.  I really feel like I'm over complicating this whole thing.  Is there an easy button I'm missing somewhere?

The ultimate goal is for the user to click a download button and have the image download using the ImageName field as the file name.

    Protected Sub RadGrid1_ItemCommand(sender As Object, e As GridCommandEventArgs)
        If e.CommandName = "download_file" Then
            Dim ditem As GridDataItem = CType(e.Item, GridDataItem)
            Dim filename As String = ditem("ImageName").Text
            Dim path As String = MapPath("/sample/" & filename)
            Dim bts As Byte() = System.IO.File.ReadAllBytes(path)
            Response.Clear()
            Response.ClearHeaders()
            Response.AddHeader("Content-Type", "Application/octet-stream")
            Response.AddHeader("Content-Length", bts.Length.ToString())
            Response.AddHeader("Content-Disposition", "attachment; filename=" & filename)
            Response.BinaryWrite(bts)
            Response.Flush()
            Response.[End]()
        End If
    End Sub


Attila Antal
Telerik team
 answered on 05 Oct 2022
1 answer
150 views

Hello!

I am trying to find a way to set RadMenu items' imageUrl via Javascript. Is that possible? By ImageUrl, I mean the image on the left of the menu (icons).

 

Thanks!

Johnny
Top achievements
Rank 3
Bronze
Iron
Iron
 answered on 05 Oct 2022
1 answer
199 views

Hi, I want to have a column in radgrid batch edit and that column can contain either a textbox or dropdown based on a condition of the binding dataset. How can I implement this?

Thanks

Attila Antal
Telerik team
 updated answer on 04 Oct 2022
1 answer
139 views

Hello,

I have a DataForm that is bound to a complex object.  Within this complex object we have sub-objects that are Lists<> of other objects.  How can I put a RadGrid inside the DataForm and have it bind to the sub-object List<>?

Doncho
Telerik team
 answered on 29 Sep 2022
1 answer
244 views

I have a Hierarchy grid where I need to save both master view and detail view changes using an external button. For each view it calls the OnBatchEditCommand method. 

I want to execute a method after completing all the BatchEditCommands. How can I do it?

 

Code
<script type="text/javascript">
        function OnBatchEditOpening(sender, args) {
            var columnName = args.get_columnUniqueName();

            if (columnName != "AcceptableValues") {
                args.set_cancel(true);
            }
        }

        function savePage(sender, args) {
            var pageIsValid = Page_ClientValidate();
            if (!pageIsValid) {
                args.set_cancel(true);
            }
            args.set_cancel(saveAllChanges());
        }

        function saveAllChanges() {
            var grid2 = $find("<%= RadGrid1.ClientID %>");
             
            var masterTable2 = grid2.get_masterTableView();
            var batchEditManager = grid2.get_batchEditingManager();
            
            var tables = [];
            tables.push(masterTable2);
            tables.push(grid2.get_detailTables()[0]);
            var isDirty = false;
            for (var i = 0; i < tables.length; i++) {
                if (batchEditManager.hasChanges(tables[i])) {
                    isDirty = true;
                    break;
                }
            }
            if (isDirty) {
                batchEditManager.saveAllChanges(tables);
            }
            return isDirty;
        }
    </script>

<telerik:RadGrid ID="RadGrid1" runat="server" RenderMode="Lightweight"
    OnPreRender="RadGrid1_PreRender"
    OnNeedDataSource="RadGrid1_NeedDataSource" OnBatchEditCommand="RadGrid1_BatchEditCommand" MasterTableView-EditMode="Batch" >
        <ClientSettings>
            <ClientEvents OnBatchEditOpening="OnBatchEditOpening" />
        </ClientSettings>
        <MasterTableView Name="Errors" DataKeyNames="ErrorType,ColumnFieldName,Value" EditMode="Batch" AutoGenerateColumns="false" HeirarchyLoadMode="client">
            <BatchEditingSettings  SaveAllHierarchyLevels="true" />
            <Columns>
                        <telerik:GridBoundColumn UniqueName="ErrorType" DataField="ErrorType" HeaderText="Error Type" ></telerik:GridBoundColumn>
                        <telerik:GridBoundColumn UniqueName="ExcelColumnCell" DataField="ExcelColumnCell" HeaderText="Excel Column/Cell"></telerik:GridBoundColumn>
                        <telerik:GridBoundColumn UniqueName="ColumnFieldName" DataField="ColumnFieldName" HeaderText="Column/Field Name" ></telerik:GridBoundColumn>
                        <telerik:GridBoundColumn UniqueName="Value" DataField="Value" HeaderText="Value"></telerik:GridBoundColumn>
                        <telerik:GridBoundColumn UniqueName="AcceptableValues" DataField="AcceptableValues" HeaderText="Acceptable Values"></telerik:GridBoundColumn>
                     </Columns>
            <DetailTables>
                <telerik:GridTableView DataMember="ErrorDetails" Name="ErrorDetails" DataKeyNames="ErrorType,ColumnFieldName,Value" EditMode="Batch" AutoGenerateColumns="false"
                     ShowHeader="false"
                     ShowFooter="false"
                     AllowPaging="false"
                     AllowFilteringByColumn="false"
                     GridLines="None"
                     BorderStyle="None"
                     BatchEditingSettings-EditType="Cell"
                    HeirarchyLoadMode="client">  
                    <ParentTableRelation>
                        <telerik:GridRelationFields DetailKeyField="ErrorType" MasterKeyField="ErrorType" />
                        <telerik:GridRelationFields DetailKeyField="ColumnFieldName" MasterKeyField="ColumnFieldName" />
                        <telerik:GridRelationFields DetailKeyField="Value" MasterKeyField="Value" />
                     </ParentTableRelation>
                    <Columns>
                        <telerik:GridBoundColumn UniqueName="ErrorType" DataField="ErrorType" HeaderText="Error Type" ></telerik:GridBoundColumn>
                        <telerik:GridBoundColumn UniqueName="ExcelColumnCell" DataField="ExcelColumnCell" HeaderText="Excel Column/Cell"></telerik:GridBoundColumn>
                        <telerik:GridBoundColumn UniqueName="ColumnFieldName" DataField="ColumnFieldName" HeaderText="Column/Field Name" ></telerik:GridBoundColumn>
                        <telerik:GridBoundColumn UniqueName="Value" DataField="Value" HeaderText="Value"></telerik:GridBoundColumn>
                        <telerik:GridBoundColumn UniqueName="AcceptableValues" DataField="AcceptableValues" HeaderText="Acceptable Values"></telerik:GridBoundColumn>
                     </Columns>
                </telerik:GridTableView>
            </DetailTables>
        </MasterTableView>
    </telerik:RadGrid>
    
    <telerik:RadButton runat="server" ID="RadButton1" Text="Save" OnClientClicking="savePage" OnClick="RadButton1_Click"></telerik:RadButton>

Doncho
Telerik team
 answered on 29 Sep 2022
1 answer
145 views

Unable to get the validation of the controls working in Web form

 

RadWizard and previous button in UI for ASP.NET AJAX | Telerik Forums

Peter Milchev
Telerik team
 answered on 29 Sep 2022
1 answer
238 views

When you create a Telerik Web Application using teh Outlook-Inspired template, how do you automatically expand the side menu? You have to click at the top left corner to expand.

I want to show up like the below, without having to click on the red in order for the left side to show when I first initialize the app.

Erika
Top achievements
Rank 1
Iron
 answered on 28 Sep 2022
1 answer
144 views

I have a RadTabStrip defined as follows:

<telerik:RadTabStrip ID="RadTabStrip1" runat="server" SelectedIndex="0" 
    AutoPostBack="True" Skin="Silk" Height="40px" Align="Justify">
    <Tabs>
        <telerik:RadTab runat="server" Text="Tab Number 1" Value="T1" Font-Bold="True" Selected="True">
        </telerik:RadTab>
        <telerik:RadTab runat="server" Text="Tab Number 2" Value="T2" Font-Bold="True">        
        </telerik:RadTab>
    </Tabs>
</telerik:RadTabStrip>

When the web page is displayed and I shrink the window size by grabbing the right side of the browser window, then the last tab flickers as I resize and if I stop the mouse in just the right spot the last tab completely disappears.

If I change the ALIGN property from JUSTIFY to CENTER, the flickering disappears and the last tab remains displayed.

 

This behavior occurs on the latest version of Firefox and Chrome.

Peter Milchev
Telerik team
 answered on 28 Sep 2022
9 answers
1.4K+ views

I have all the handlers and modules registered in my web.config. But I still get "Error while uploading, HTTP Error code is: 500" error in RadAsyncUpload method.

 

I have checked all the Telerik Demos and all the demos have all other code samples except Web.config.

 

Here are my four different web.config entries.

 <httpHandlers>
       <add verb="*" path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.Upload.RadUploadProgressHandler, Telerik.Web.UI"/>
      <add verb="*" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4"/>
      <add verb="*" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4"/>
      <add verb="*" path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4" validate="false"/>
      <add path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI"/>
    </httpHandlers>

    <httpModules>     
      <add name="WindowsAuthentication" type="System.Web.Security.WindowsAuthenticationModule" />
       <add name="RadCompression" type="Telerik.Web.UI.RadCompression"/>
      <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule, Telerik.Web.UI"/>   
    </httpModules>

 

 <handlers>
      <add name="aspnet_isapi" path="*" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="None" preCondition="classicMode,runtimeVersionv2.0,bitness32" />
      <add name="ChartImage.axd_*" path="ChartImage.axd" verb="*" type="Telerik.Web.UI.ChartHttpHandler, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4" preCondition="integratedMode"/>
      <add name="Telerik.Web.UI.SpellCheckHandler.axd_*" path="Telerik.Web.UI.SpellCheckHandler.axd" verb="*" type="Telerik.Web.UI.SpellCheckHandler, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4" preCondition="integratedMode"/>
      <add name="Telerik.Web.UI.DialogHandler.aspx_*" path="Telerik.Web.UI.DialogHandler.aspx" verb="*" type="Telerik.Web.UI.DialogHandler, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4" preCondition="integratedMode"/>
      <add name="Telerik.RadUploadProgressHandler.ashx_*" path="Telerik.RadUploadProgressHandler.ashx" verb="*" type="Telerik.Web.UI.Upload.RadUploadProgressHandler, Telerik.Web.UI" preCondition="integratedMode"/>
      <add name="Telerik.Web.UI.WebResource.axd_*" path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" preCondition="integratedMode"/>
    </handlers>
    <modules runAllManagedModulesForAllRequests="true">      
     <add name="RadCompression" type="Telerik.Web.UI.RadCompression"/>
      <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule, Telerik.Web.UI" preCondition="managedHandler"/>
    </modules>

 

What can be the issue? When I do F12 and try to upload the file, it red errors out on ScriptResource.axd file with "Error while uploading, HTTP Error code is: 500".

Miika
Top achievements
Rank 1
Iron
 answered on 28 Sep 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?