Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
320 views
I am having some trouble setting the header text of my columns.
I am getting an error on .MasterTableView.Columns(i).HeaderText = ... (the other side of the equation works fine).
Here is the error:
Failed accessing GridColumn by index. Please verify that you have specified the structure of RadGrid correctly.

 
Protected Overridable Sub FormatGrid()
    Try
        With mGridEx
            .DataSource = mDs
             If Not IsPostBack() Then
                .Font.Name = "Verdana"
                .Font.Size = New WebControls.FontUnit("8.5pt")
            End If
            .DataBind()
            For i As Integer = 0 To mDs.Tables(mTableName).Columns().Count - 1
                .MasterTableView.Columns(i).HeaderText = mDs.Tables(mTableName).Columns(i).Caption
            Next
        End With
    Catch ex As System.NullReferenceException
    Catch ex As Exception
        Dim error1 As String = ex.ToString()
    End Try
End Sub
Princy
Top achievements
Rank 2
 answered on 10 Dec 2010
3 answers
80 views
I have this code to dynmically create a checkbox template field and then access the settings of the checkbox:
        SearchResultGrid.Columns.Clear()
        Dim templateColumnName As String = "Delete"
        Dim col2 As Telerik.Web.UI.GridTemplateColumn = New Telerik.Web.UI.GridTemplateColumn
        col2.EditItemTemplate = New MyTemplate(templateColumnName)
        col2.ItemTemplate = New MyTemplate(templateColumnName)
        col2.HeaderText = templateColumnName
        SearchResultGrid.Columns.Add(col2)

    Private Class MyTemplate
        Implements ITemplate
        Protected boolValue As CheckBox
        Private colname As String
        Public Sub New(ByVal cName As String)
            colname = cName
        End Sub
        Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) Implements ITemplate.InstantiateIn
            boolValue = New CheckBox()
            boolValue.ID = "boolValue"
            AddHandler boolValue.DataBinding, _
                       AddressOf boolValue_DataBinding
            boolValue.Enabled = True
            Dim table As New Table()
            container.Controls.Add(table)
            container.Controls.Add(boolValue)
        End Sub
        Sub boolValue_DataBinding(ByVal sender As Object, ByVal e As EventArgs)
            Dim cBox As CheckBox = DirectCast(sender, CheckBox)
            Dim container As Telerik.Web.UI.GridDataItem = DirectCast(cBox.NamingContainer, Telerik.Web.UI.GridDataItem)
            'cBox.Checked = DirectCast((DirectCast(container.DataItem, DataRowView))("Bool"), Boolean)
        End Sub
    End Class

        For Each item As Telerik.Web.UI.GridDataItem In SearchResultGrid.Items
            Dim chk As CheckBox = item.FindControl("boolValue")
            If chk.Checked Then
                Dim j As Integer = 0
            End If
        Next

The problem is that in the For loop chk is getting set to Nothing.   It's not finding the boolValue control.

How do I access the settings of boolValue for each row in the Grid ?
Princy
Top achievements
Rank 2
 answered on 10 Dec 2010
6 answers
334 views
We've used some GridDropDownColumns in RadGrids, but I'm a little confused about sorting. If we sort the column that uses the dropdown, it sorts by the value, and not the text, which is confusing to the user and not the desired result. For example, let's say I have a GridDropDownColumn for Widget, with the following values

ID  Name
-------------
2   Alpha
3   Bravo  
1   Charlie

If I sort by that column, i'd like to see it as Alpha, Bravor, Charlie, however what happens is that it sorts on the value, so it ends up being Charlie, Alpha, Bravo.

Is there a way to have the column sort by the displayed text (the ListTextField) rather than the value field (the ListValueField, my foreign key column).
Derek
Top achievements
Rank 1
 answered on 10 Dec 2010
4 answers
295 views
Hi

I have the RadEditor implemented, everything works, image uploads, deletes, image map,  image editor, etc. However when I right click the image in the content and choose properties I get a Forbidden 403 error. Image Map Editor does however work!

Any ideas?

Michael
Top achievements
Rank 1
 answered on 10 Dec 2010
3 answers
119 views

Hi Telerik,

Really enjoying integrating the Scheduler Control, found the documentation great and control simple to integrate.

I’m using control in the web service mode but have two problems:

1) In Month view when there is more than one appointment in a day slot when "more..." is clicked i would like to handle this and display the timeline view.

2) In the timeline view i would like to switch of the resize handle as im only displaying start dates.

Thanks,

Debbie


