Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
67 views
Hi,
I am reading an excel spreadsheet and need to load a radgrid manually 1 row at at time.  Is there any good example code on how to programatically create radgrid headers and load data without using a datasource.

Thanks.
Jayesh Goyani
Top achievements
Rank 2
 answered on 26 Apr 2013
1 answer
91 views
HI,

I followed the code example from here: http://demos.telerik.com/aspnet-ajax/grid/examples/programming/alphabeticpaging/defaultvb.aspx?#qsf-demo-source

Now the Alpha paging works great but the numeric paging when I click on any page it comes completely balnk
When I click on enable sorting and click on it comes blank

Is there something missing in the demo site code
<%@ Page Title="" Language="VB" MasterPageFile="~/AdminPanel/Admin.master" AutoEventWireup="false" CodeFile="pager_test.aspx.vb" Inherits="AdminPanel_franchise_pager_test" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
 
 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadGrid2">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid2"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
  
    <br />
    <hr />
    <div style="border: 5px solid #eaf2fd; width: 95%;">
        <telerik:RadGrid ID="RadGrid2" DataSourceID="SqlDataSource2" AllowPaging="True" PageSize="5"
            runat="server" GridLines="None" Width="100%" AllowSorting="True"
            CellSpacing="0">
            <PagerStyle Mode="NextPrevAndNumeric" EnableSEOPaging="False"></PagerStyle>
            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
            <ItemStyle HorizontalAlign="Center"></ItemStyle>
            <AlternatingItemStyle HorizontalAlign="Center"></AlternatingItemStyle>
            <MasterTableView CommandItemDisplay="Top">
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
 
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
 
<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"
                    Created="True"></ExpandCollapseColumn>
 
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
 
<PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
                <CommandItemTemplate>
                    <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
                </CommandItemTemplate>
            </MasterTableView>
 
<FilterMenu EnableImageSprites="False"></FilterMenu>
        </telerik:RadGrid>
    </div>
    <br />
  
    <asp:SqlDataSource ID="SqlDataSource2" runat="server"  ConnectionString="<%$ ConnectionStrings:SQL %>"
         
        SelectCommand="SELECT [a], [b], [c], [d], [e] FROM [franchises] WHERE ([xyz] LIKE @xyz)">
        <SelectParameters>
            <asp:Parameter Name="xyz" Type="String" DefaultValue="%" />
        </SelectParameters>
    </asp:SqlDataSource>
 
</asp:Content>

Protected Sub RadGrid2_ItemCreated(ByVal sender As Object, ByVal e As GridItemEventArgs) Handles RadGrid2.ItemCreated
       If TypeOf e.Item Is GridCommandItem Then
           Dim commandItem As GridCommandItem = CType(e.Item, GridCommandItem)
           Dim container As PlaceHolder = commandItem.FindControl("PlaceHolder1")
 
           Dim i As Integer
           For i = 65 To 65 + 25
               Dim linkButton1 As New LinkButton
               Dim lc As New LiteralControl("  ")
               linkButton1.Text = "" + ChrW(i)
 
               linkButton1.CommandName = "alpha"
               linkButton1.CommandArgument = "" + ChrW(i)
 
               container.Controls.Add(linkButton1)
               container.Controls.Add(lc)
           Next i
 
           Dim lcLast As New LiteralControl(" ")
           container.Controls.Add(lcLast)
 
           Dim linkButtonAll As New LinkButton
           linkButtonAll.Text = "All"
           linkButtonAll.CommandName = "NoFilter"
           container.Controls.Add(linkButtonAll)
       End If
   End Sub
 
   Protected Sub RadGrid2_ItemCommand(ByVal source As Object, ByVal e As GridCommandEventArgs) Handles RadGrid2.ItemCommand
       Dim value As String = Nothing
       Select Case e.CommandName
           Case ("alpha")
               value = String.Format("{0}%", e.CommandArgument)
               Exit Select
           Case ("NoFilter")
               value = "%"
               Exit Select
       End Select
       SqlDataSource2.SelectParameters("xyz").DefaultValue = value
       RadGrid2.Rebind()
   End Sub

Pavlina
Telerik team
 answered on 26 Apr 2013
0 answers
213 views
Hi,

I am trying to get monthly wise details from treeview.

1. I can able to bind the Treeview details, 
2. Once the user clicks the month , i need to show the monthly wise details on the Grid. 

I have tried to get the Grid from radtreenode, I failed. Please help me out from this

Please find the below code for your reference.

