Telerik Forums
UI for ASP.NET AJAX Forum
35 answers
2.4K+ views
Hi ,

We are using RadGrid in our application , the problem we are facing is that the RadGrid Header and the data items are not properly aligned with each other. Please help us in this.



Thanks,
Rahul
Marcio
Top achievements
Rank 1
 answered on 27 Feb 2017
7 answers
428 views

Is there a way to retain the width of columns in a radgrid after resizing one or more columns?  After resizing one of the columns, if I do anything, such as navigate to the next page in the grid, then the resizing is lost and all the columns are back to the original size as if I just accessed the page.

 

Thanks!

Milena
Telerik team
 answered on 27 Feb 2017
0 answers
120 views

Hi,

could somebody help me with setup of RadGrid in this demo? RenderMode is Mobile, I know but how to get the "inner scroll with auto min width" behavior. Thanks a lot 

http://demos.telerik.com/aspnet-ajax/grid/examples/functionality/mobile-and-touch-support/adaptive-behavior/defaultcs.aspx?show-source=true

KTK
Top achievements
Rank 1
 asked on 27 Feb 2017
2 answers
162 views

All,

I have a pretty simple grid setup (see grid code below). When I try to export to PDF I get the exception below. I can't register the controls because I only have reference to them during "ItemDataBound" event.

What's the work around on this one?

Script control 'lblDealer' is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors().
Parameter name: scriptControl

 

Here is my RadGrid Markup

01.<telerik:RadGrid runat="server" ID="gvDealerTunes" RenderMode="Lightweight" AllowPaging="False" AllowSorting="True" AllowFilteringByColumn="False">
02.            <ExportSettings IgnorePaging="True" OpenInNewWindow="True">
03.                <Pdf PageHeight="210mm" PageWidth="297mm" DefaultFontFamily="Arial Unicode MS" PageTopMargin="45mm"
04.                     BorderStyle="Medium" BorderColor="#666666"/>
05.            </ExportSettings>
06.            <MasterTableView AutoGenerateColumns="False">
07.                <Columns>
08.                    <telerik:GridBoundColumn HeaderText="Tune Order Id" DataField="TuneOrderId"/>
09.                    <telerik:GridTemplateColumn HeaderText="Dealer">
10.                        <ItemTemplate>
11.                            <telerik:RadLabel runat="server" ID="lblDealer"/>
12.                        </ItemTemplate>
13.                    </telerik:GridTemplateColumn>
14.                    <telerik:GridTemplateColumn HeaderText="Customer">
15.                        <ItemTemplate>
16.                            <telerik:RadLabel runat="server" ID="lblCustomer"/>
17.                        </ItemTemplate>
18.                    </telerik:GridTemplateColumn>
19.                    <telerik:GridBoundColumn HeaderText="Zen Ticket #" DataField="ZenDeskTicketNumber"/>
20.                    <telerik:GridBoundColumn HeaderText="Vendor Order #" DataField="VendorOrderNumber"/>
21.                    <telerik:GridBoundColumn DataField="OrderedVerified" HeaderText="Verified"/>
22.                    <telerik:GridBoundColumn DataField="OrderVerfificationSource" HeaderText="Verification"/>
23.                    <telerik:GridBoundColumn DataField="IsTuneUpdate" HeaderText="Tune Update?"/>
24.                    <telerik:GridBoundColumn DataField="TuneCanBeAutoGenerated" HeaderText="AG?"/>
25.                    <telerik:GridBoundColumn DataField="TuneGenerated" HeaderText="Generated?"/>
26.                    <telerik:GridBoundColumn DataField="TuneOrderCreationDateTime" HeaderText="Created"/>
27.                    <telerik:GridBoundColumn DataField="SubmittedToZenDeskDateTime" HeaderText="Submitted"/>
28.                </Columns>
29.            </MasterTableView>
30.        </telerik:RadGrid>

 

Export button code

1.private void BtnExport_Click(object sender, EventArgs e)
2.        {
3.            gvDealerTunes.MasterTableView.ExportToPdf();
4.        }

 

Thanks in advance!! 

 

Matt
Top achievements
Rank 1
 answered on 27 Feb 2017
5 answers
203 views

I have created a RadGrid.  Here is the steps I used to create it and then remove all the rows (I just want the header - details why below)

I clear the rows in the datatable that I bind to the grid

I set the RadGrid datasource = to that blank datatable

I then bind

I also set the NoDetailRecordsText = "" and NoMasterRecordsText = ""

I have column headers that are dates (1/12 for example) and each day they change.  Those are in the middle of the columns.  All the other columns have named headers I know about (except the dates)

Column layout

Hardware Model 1/2  1/3  1/4 Col1 Col2 etc.

I need to set all the columns to a value (only way i know to set those date ones but code I have tried does not work) in ItemCreated event

For Each col As GridColumn In grdHeader.MasterTableView.Columns                 

     col.HeaderStyle.Width = "60"             'Never gets to this

Next

then go and set the rest of the column widths (this seems to work)