Markup:
                <telerik:RadScheduler ID="RadScheduler1" runat="server"                  
                    OnClientAppointmentsPopulating="doClientAppointmentsPopulating" 
                    OnClientAppointmentInserting="doClientAppointmentInserting" 
                    OnClientAppointmentEditing="doClientAppointmentEditing" 
                    OnClientAppointmentDeleting="doClientAppointmentDeleting" 
                    OnClientAppointmentContextMenu="doClientAppointmentContextMenu"   
                    OnClientAppointmentContextMenuItemClicked="doClientAppointmentContextMenuItemClicked"   
                    OnClientTimeSlotContextMenu="doClientTimeSlotContextMenu" 
                    OnClientTimeSlotContextMenuItemClicked="doClientTimeSlotContextMenuItemClicked"   
                    Localization-ConfirmDeleteText="Are you sure you want to delete this announcement." 
                    Localization-ContextMenuAddAppointment="New Announcement"   
                    DisplayDeleteConfirmation="True"   
                    TimelineView-NumberOfSlots="7"   
                    SelectedView="MonthView" 
                    GroupingDirection="Vertical"   
                    FirstDayOfWeek="Monday" 
                    LastDayOfWeek="Sunday" 
                    DataKeyField="ID"   
                    DataSubjectField="Subject"   
                    DataStartField="Start"   
                    DataEndField="End" 
                    DataRecurrenceField="RecurrenceRule"   
                    DataRecurrenceParentKeyField="RecurrenceParentID"     
                    OverflowBehavior="Expand" 
                    ShowAllDayRow="true" 
                    ShowFullTime="false"   
                    ShowViewTabs="true"   
                    StartEditingInAdvancedForm="true"   
                    StartInsertingInAdvancedForm="true">  
                      
                    <WebServiceSettings   
                        Path="~/AdminV9/News/NewsSchedulerWS.asmx"   
                        ResourcePopulationMode="Manual" /> 
 
                    <%-- Header formating --%> 
                    <DayView   
                        UserSelectable="false" /> 
                    <WeekView    
                        UserSelectable="false" /> 
                    <MonthView   
                        UserSelectable="true"   
                        HeaderDateFormat="MMM, yyyy"   
                        AdaptiveRowHeight="false"   
                        VisibleAppointmentsPerDay="2" /> 
                    <TimelineView   
                        UserSelectable="true"   
                        HeaderDateFormat="MMM dd, yyyy"   
                        ColumnHeaderDateFormat="ddd dd" /> 
                    <MultiDayView   
                        UserSelectable="false"  /> 
                      
                    <%-- Context menus --%> 
                    <TimeSlotContextMenuSettings EnableDefault="true" /> 
                    <TimeSlotContextMenus> 
                        <telerik:RadSchedulerContextMenu> 
                            <Items> 
                                <telerik:RadMenuItem Text="New Announcement" Value="CustomAdd" /> 
                                <telerik:RadMenuItem Text="Go to today" Value="CommandGoToToday" /> 
                            </Items> 
                        </telerik:RadSchedulerContextMenu> 
                    </TimeSlotContextMenus> 
 
                    <AppointmentContextMenuSettings EnableDefault="true" /> 
                    <AppointmentContextMenus> 
                        <telerik:RadSchedulerContextMenu> 
                            <Items> 
                                <telerik:RadMenuItem Text="Edit" Value="CommandEdit" /> 
                                <telerik:RadMenuItem Text="Delete" Value="CommandDelete" /> 
                            </Items> 
                        </telerik:RadSchedulerContextMenu> 
                    </AppointmentContextMenus> 
                      
                    <%--Forms --%> 
                    <AdvancedForm Modal="true" /> 
 
                </telerik:RadScheduler> 
Kevin
Top achievements
Rank 1
 answered on 10 Dec 2010
1 answer
128 views
Hi all,

I've got a grid more or less with the same functionality as the one that you've got in the demo "Usercontrol edit form", this page is under a Master page that has got some buttons like a search button that raises the event search and a Reload is launched with all the needed params that fills a DataSet and binds to the datagrid.
My problem is that this search is not working, the event is fired, the dataset is filled with correct data, the Grid is rebinded but it doesn't show the correct data, it doesn't reload, I tried to solve with an update panel, it works pretty good but when I try to edit a row it throws me a jscript error that says me that "can't find update panel Ctl00_00_...", and if I haven't got the update panel my search event doesn't work.

This is the content of the page:
    <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server" 
        Visible="False">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="UPPantalla">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="GridAlbaranes" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="GridAlbaranes">
                <UpdatedControls>
          
                    <telerik:AjaxUpdatedControl ControlID="GridAlbaranes" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManagerProxy>
    <div id="box_Cabecera"
