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

I have a combobox that displays a longer description of the TextField when open than it displays when collapsed. I achieve this using an Item Template as below:

<telerik:RadComboBox ID="cmbP9" Runat="server" DataTextField="Code" DataValueField="P9CodeID" 
                ToolTip="P9" Width="200" DropDownWidth="400px" HighlightTemplatedItems="true">
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
   <ItemTemplate>
       <span>
       <asp:Literal runat="server" ID="litCode" Text='<%# Eval( "Code" )%>'></asp:Literal>
                     - 
      <asp:Literal runat="server" ID="litTitle" Text='<%# Eval( "Title" )%>'></asp:Literal>                    
       </span>
       <br />
   </ItemTemplate>
</telerik:RadComboBox>

I want to now be able to create a combobox like this entirely from code. How can I create an Item Template as above from code or is there another way of achieving the same thing?

Cheers

Stewart
Kalina
Telerik team
 answered on 02 Nov 2011
8 answers
225 views
I try to export a simple grid without any success

to excel - it only give me the current page when ignorpaging = false and none when ignorepaging = true

to pdf - it give me an error of unsupported file type.

How do I resolve this?
Lan
Top achievements
Rank 1
 answered on 02 Nov 2011
1 answer
95 views
Combobox selected values are not persisting on pressing Browser "Back" button.Is there any work around for this?
Kalina
Telerik team
 answered on 02 Nov 2011
2 answers
105 views

We have a text element on the left hand side, and a button on the right hand side of the treeview row.   We want to use a context menu which only gets activated when the blue image button is clicked.   What actually happens is the context menu is activated when we click anywhere on the treeview row (see picture attached).

We are using this nodetemplate in the RadTreeView with a context menu.

<NodeTemplate>
    <div style="width:100%;height:22px;">
        <span style="float:left;font-family:Arial;font-weight:bold;font-size:13px;">
        <%# DataBinder.Eval(Container, "Text") %>
        </span>
    <img class="treeGear" src="../img/gearsbluebtn.png" alt="Options" width="38px" height="22px" />
    </div>
</NodeTemplate>

 

How can we limit the context menu to only activate when the blue button is clicked? 

Marcus
Top achievements
Rank 1
 answered on 02 Nov 2011
5 answers
127 views
If I add a textbox or radtextbox to a template, you can't set focus to the textbox to enter text..  This work with IE7.  Testing failed with FF 3.6.1 and FF 4.01.

easy to reproduce:

<telerik:RibbonBarTemplateItem ID="templatetextbox">
    <Template>
        <asp:TextBox runat="server" ID="txtTest"></asp:TextBox>
    </Template>
</telerik:RibbonBarTemplateItem>
Kate
Telerik team
 answered on 02 Nov 2011
10 answers
503 views
Hi!
  I am using Telerik ASP.NET Ajax Controls  2011.2.712.40 on .NET 4.0 framework. In that I am facing an issue while using new feature of RadComboBox as Checkbox for multiple selection. It doesnt work fine on many browsers as I am unable to check check boxes. Below is the code snippet.


(In .aspx Page)

<telerik:RadComboBox ID="rdcmb" CheckBoxes="true" runat="server"
 EmptyMessage="Status"  DropDownWidth="200px"
 MaxHeight="140px"  Width="200px">
 </telerik:RadComboBox>

(In .aspx.cs)

if (rdcmb.CheckedItems != null)
            {
                status = string.Empty;
                var sb = new StringBuilder();
                var collection = rdcmb.CheckedItems;
                foreach (var item in collection)
                    sb.Append(item.Value + ",");
                String ApplicationVariable= sb.ToString();
            }
Kalina
Telerik team
 answered on 02 Nov 2011
10 answers
332 views
in the samples of the aps.net ajax controls under listview there is an application scenario called Image Gallery.

I have been trying to reduplicate this application and i am using vb.net. i followed all the tutorials and steps, but when i compile the app i get an error that Photo is not defined

<%@ Import Namespace="Data" %>
<%@ Import Namespace="Photo" %>

Data

Imports System
Imports System.Collections.Generic
Imports System.Drawing.Imaging
Imports System.IO
Imports System.Linq
Imports System.Web
Imports System.Drawing
  