Dim gridCol As GridColumn             

gridCol = grdHeader.MasterTableView.GetColumn("Model")        

gridCol.HeaderStyle.Width = "140"

The reason I need to do this is we have scrolling RadGrids per group and I want to keep the header above the scrolling section as when it scrolls each header for each grid goes away and you have no clue what cols go with what data.

I hope this give enough to hopefully point me in the right direction.

I appreciate any help

Mark
Top achievements
Rank 1
 answered on 27 Feb 2017
0 answers
107 views

Hello,

How add style for first item in RadComboBox on the side server?How get first element RadComboBox, element type input ?

protected void ValidationSections()
{

     if (RadComboBox.Text == "")
     {
         RadComboBox.Style.Add("background", "#F7FAA5 !important;"); //not working
         RadComboBoxItem item = RadComboBox.DataValueField(""); // error Non-invocable member '.../DataValueField' cannot be used like a method
         MainContent_RadComboBox_Input.Style.Add("background", "#F7FAA5 !important;"); //  MainContent_RadComboBox_Input.Style not exist in the current context
     }
}

Please help me.

Grzegorz
Top achievements
Rank 1
 asked on 27 Feb 2017
0 answers
135 views

Hello,

This is my code:

 

<telerik:RadTileList ID="elmHomeTileList" CssClass="responsiveWidth" runat="server" Skin="Telerik" EnableDragAndDrop="true" OnTileClick="elmHomeTileList_TileClick" AutoPostBack="true"
        SelectionMode="None" ScrollingMode="Accelerated" TileRows="1">
        <Groups>
            <telerik:TileGroup>

  <telerik:RadContentTemplateTile ID="tileService" runat="server" Shape="Wide" CssClass="tile-services" OnClick="tileService_Click" Selected="false">
                    <ContentTemplate>
                        <div class="pull-left">
                            <%--<a href='javascript:void(0)' onclick="doSomeWork(1)">
                                <span class="glyphicon glyphicon-plus tile-plus noTileDrag" aria-hidden="true"></span>
                            </a>--%>
                            <button >Hello</button>
                           <asp:LinkButton ID="LinkButton1" runat="server" OnClick="Unnamed_Click" Text="Click Me" />
                           
                         <asp:Button ID="Button1" runat="server" OnClick="Unnamed_Click" Text="Click Me2" />
                            <a href="<%=ResolveUrl("~/Admin/AddService/")%>">
                                <span class="glyphicon glyphicon-plus tile-plus" aria-hidden="true"></span>
                            </a>
                        </div>

                        <img src="Images/Icons/Toolbars/alert.png" class="tile-image pull-left tile-image-plus" />
                        <div class="right-border"></div>

                        <div class="right-number">
                            43
                        </div>

                        <div class="right-text">
                            services
                        </div>
                    </ContentTemplate>                    
                </telerik:RadContentTemplateTile>

 </telerik:TileGroup>
        </Groups>
    </telerik:RadTileList>

 

This is my backend code super simple:

 

 protected void Unnamed_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/Admin/AddService/");
        }

        protected void tileService_Click(object sender, EventArgs e)
        {

        }

        protected void elmHomeTileList_TileClick(object sender, TileListEventArgs e)
        {

        }

 

The problem here is when I click either LinkButton or Button it never hits the break point in Unnamed_Click. It only goes to tileService_Click and elmHomeTileList_TileClick. Is there anyway I could stop this control from doing this since I want that the tile click should go a URL but I also want that clicking a specific link button should go to that desired URL.

This is server side but I tried posting simple HTML anchor tag as well like

<telerik:RadContentTemplateTile ID="tileService" runat="server" Shape="Wide" CssClass="tile-services" NavigateUrl="/Admin/ListServices" Selected="false">
                    <ContentTemplate>
                        <div class="pull-left">
                            <%--<a href='javascript:void(0)' onclick="doSomeWork(1)">
                                <span class="glyphicon glyphicon-plus tile-plus noTileDrag" aria-hidden="true"></span>
                            </a>--%>

                            <a href="<%=ResolveUrl("~/Admin/AddService/")%>">
                                <span class="glyphicon glyphicon-plus tile-plus" aria-hidden="true"></span>
                            </a>
                        </div>

                        <img src="Images/Icons/Toolbars/alert.png" class="tile-image pull-left tile-image-plus" />
                        <div class="right-border"></div>

                        <div class="right-number">
                            43
                        </div>

                        <div class="right-text">
                            services
                        </div>
                    </ContentTemplate>

                </telerik:RadContentTemplateTile>

But nothing works. It always go to the URL set in NavigateUrl. The anchors don't work at all.

Is there a fix for this?

 

Thank you.

TC
Top achievements
Rank 1
 asked on 27 Feb 2017
0 answers
126 views

Hey,

im trying to have the same style to show the user that an input is invalid. Im using a RadTextBox, a RadNumericTextBox and a DateTimePicker with asp:CustomValidator each. For the two text boxes i can set

textbox.Invalid = true