<telerik:RadTreeView ID="treeViewClientBudget" runat="server" OnNodeClick="treeViewClientBudget_NodeClick">
                        
                        
                        <Nodes>
                            
                            <telerik:RadTreeNode  Text="BudgetNode">
                                
                                <NodeTemplate>
                                    

                                    <telerik:RadGrid ID="grdBudgetDetail" Width="85%" BorderWidth="0" GridLines="None"
                                        runat="server"
                                        AutoGenerateColumns="False">
                                        <ClientSettings>
                                            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                                        </ClientSettings>

                                        <MasterTableView DataKeyNames="Month,Year" HierarchyLoadMode="ServerOnDemand">



                                            <DetailTables>
                                                <telerik:GridTableView runat="server"
                                                    DataKeyNames="Month,Year,ClassificationId" Name="Classification">
                                                    <Columns>
                                                        <telerik:GridBoundColumn DataField="ClassificationName"
                                                            FilterControlAltText="Filter Division column" UniqueName="ClassificationName" HeaderText="Classification Name">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="ActualForecast"
                                                            HeaderText="Actual Forecast"
                                                            UniqueName="ActualForecast">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="BudgedForecast"
                                                            HeaderText="Budged Forecast"
                                                            UniqueName="BudgedForecast">
                                                        </telerik:GridBoundColumn>
                                                    </Columns>
                                                    <DetailTables>

                                                        <telerik:GridTableView runat="server" Name="Vendor"
                                                            DataKeyNames="Month,Year,ClassificationId,VendorId">

                                                            <Columns>

                                                                <telerik:GridBoundColumn DataField="VendorName"
                                                                    FilterControlAltText="Filter Division column" UniqueName="VendorName" HeaderText="Vendor Name">
                                                                </telerik:GridBoundColumn>

                                                                <telerik:GridBoundColumn DataField="ActualForecast"
                                                                    HeaderText="Actual Forecast"
                                                                    UniqueName="ActualForecast">
                                                                </telerik:GridBoundColumn>

                                                                <telerik:GridBoundColumn DataField="BudgedForecast"
                                                                    HeaderText="Budged Forecast"
                                                                    UniqueName="BudgedForecast">
                                                                </telerik:GridBoundColumn>

                                                            </Columns>
                                                        </telerik:GridTableView>
                                                    </DetailTables>
                                                </telerik:GridTableView>

                                            </DetailTables>

                                            <Columns>
                                                <telerik:GridBoundColumn DataField="Month" FilterControlAltText="Filter 

Division column"
                                                    HeaderText="Month">
                                                </telerik:GridBoundColumn>

                                                <telerik:GridBoundColumn DataField="Year" FilterControlAltText="Filter 

Division column"
                                                    HeaderText="Year">
                                                </telerik:GridBoundColumn>

                                                <telerik:GridBoundColumn DataField="ActualForecast" HeaderText="Actual($) "
                                                    UniqueName="ActualForecast">
                                                </telerik:GridBoundColumn>

                                                <telerik:GridBoundColumn DataField="BudgedForecast" HeaderText="Budged ($)"
                                                    UniqueName="BudgedForecast">
                                                </telerik:GridBoundColumn>

                                            </Columns>

                                        </MasterTableView>

                                    </telerik:RadGrid>

                                </NodeTemplate>
                            </telerik:RadTreeNode>
                        </Nodes>
                        
                    </telerik:RadTreeView>