Namespace Data
    Public NotInheritable Class DataProvider
        Private Sub New()
        End Sub
        <ThreadStatic()> _
        Private Shared _photos As List(Of Photo)
  
        Public Shared Function GetData() As IList(Of Photo)
            If _photos IsNot Nothing Then
                Return _photos
            End If
  
            _photos = New List(Of Photo)()
            For Each files As String In Directory.GetFiles(HttpContext.Current.Server.MapPath("~/Images"))
                Dim photo = New Photo() With { _
                    .Name = Path.GetFileName(files) _
                }
  
                Dim image__1 As Image = Image.FromFile(files)
                Using memoryStream = New MemoryStream()
                    image__1.Save(memoryStream, ImageFormat.Png)
                    photo.Data = memoryStream.ToArray()
                End Using
                _photos.Add(photo)
            Next
            Return _photos
        End Function
  
        Public Shared Sub Update(ByVal photoId As Integer, ByVal name As String)
            Dim first As Photo = _photos.FirstOrDefault(Function(p) p.Id = photoId)
  
            If first IsNot Nothing Then
                first.Name = name
            End If
        End Sub
    End Class
  
      
End Namespace

Photo
Public Class Photo
    Private Shared ReadOnly _key As New Object()
    Private Shared _counter As Integer
  
    Public Sub New()
        Id = GetId()
    End Sub
  
    Public Property Name() As String
        Get
            Return m_Name
        End Get
        Set(ByVal value As String)
            m_Name = Value
        End Set
    End Property
    Private m_Name As String
    Public Property Data() As Byte()
        Get
            Return m_Data
        End Get
        Set(ByVal value As Byte())
            m_Data = Value
        End Set
    End Property
    Private m_Data As Byte()
    Public Property Id() As Integer
        Get
            Return m_Id
        End Get
        Private Set(ByVal value As Integer)
            m_Id = Value
        End Set
    End Property
    Private m_Id As Integer
  
    Protected Shared Function GetId() As Integer
        SyncLock _key
            _counter += 1
        End SyncLock
        Return _counter
    End Function
End Class



<ItemTemplate>
                    <fieldset style="float: left; margin: 5px 5px 5px 5px; padding: 2px 2px 2px 2px;
                        background: #eeeeee" class="myClass" onmouseover="containerMouseover(this)" onmouseout="containerMouseout(this)">
                        <telerik:RadBinaryImage Style="cursor: pointer;" runat="server" ID="RadBinaryImage1"
                            DataValue='<%#Eval("Data") %>' Height='<%#ImageHeight %>' Width="<%#ImageWidth %>"
                            ResizeMode="Fit" onclick="<%#CreateWindowScript(DirectCast(Container.DataItem, Photo)) %>"
                            AlternateText="Click to view larger image" ToolTip="Click to view larger image" />
                        <br />
                        <div style="margin-top: -30px; position: fixed; display: none; width: <%#ImageHeight.Value/1.5 %>px;">
                            <asp:TextBox runat="server" ID="TextBox1" Text='<%#Bind("Name") %>' CssClass="txt"
                                OnTextChanged="TextBox1_TextChanged" AutoPostBack="true" ToolTip="Edit image name" />
                        </div>
                    </fieldset>
                </ItemTemplate>


What am i missing here..

Thanks in Advanced

TClemons
Maria Ilieva
Telerik team
 answered on 02 Nov 2011
4 answers
245 views
Hi,

Simple request. I would like to remove the border around the panelbar. It would appear that if I set the BorderWidth="0" does not do it.

Example of what I am trying shown below:-

        <telerik:RadPanelBar ID="RadPanelBar1" runat="server" Skin="Outlook" BorderWidth="0px">  
            <Items> 
                <telerik:RadPanelItem Text="Locations" Expanded="true" BorderWidth="0px">  
                    <ItemTemplate><p>Hello Telerik</p></ItemTemplate>      
                </telerik:RadPanelItem> 
            </Items> 
        </telerik:RadPanelBar> 
 

Is there a Css style I need to override instead?

Thanks,
Martin
Brian Azzi
Top achievements
Rank 2
 answered on 02 Nov 2011
1 answer
123 views
I am probably sure this has been covered somewhere but I cannot find the exact cause of the problem I am experiencing.

I have a grid that has a CommandItemTemplate with an image and Label control.  When the grid is populated with data from a pivot query, the expand column expands to beyond 20 pixels with CommandHeaderDispaly=Top.  When CommandHeaderDisplay=None, I get the correct width as set by the code I have on the page.

Here is the Grid markup:

<telerik:RadGrid ID="rgdFacilityOT" runat="server" Visible="True" Skin="Office2007"
                          oncolumncreated="rgdFacilityOT_ColumnCreated"
                          ondetailtabledatabind="rgdFacilityOT_DetailTableDataBind"
                          onitemdatabound="rgdFacilityOT_ItemDataBound" AutoGenerateColumns="true"
                          onitemcreated="rgdFacilityOT_ItemCreated" MasterTableView-ExpandCollapseColumn-HeaderStyle-Width="20px">
                          <MasterTableView TableLayout="Fixed" CommandItemDisplay="Top">
                          <CommandItemTemplate>
                          <div>
                              <asp:Label runat="server" CssClass="rgHeader" ID="lblFacilityOTGridTitle" Text="" meta:ResourceKey="lblFacilityOTGridTitleResource1"></asp:Label>
                           <div class="export_button_right">
                            <asp:ImageButton ID="btnGridExport" ImageUrl="~/Images/Excel-16x16.gif" OnClick="btnExcel_Click"
                                           runat="server" ToolTip="Export To Excel"
                                   meta:resourcekey="btnGridExportResource1" />
                             </div>
                             </div>
                      </CommandItemTemplate>
                        <CommandItemSettings ShowExportToExcelButton="True"
                            ShowAddNewRecordButton="False" ExportToPdfText="Export to PDF" />
                           <ExpandCollapseColumn Resizable="True" Visible="False">
                         
                        </ExpandCollapseColumn>
                              <CommandItemSettings ExportToPdfText="Export to PDF" />
                        <RowIndicatorColumn Visible="False">
                          
                        </RowIndicatorColumn>

                              <EditFormSettings>
                                  <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                                  </EditColumn>
                              </EditFormSettings>

                          </MasterTableView>
                              <ClientSettings AllowExpandCollapse="False">
                        <Scrolling AllowScroll="True" UseStaticHeaders="False" ScrollHeight="">
                        </Scrolling>
                     </ClientSettings>
                          <FilterMenu EnableImageSprites="False">
                          </FilterMenu>
                          <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Office2007">
                          </HeaderContextMenu>
               </telerik:RadGrid>   


I just want to be able to control the width of the expand column.  I have tried the following CSS:

.rgExpandCol
{
    width: 10px !important;
       padding-left: 0 !important ;
       padding-right: 0 !important ;
       text-align: left ;
}

but it still does not work. I am sure it is something simple or I have missed something
Pavlina
Telerik team
 answered on 02 Nov 2011