<div id="datos_Izquierda">
<ol>
    <li><asp:Label ID="LblProveedor" 
        runat="server" Text="Proveedor: " Font-Names="Trebuchet MS" 
        Font-Size="Small"  CssClass="literal"></asp:Label>
    <telerik:RadComboBox runat="server" ID="CmbProveedor" DataTextField="LargeName" 
        DataValueField="Account" 
            AllowCustomText="True" width="300px"  Filter="Contains" MarkFirstMatch="True"
        ></telerik:RadComboBox ></li>
        <li><asp:Label ID="LblAno" 
        runat="server" Text="Año: " Font-Names="Trebuchet MS" 
        Font-Size="Small"  CssClass="literal"></asp:Label>
    <telerik:RadNumericTextBox ID="TxbYear" Runat="server" ShowSpinButtons="True" 
               Font-Names="Trebuchet MS" Font-Size="Small" >
        <NumberFormat DecimalDigits="0" GroupSeparator="" />
    </telerik:RadNumericTextBox></li>
  
    </ol>
</div>
<div id="datos_Derecha">
<ol>
    <li><asp:Label 
        ID="LblCentro" runat="server" Text="Centro: " Font-Names="Trebuchet MS" 
        Font-Size="Small" CssClass="literal"></asp:Label>
    <telerik:RadComboBox runat="server" ID="CmbCentro" 
        DataTextField="ProfitCenterLargeName" DataValueField="ProfitCenterCode" 
         AllowCustomText="True" 
            Width="300px" height="200px" Filter="Contains" Skin="Sunset" ></telerik:RadComboBox>
  
    </li>
    <li>        <telerik:RadButton ID="BtnSoloSinValidar" runat="server" 
            AutoPostBack="False" BorderStyle="Groove" Checked="True" Skin="Sunset" 
            Text="Solo Albaranes no validados" ToggleType="CheckBox">
        </telerik:RadButton></li>
</ol>
</div></div>
<div id="Grid">
  
    <telerik:RadGrid runat="server" Skin="Sunset" Width="90%" ID="GridAlbaranes" 
            AutoGenerateColumns="False" GridLines="None">
        <MasterTableView>
            <CommandItemSettings ExportToPdfText="Export to Pdf" />
            <RowIndicatorColumn>
                <HeaderStyle Width="20px" />
            </RowIndicatorColumn>
            <ExpandCollapseColumn>
                <HeaderStyle Width="20px" />
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridEditCommandColumn ButtonType="ImageButton">
                </telerik:GridEditCommandColumn>
                <telerik:GridBoundColumn DataField="PCNameComplet" HeaderText="Centro" 
                    UniqueName="PCNameComplet">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="SupplierName" HeaderText="Proveedor" 
                    UniqueName="SupplierName">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="IdGRN" HeaderText="Albarán" 
                    UniqueName="IdGRN">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Year" HeaderText="Año" UniqueName="year">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Cuenta" HeaderText="Cuenta" 
                    UniqueName="Cuenta">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="SupplierAccount" 
                    HeaderText="Codigo Proveedor" UniqueName="SupplierAccount" Visible="False">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ProfitCenterCode" HeaderText="ProfitCenter" 
                    UniqueName="ProfitCenter">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Amount" HeaderText="Importe" 
                    UniqueName="Amount">
                </telerik:GridBoundColumn>
            </Columns>
              <EditFormSettings  UserControlName="../UserControl/CuGRN.ascx" EditFormType="WebUserControl">
                    <EditColumn UniqueName="EditCommandColumn">
                    </EditColumn>
                </EditFormSettings>
  
        </MasterTableView>
        <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Sunset" 
            EnableImageSprites="True">
        </HeaderContextMenu>
    </telerik:RadGrid>
  
</div>