#.CS 

 protected void treeViewClientBudget_NodeClick(object sender, RadTreeNodeEventArgs e)
    {
        for (int i = 0; i < treeViewClientBudget.Nodes.Count; i++)
        {
            if (i==e.Node.Index)
            {
                RadTreeNode budgetNode = treeViewClientBudget.Nodes[i].TreeView.FindNodeByText("BudgetNode");
                   RadGrid grid = (RadGrid)treeViewClientBudget.Nodes[i].FindControl("grdBudgetDetail");
            }
         
          
        }


Regards,
Saravanan M
Saravanan
Top achievements
Rank 1
 asked on 26 Apr 2013
1 answer
660 views
Hi all,

I have the following simple grid.

<telerik:RadGrid ID="grdMyGrid" runat="server" 
   AutoGenerateColumns="false"
   OnNeedDataSource="grdNewEpidomaTheshs_NeedDataSource">
   <MasterTableView EditMode="InPlace"  CommandItemDisplay="Top" 
      CommandItemSettings-AddNewRecordText="Add new record">
       
      <
NoRecordsTemplate>No records available</NoRecordsTemplate>
      <Columns> ... some columns ...</Columns>
   </MasterTableView>
</telerik:RadGrid>

All I want to do is hide the row containing the "add new record" when another row is in edit mode, i.e. when the edit button has been 
clicked
Giorgos
Top achievements
Rank 1
 answered on 26 Apr 2013
2 answers
60 views
Hi;

We would like to swap out the standard menu and use the ribbon menu instead. Is there a way to do this?

thanks - dave
David Thielen
Top achievements
Rank 1
 answered on 26 Apr 2013
3 answers
151 views
Hello,

I am creating a RadGrid programmatically in the Page_Init. One of my columns I need to use the GridTemplateColumn to show a text box. The text box will initially come up with a numeric value. The user has the ability to change the value in the text box. The value is required and needs to be an integer. Once they have typed their new value and focus is lost from the text box, I would like to gather some other information on the same row, run some javascript to show a message with not only the new value they typed in but some of the other information on the row. I cannot seem to figure out how to do this. I have it where the grid shows with the correct information and text box in the column. The user can change the value. Here is where I need help. Once the textbox loses focus I would like to do some javascript on the new value and other values associated to the row the textbox is on. Below is my code to create the columns.

Page_Init
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
    'CODEGEN: This method call is required by the Web Form Designer
    'Do not modify it using the code editor.
    InitializeComponent()
    defineGridStructure()
End Sub

defineGridStructure
Private Sub defineGridStructure()
    RadGrid1.ID = "RadGrid1"
    RadGrid1.Width = Unit.Pixel(1500)
    RadGrid1.MasterTableView.EditMode = GridEditMode.InPlace
    RadGrid1.AllowPaging = True
    RadGrid1.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric
    RadGrid1.AutoGenerateColumns = False
    RadGrid1.ShowStatusBar = True
    RadGrid1.AllowSorting = True
    RadGrid1.AllowFilteringByColumn = True
    RadGrid1.Skin = "WebBlue"
    RadGrid1.ClientSettings.ClientEvents.OnGridCreated = "GetGridObject"
    RadGrid1.ClientSettings.Scrolling.FrozenColumnsCount = 2
    RadGrid1.ClientSettings.AllowColumnsReorder = True
    RadGrid1.ClientSettings.ColumnsReorderMethod = GridClientSettings.GridColumnsReorderMethod.Swap
    RadGrid1.ClientSettings.Selecting.AllowRowSelect = True
    RadGrid1.ClientSettings.Resizing.AllowColumnResize = True
    RadGrid1.ClientSettings.Scrolling.AllowScroll = True
    RadGrid1.ClientSettings.Scrolling.UseStaticHeaders = True
    RadGrid1.ClientSettings.Scrolling.SaveScrollPosition = True
    RadGrid1.ClientSettings.Selecting.AllowRowSelect = True
    RadGrid1.ClientSettings.ClientEvents.OnRowSelected = "rowSelected"
    RadGrid1.MasterTableView.PageSize = 100
    RadGrid1.MasterTableView.AllowMultiColumnSorting = True
    RadGrid1.MasterTableView.DataKeyNames = New String() {"VendorListID"}
    columnCreation("Geography", "Geography", RadGrid1)
    columnCreation("Circ Type", "CirculationTypeDescription", RadGrid1)
    columnCreation("Household", "HouseHold_Count", RadGrid1)
    columnCreation("Total Cov", "TotalCoverage", RadGrid1)
    columnCreation("Day", "Day", RadGrid1)
    columnCreation("Selected", "Selected", RadGrid1)
    columnCreation("Circ", "Circ", RadGrid1)
    columnCreation("Coverage", "Coverage", RadGrid1)
    Me.PlaceHolder1.Controls.Add(RadGrid1)
End Sub

columnCreation
Private Sub columnCreation(ByVal colName As String, ByVal fieldName As String, ByVal oRadGrid As RadGrid)
    If colName = "Circ" Then
        Dim numericColumn = New GridTemplateColumn
        numericColumn.ItemTemplate = New MyEditTemplate(fieldName)
        numericColumn.DataField = fieldName
        numericColumn.HeaderText = colName
        numericColumn.UniqueName = fieldName
        numericColumn.FilterControlWidth = Unit.Pixel(60)
        oRadGrid.MasterTableView.Columns.Add(numericColumn)
   End If
End Sub

MyEditTemplate
Public Class MyEditTemplate
    Implements ITemplate
    Protected textBox As TextBox
    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
        textBox = New TextBox()
        textBox.ID = colname
        AddHandler textBox.DataBinding, _
                   AddressOf textBox_DataBinding
  
        container.Controls.Add(textBox)
    End Sub
    Sub textBox_DataBinding(ByVal sender As Object, ByVal e As EventArgs)
        Dim cTextBox As TextBox = DirectCast(sender, TextBox)
        Dim container As GridDataItem = DirectCast(cTextBox.NamingContainer, GridDataItem)
        cTextBox.Text = (DirectCast(container.DataItem, DataRowView))(colname).ToString()
    End Sub
End Class

I use the RadGrid1_NeedDataSource to acquire the information from the database, and then use the RadGrid1_ItemDataBound to set the information up correctly.

RadGrid1_ItemDataBound
Public Sub RadGrid1_ItemDataBound(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound
    If (TypeOf (e.Item) Is GridDataItem) Then
        Dim dataBoundItem As GridDataItem = e.Item
        Dim dataRow As DataRowView = dataBoundItem.DataItem
        Dim index As Integer = dataBoundItem.ItemIndex
        dataBoundItem("Geography").Text = dataBoundItem("Geography").Text.Trim
    End If
End Sub

So, again, what I would like to do is have the user be able to change the value in my textbox. Validate that it is filled in and an integer. Then display an alert() to the user that the information has changed and give them the Geography, Circ Type and Day on the message.

I kind of do something like it with a checkbox template column.

MyTemplate
Public 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 = colname
        AddHandler boolValue.DataBinding, _
                   AddressOf boolValue_DataBinding
        boolValue.Enabled = True
        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 GridDataItem = DirectCast(cBox.NamingContainer, GridDataItem)
        If ((DirectCast(container.DataItem, DataRowView))(colname)) = 1 Or ((DirectCast(container.DataItem, DataRowView))(colname)) = True Then
            cBox.Checked = True
        Else
            cBox.Checked = False
        End If
    End Sub
End Class
 and then in the RadGrid1_ItemDataBound
dataBoundItem("Selected").Attributes.Add("onClick", "javascript:return fnSelectDayForTelerik(" & index & "," & mode & "," & mintEventID & "," & circType & "," & day & "," & ddlCircSet.SelectedItem.Value & ",'" & mstrSessionID & "'," & Request("PARID") & ",'" & Trim(UCase(Request("TargetGeo"))) & "',0);")
dataBoundItem("Forced").Attributes.Add("onClick", "javascript:return fnSelectDayForTelerik(" & index & "," & mode & "," & mintEventID & "," & circType & "," & day & "," & ddlCircSet.SelectedItem.Value & ",'" & mstrSessionID & "'," & Request("PARID") & ",'" & Trim(UCase(Request("TargetGeo"))) & "',1);")

But if I try the same logic on my Circ dataBoundItem with a onChange or onBlur, nothing fires.
David Kucharski
Top achievements
Rank 1
 answered on 26 Apr 2013
1 answer
58 views
Does the TreeViewList support the ability to drag and drop documents onto the treeviewlist?  I would like to capture the path of the document being dragged, and get the location of the node where it is being dropped.

Please let me know.

Thanks,
Pavlina
Telerik team
 answered on 26 Apr 2013
25 answers
2.8K+ views
The ContentType (aka MIME) is coming in as application/octet-stream, no matter what browser I'm using (IE8, FF, Chrome, etc).  I can't figure out why.  Any input is greatly appreciated.

Thanks,
Chris
p
Top achievements
Rank 1
 answered on 26 Apr 2013
2 answers
143 views
This is probally easy question for somebody but I am a little green to Telerik and Ajax.  I have a radlistbox bound to a datasource, it has 3 fields, id, desc and flag.  I have it populating just fine but what fires the automatic update event?  All the items that are flag are on or off as they should be but when I click the checkbox to turn an item on or off the listbox doesn't even appear to do anything.  Do I need some code behind other than automatic updates = true and post back = true to make the update to the checkbox save to the database? 

            <telerik:RadListBox ID="lbOrgLevels" runat="server" DataSourceID="sqlGetOrgLevels" DataKeyField="OrgLevelID" CheckBoxes ="true" style="top: 0px; left: 0px; width: 459px" OnItemDataBound="lbOrgLevels_ItemDataBound" AllowAutomaticUpdates="True" AutoPostBack="True" Skin="Sitefinity" DataSortField="OrgLevelDescription" DataTextField="OrgLevelDescription" DataValueField="Active">
            </telerik:RadListBox>

            <UpdateParameters>
                <asp:Parameter Direction="Input" Name="Active" Type="Boolean"></asp:Parameter>
                <asp:Parameter Direction="Input" Name="OrgLevelID" Type="Int32"></asp:Parameter>
            </UpdateParameters>

Protected Sub lbOrgLevels_ItemDataBound............
        e.Item.Text = (DirectCast(e.Item.DataItem, DataRowView))("OrgLevelID").ToString().Trim() _
                 + "- " + (DirectCast(e.Item.DataItem, DataRowView))("OrgLevelDescription").ToString().Trim()

        e.Item.Value = (DirectCast(e.Item.DataItem, DataRowView))("Active").ToString()
        e.Item.Checked = (DirectCast(e.Item.DataItem, DataRowView))("Active").ToString()
        e.Item.DataBind()
End Sub


thanks for any help.
Nencho
Telerik team
 answered on 26 Apr 2013
1 answer
123 views
Is there any way to add a sliding label that follows the pointer on a linear gauge and be updated with the value of pointer?  If the functionality is not built into the control, are there any ideas on how to accomplish this? 

Thanks for any help offered.
Danail Vasilev
Telerik team
 answered on 26 Apr 2013
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?