but there is no such property in the DateTimePicker. I like the red border with the red exclamation mark in the text boxes and would like to use them for the DateTimePicker, too, but the only thing that works for me right now is to set an ErrorMessage for the Validator.

Do I fail to see how this works? Because there are forum threads asking for a way to not mark the field like I want to.

Greetings

Felix

Felix
Top achievements
Rank 1
 asked on 27 Feb 2017
1 answer
412 views

I have the following grid (as a sample)

<telerik:RadGrid runat="server" ID="RadGrid1" AllowSorting="true" AllowPaging="true" PageSize="15" AutoGenerateColumns="false" ShowDesignTimeSmartTagMessage="false" Width="9700px" AllowFilteringByColumn="true" GroupingSettings-CaseSensitive="false" >
   <MasterTableView GroupLoadMode="Client" DataKeyNames="Id" NoMasterRecordsText="No records." >
      <ColumnGroups>
         <telerik:GridColumnGroup HeaderText="[Group1]" Name="grp1" />
         <telerik:GridColumnGroup HeaderText="[Group2]" Name="grp2" />
      </ColumnGroups>
      <Columns>
         <telerik:GridBoundColumn UniqueName="Item1a" DataField="Item1a" HeaderText="[Item 1a]"  ColumnGroupName="grp1" AutoPostBackOnFilter="true" FilterListOptions="VaryByDataType" CurrentFilterFunction="Contains" FilterControlWidth="100px">
          <HeaderStyle HorizontalAlign="Left" Width="120px" Wrap="false" />
          <ItemStyle HorizontalAlign="Left" Width="120px" />
         </telerik:GridBoundColumn>
         <telerik:GridBoundColumn UniqueName="Item1b" DataField="Item1b" HeaderText="[Item 1b]"  ColumnGroupName="grp1" AutoPostBackOnFilter="true" FilterListOptions="VaryByDataType" CurrentFilterFunction="Contains" FilterControlWidth="100px">
          <HeaderStyle HorizontalAlign="Left" Width="120px" Wrap="false" />
          <ItemStyle HorizontalAlign="Left" Width="120px" />
         </telerik:GridBoundColumn>
         <telerik:GridBoundColumn UniqueName="Standalone" DataField="Standalone" HeaderText="[Stand Alone]"  AutoPostBackOnFilter="true" FilterListOptions="VaryByDataType" CurrentFilterFunction="Contains" FilterControlWidth="100px">
          <HeaderStyle HorizontalAlign="Left" Width="120px" Wrap="false" />
          <ItemStyle HorizontalAlign="Left" Width="120px" />
         </telerik:GridBoundColumn>
         <telerik:GridBoundColumn UniqueName="Item2a" DataField="Item2a" HeaderText="[Item 2a]"  ColumnGroupName="grp2" AutoPostBackOnFilter="true" FilterListOptions="VaryByDataType" CurrentFilterFunction="Contains" FilterControlWidth="100px">
          <HeaderStyle HorizontalAlign="Left" Width="120px" Wrap="false" />
          <ItemStyle HorizontalAlign="Left" Width="120px" />
         </telerik:GridBoundColumn>
         <telerik:GridBoundColumn UniqueName="Item2b" DataField="Item2b" HeaderText="[Item 2b]"  ColumnGroupName="grp2" AutoPostBackOnFilter="true" FilterListOptions="VaryByDataType" CurrentFilterFunction="Contains" FilterControlWidth="100px">
          <HeaderStyle HorizontalAlign="Left" Width="120px" Wrap="false" />
          <ItemStyle HorizontalAlign="Left" Width="120px" />
         </telerik:GridBoundColumn>
      </Columns>
   </MasterTableView>
</telerik:RadGrid>

 

I am trying to alter the text on both the ColumnGroup items and the GridHeader items.

I can change the ColumnGroup text like this (in ItemDataBound):

RadGrid1.MasterTableView.ColumnGroups.FindGroupByName("grp1").HeaderText = "First Group"

 

But when I try to rename the GridHeader (as I have done numerous times before), there is no change

Private Sub RadGrid1_ItemDataBound(sender As Object, e As GridItemEventArgs) Handles RadGrid1.ItemDataBound
   If (TypeOf e.Item Is GridHeaderItem) Then
      Dim header As GridHeaderItem = e.Item
      CType(header("Item1a").Controls(0), LinkButton).Text = "Group 1 - Item 1"
      CType(header("Item1b").Controls(0), LinkButton).Text = "Group 1 - Item 2"
      CType(header("Item2a").Controls(0), LinkButton).Text = "Group 2 - Item 1"
      CType(header("Item2b").Controls(0), LinkButton).Text = "Group 2 - Item 2"
   End if

 

What am I doing wrong?

Eyup
Telerik team
 answered on 27 Feb 2017
1 answer
456 views
I have a grid with a combo box edit template column. I have to save the Text and Value of the selected combo box item on BatchEditCommand. Can you please provide sample code to accomplish this?
Eyup
Telerik team
 answered on 27 Feb 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?