And this is the VB:
Public Class ListadoAlbaranes
    Inherits System.Web.UI.Page
    Protected WithEvents Mymaster As Site
  
  
  
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  
        Mymaster = Me.Master
        If Not Me.IsPostBack Then
            LoadCombos()
            Me.TxbYear.Text = Today.Date.Year
            CargarGrid()
        End If
  
  
    End Sub
    Public Sub LoadCombos()
        '+-----------------------------------------------------
        '| Comments: Used to load combos.
        '+-----------------------------------------------------
        Dim Usuario As ClUsuario = New ClUsuario
        Usuario = CType(Session("Usuario"), ClUsuario)
        Dim c As New AraSql
        c.SqlServer = Usuario.SqlServer("Cotejador")
        c.CommandText = "Ara_CargaMaeSupandProfCen"
        c.Ejecutar()
        c.Tables(0).Rows.Add("0", "Todos")
        CmbProveedor.DataSource = c.Tables(0)
        CmbProveedor.DataBind()
        CmbProveedor.SelectedValue = "0"
        c.Tables(1).Rows.Add("0", "Todos")
        CmbCentro.DataSource = c.Tables(1)
        CmbCentro.DataBind()
        CmbCentro.SelectedValue = 0
    End Sub
    Private Sub CargarGrid()
        Try
            Dim usuario As ClUsuario = New ClUsuario
            Dim c As New AraSql
            c.SqlServer = usuario.SqlServer("Cotejador")
            c.CommandText = "Ara_ListGRNs"
            If CmbCentro.SelectedValue <> "0" Then
                c.NewParameter("@ProfitCenterCode", SqlDbType.VarChar, Me.CmbCentro.SelectedValue)
            End If
            If CmbProveedor.SelectedValue <> "0" Then
                c.NewParameter("@SupplierAccount", SqlDbType.VarChar, Me.CmbProveedor.SelectedValue)
            End If
            c.NewParameter("@Onlyopen", SqlDbType.Bit, Me.BtnSoloSinValidar.Checked)
            c.NewParameter("@year", SqlDbType.VarChar, Me.TxbYear.Value)
            c.Ejecutar()
            Me.GridAlbaranes.Dispose()
            Me.GridAlbaranes.DataSource = c.Tables(0)
  
  
        Catch ex As Exception
        End Try
  
    End Sub
    Private Sub ReloadGrid() Handles Mymaster.MasterFind
        GridAlbaranes.DataSource = Nothing
  
        GridAlbaranes.Rebind()
  
  
    End Sub
    Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles GridAlbaranes.NeedDataSource
        CargarGrid()
    End Sub
  
  
  
End Class

Is there anyway to use the radajaxmanagerproxy to make the grid reload when the Masterfind event is raised?


Thanks in advance,
Salva Mas
Top achievements
Rank 1
 answered on 09 Dec 2010
2 answers
103 views
I don't want to display the column selection option in context menu.

I am able to do that within HeaderContextMenu_PreRender

private void HeaderContextMenu_PreRender(object sender, EventArgs e)
{
    GridHeaderContextMenu menu = sender as GridHeaderContextMenu;
    foreach (RadMenuItem item in menu.Items)
        if (item.Text == "Columns")
        {
            item.Visible = false;
        }
}

But when I click on the menu I get this error in dynamic javascript.
code line:  var h=m.findItemByValue("ColumnsContainer").get_items();
Error: Microsoft JScript runtime error: 'findItemByValue(...)' is null or not an object

Any suggestions?

thanks

smdk
Top achievements
Rank 1
 answered on 09 Dec 2010
3 answers
122 views
Hi.

I am trying to integrate RadDatePicker into my sharepoint pages.
It seems to be display correctly but when I click on calandar icon, nothing show up.  it looks like it is trying to do postback when clicked, and put "#" at the end of querystring.

Also, AjaxPanel does not seem to be working either. I don't get any errors and it just not working.. it perfroms postback when click on one of my button.

Thanks

Marshall Scipio
Top achievements
Rank 1
 answered on 09 Dec 2010
2 answers
121 views

We are using the RadScheduler with Web Services binding. On inserting a new appointment, we would like to retrieve the ID of the appointment on the client side after the Web Service request is complete. Can we retrieve this in the result sent back from the service call in the OnClientRequestSuccess method? If so, what is the best approach for doing this? We noticed that the Insert method is passing back IEnumerable<AppointmentData>. How can this data be used?

If the OnClientRequestSuccess method is not the best approach, what other options are there?

By the way, we noticed that it is possible to return a SchedulerResult object with the GetAppointments method. Can that be done with the InsertAppointment method? If so, that would solve our problem.
Jose Granja
Top achievements
Rank 1
 answered on 09 Dec 2010
3 answers
101 views
I have a stored procedure that selects two columns from a single table - size (int) and date.  All I want to do is plot a line graph with the size, and have the X axis item labels show the dates recorded.

So, the data looks like this:
 
size | date 
224 | 1-5-10 
250 | 1-10-10 
156 | 1-22-10 

And this is what I ended up with when I tried to use the Wizard (bound to a SqlDataSource):

 <telerik:RadChart ID="RadChart1" runat="server" DataSourceID="SqlDataSource1"  
                    DefaultType="Line" Skin="Default"
                    <Series> 
                        <telerik:ChartSeries Name="Size" DataYColumn="size" Type="Line"  
                            DataXColumn="size"
                            <Appearance> 
                                <FillStyle MainColor="213, 247, 255"
                                </FillStyle> 
                            </Appearance> 
                        </telerik:ChartSeries> 
                    </Series> 
                    <PlotArea> 
                        <XAxis AutoScale="False" DataLabelsColumn="size"
                            </XAxis> 
                    </PlotArea> 
                </telerik:RadChart> 

What I want is to have the dates as the X axis labels, but I can't figure out how to do it.  It seems like this should be incredibly simple, but I just find the chart syntax really confusing.  Any help would be very much appreciated.



Ves
Telerik team
 answered on 09 Dec 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
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?