1 answer
105 views
          <telerik:RadGrid AutoGenerateColumns="False" ID="xgrdApprovedAuths" AllowSorting="True"
              OnSortCommand="xgrdApprovedAuths_SortCommand" OnNeedDataSource="xgrdApprovedAuths_NeedDataSource"
              Height="200px" Width="9in" runat="server" CellSpacing="0">
              <ExportSettings ExportOnlyData="true" IgnorePaging="true" OpenInNewWindow="true" />
                  <mastertableview tablelayout="Auto" width="100%" allownaturalsort="false">
                  <Columns>
                      <telerik:GridBoundColumn HeaderText="Status" DataField="ApprovalStatus" UniqueName="ApprovalStatus"
                          SortExpression="ApprovalStatus" HeaderStyle-VerticalAlign="Bottom" HeaderStyle-HorizontalAlign="Center"
                          ShowSortIcon="False" ShowFilterIcon="False" ReadOnly="True" AllowFiltering="False">
                          <HeaderStyle HorizontalAlign="Center" VerticalAlign="Bottom" />
                      </telerik:GridBoundColumn>
                      <telerik:GridBoundColumn HeaderText="AuthID" DataField="AuthID" UniqueName="AuthID"
                          SortExpression="AuthID" Visible="False" HeaderStyle-VerticalAlign="Bottom" ShowSortIcon="False"
                          ShowFilterIcon="False" ReadOnly="True" AllowFiltering="False">
                          <HeaderStyle VerticalAlign="Bottom" />
                      </telerik:GridBoundColumn>
                      <telerik:GridBoundColumn HeaderText="Auth Number" DataField="AuthNumber" UniqueName="AuthNumber"
                          SortExpression="AuthNumber" HeaderStyle-VerticalAlign="Bottom" HeaderStyle-HorizontalAlign="Center"
                          ShowSortIcon="False" ShowFilterIcon="False" ReadOnly="True" AllowFiltering="False">
                          <HeaderStyle HorizontalAlign="Center" VerticalAlign="Bottom" />
                      </telerik:GridBoundColumn>
                      <telerik:GridBoundColumn HeaderText="Auth Adj #" DataField="AuthAmendment" UniqueName="AuthAmendment"
                          SortExpression="AuthAmendment" ItemStyle-Wrap="False" HeaderStyle-VerticalAlign="Bottom"
                          ShowSortIcon="False" ShowFilterIcon="False" ReadOnly="True" AllowFiltering="False"
                          HeaderStyle-HorizontalAlign="Center">
                          <HeaderStyle HorizontalAlign="Center" VerticalAlign="Bottom" />
                          <ItemStyle Wrap="False" />
                      </telerik:GridBoundColumn>
                      <telerik:GridBoundColumn HeaderText="Originator" DataField="CreatedBy" UniqueName="CreatedBy"
                          SortExpression="CreatedBy" ItemStyle-Wrap="False" HeaderStyle-VerticalAlign="Bottom"
                          ShowSortIcon="False" ShowFilterIcon="False" ReadOnly="True" AllowFiltering="False">
                          <HeaderStyle VerticalAlign="Bottom" />
                          <ItemStyle Wrap="False" />
                      </telerik:GridBoundColumn>
                      <telerik:GridBoundColumn HeaderText="MemberID" DataField="MemberID" UniqueName="MemberID"
                          SortExpression="MemberID" Visible="False" HeaderStyle-VerticalAlign="Bottom"
                          ShowSortIcon="False" ShowFilterIcon="False" ReadOnly="True" AllowFiltering="False">
                          <HeaderStyle VerticalAlign="Bottom" />
                      </telerik:GridBoundColumn>
                      <telerik:GridBoundColumn HeaderText="Member Name" DataField="Member Name" UniqueName="Member Name"
                          SortExpression="Member Name" ItemStyle-Wrap="False" HeaderStyle-VerticalAlign="Bottom"
                          ShowSortIcon="False" ShowFilterIcon="False" ReadOnly="True" AllowFiltering="False">
                          <HeaderStyle VerticalAlign="Bottom" />
                          <ItemStyle Wrap="False" />
                      </telerik:GridBoundColumn>
                      <telerik:GridBoundColumn HeaderText="Start Date" DataField="StartDate" UniqueName="StartDate"
                          SortExpression="StartDate" HeaderStyle-VerticalAlign="Bottom" DataType="System.DateTime"
                          ItemStyle-Wrap="False" DataFormatString="{0:MM/dd/yyyy}" ShowSortIcon="False"
                          ShowFilterIcon="False" ReadOnly="True" AllowFiltering="False">
                          <HeaderStyle VerticalAlign="Bottom" />
                          <ItemStyle Wrap="False" />
                      </telerik:GridBoundColumn>
                      <telerik:GridBoundColumn HeaderText="End Date" DataField="EndDate" UniqueName="EndDate"
                          SortExpression="EndDate" HeaderStyle-VerticalAlign="Bottom" DataType="System.DateTime"
                          ItemStyle-Wrap="False" DataFormatString="{0:MM/dd/yyyy}" ShowSortIcon="False"
                          ShowFilterIcon="False" ReadOnly="True" AllowFiltering="False">
                          <HeaderStyle VerticalAlign="Bottom" />
                          <ItemStyle Wrap="False" />
                      </telerik:GridBoundColumn>
                      <telerik:GridBoundColumn HeaderText="Max Units" DataField="MaxUnits" UniqueName="MaxUnits"
                          SortExpression="MaxUnits" HeaderStyle-VerticalAlign="Bottom" ItemStyle-Wrap="False"
                          DataType="System.Int32" DataFormatString="{0:###,##0}" ItemStyle-HorizontalAlign="Right"
                          ShowSortIcon="False" ShowFilterIcon="False" ReadOnly="True" AllowFiltering="False"
                          HeaderStyle-HorizontalAlign="Center">
                          <HeaderStyle HorizontalAlign="Center" VerticalAlign="Bottom" />
                          <ItemStyle HorizontalAlign="Right" Wrap="False" />
                      </telerik:GridBoundColumn>
                      <telerik:GridBoundColumn HeaderText="Units Used" DataField="Units Used" UniqueName="Units Used"
                          SortExpression="Units Used" HeaderStyle-VerticalAlign="Bottom" DataType="System.Int32"
                          ItemStyle-Wrap="False" DataFormatString="{0:###,##0}" ItemStyle-HorizontalAlign="Right"
                          ShowSortIcon="False" ShowFilterIcon="False" ReadOnly="True" AllowFiltering="False"
                          HeaderStyle-HorizontalAlign="Center">
                          <HeaderStyle HorizontalAlign="Center" VerticalAlign="Bottom" />
                          <ItemStyle HorizontalAlign="Right" Wrap="False" />
                      </telerik:GridBoundColumn>
                      <telerik:GridBoundColumn HeaderText="Division" DataField="Division" UniqueName="Division"
                          SortExpression="Division" HeaderStyle-VerticalAlign="Bottom" ItemStyle-Wrap="False"
                          ShowSortIcon="False" ShowFilterIcon="False" ReadOnly="True" AllowFiltering="False"
                          ItemStyle-HorizontalAlign="Center">
                          <HeaderStyle VerticalAlign="Bottom" />
                          <ItemStyle HorizontalAlign="Center" Wrap="False" />
                      </telerik:GridBoundColumn>
                      <telerik:GridBoundColumn HeaderText="Service Description" DataField="Service Description"
                          UniqueName="Service Description" SortExpression="Service Description" AutoPostBackOnFilter="true"
                          CurrentFilterFunction="Contains" HeaderStyle-VerticalAlign="Bottom" ShowSortIcon="False"
                          ShowFilterIcon="False" ReadOnly="True" AllowFiltering="False" ItemStyle-Wrap="False">
                          <HeaderStyle VerticalAlign="Bottom" />
                          <ItemStyle Wrap="False" />
                      </telerik:GridBoundColumn>
                      <telerik:GridBoundColumn HeaderText="Reject Reason" DataField="RejectReason" UniqueName="RejectReason"
                          SortExpression="RejectReason" HeaderStyle-VerticalAlign="Bottom" ItemStyle-Wrap="False"
                          ShowSortIcon="False" ShowFilterIcon="False" ReadOnly="True" AllowFiltering="False">
                          <HeaderStyle VerticalAlign="Bottom" />
                          <ItemStyle Wrap="False" />
                      </telerik:GridBoundColumn>
                  </Columns>
              </mastertableview>
                  <clientsettings>
                  <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True">
                  </Scrolling>
              </clientsettings>
          </telerik:RadGrid>
          <asp:Button ID="cmdExport" runat="server" Text="Export to CSV File" OnClick="cmdExport_Click" />
 
  protected void cmdExport_Click(object sender, System.EventArgs e)
  {
      xgrdApprovedAuths.MasterTableView.ExportToExcel();
  }
 
  protected void xgrdApprovedAuths_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
  {
      try
      {
        clsAuthorizations auth = new clsAuthorizations(ss.dbConnect);
 
          DateTime FromDate;
          DateTime ToDate;
 
          if (txtProcessedStartDate.SelectedDate == null)
          {
              FromDate = System.DateTime.Now.AddYears(-50);
          }
          else
          {
              FromDate = txtProcessedStartDate.SelectedDate.Value;
          }
 
          if (txtProcessedEndDate.SelectedDate == null)
          {
              ToDate = System.DateTime.Now.AddYears(50);
          }
          else
          {
              ToDate = txtProcessedEndDate.SelectedDate.Value;
          }
 
          int ProviderID = ss.ProviderID;
 
          this.xgrdApprovedAuths.DataSource = auth.GetViewOnlyApprovedAuths(ProviderID, FromDate, ToDate, cboProcessedStatus.SelectedItem.Text, cboProcessedDivision.SelectedItem.Text, ss.listDivisionString);
          //this.xgrdApprovedAuths.DataBind();
 
   this.updApprovedAuths.Update();
}
   catch (Exception ex)
      {
          clsPortalErrorLog err = new clsPortalErrorLog(ss.dbConnect);
          err.LogError(ex.ToString(), User.Identity.Name, "AuthsMain.aspx", "BindApprovedAuths");
      }
  }
Using the following code I get error in the ScriptResource tab showing your java script.


I'm using Telerek version Q1 2011 with Visual Studio 2008.

I'm trying to export the grid to Excel.

 

Mira
Telerik team
 answered on 02 Nov 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
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?