Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
246 views
I'm trying to put checkbox in menu item and I started from this tutorial :
 http://www.telerik.com/help/aspnet-ajax/tool_templatesoverview.html

I'm able to put checkbox whithout problem, but I found that the behavior of the CSS is strange when I mouse over. The background image is cut instead of occupying all the menu item(see attached images for comparaison of the menu item with and without item template set). I want to know if I can have the original behavior or at least remove the background image beacause I can't seem to be able to replace it. In fact, I'm not very experienced in css, I tried both those Css in setting the hoveredCssClass :

Remove the image
background-image:none !important;
 
Replace the image
background-image:"~\Image\img.png" !important;

Still the same result. Here is the code, mostly from the tutorial, just replace a textbox with a checkbox.
<telerik:RadToolBar ID="RadToolBar1" runat="server">
 <Items>
   <telerik:RadToolBarButton runat="server" Text="Button 1" DisplayName="TextBox1">
     <ItemTemplate>
       <input type="text" value='<%# DataBinder.Eval(Container, "Attributes['DisplayName']") %>' />                       
     </ItemTemplate>
   </telerik:RadToolBarButton>
   <telerik:RadToolBarDropDown runat="server" Text="DropDown 1" DisplayName="DropDown">
     <Buttons>
       <telerik:RadToolBarButton runat="server" Text="Child Button 1" DisplayName="TextBox11">
         <ItemTemplate>
           <input type="checkbox" value='<%# DataBinder.Eval(Container, "Attributes['DisplayName']") %>' />                       
         </ItemTemplate>
       </telerik:RadToolBarButton>
       <telerik:RadToolBarButton runat="server" Text="Child Button 2" DisplayName="TextBox21">
         <ItemTemplate>
          <input type="text" value='<%# DataBinder.Eval(Container, "Attributes['DisplayName']") %>' />                       
         </ItemTemplate>
       </telerik:RadToolBarButton>
     </Buttons>
   </telerik:RadToolBarDropDown>
   <telerik:RadToolBarSplitButton runat="server" Text="SplitButton 1" DisplayName="SplitButton">                   
     <Buttons>
       <telerik:RadToolBarButton runat="server" Text="Child Button 1">
       </telerik:RadToolBarButton>
       <telerik:RadToolBarButton runat="server" Text="Child Button 2">
       </telerik:RadToolBarButton>
     </Buttons>
   </telerik:RadToolBarSplitButton>
 </Items> 
</telerik:RadToolBar>

Hope you find my solution.
Sébastien
Yana
Telerik team
 answered on 29 Jul 2010
1 answer
106 views

Hi, i'm using a RadTreeView with a RadTreeViewContextMenu.

At my page load i'm building the contextmenu with my options.
Each RadMenuItem is defined with de code below.

RadMenuItem item=new RadMenuItem('Description','../GestaoEntidade.aspx?mode=ins&type='+xxx);
item.Target = "paneMain";

After my menu is finish, i'm adding it to the tree context menu collection.
Then when i'm building the tree i assing too all my nodes the context menu ID;
node.ContextMenuID = contexMenu.ID;

With this i'm trying to achive the following:
open the contextmenu of a node, choose an item, put the node in session and navigate to the item.navigateUrl.

My trouble is to put the node in session.

I've tryed to use the OnContextMenuItemClick event and this puts the node in session but looses the capability of navigate to the item specified url

protected void OnContextMenuItemClick(Object sender, RadTreeViewContextMenuEventArgs e){
Session["TreeNode"]=(RadTreeNode)e.Node;
}
If i do the following, i loose the item.Target hability.
protected void OnContextMenuItemClick(Object sender, RadTreeViewContextMenuEventArgs e){
Session["TreeNode"]=(RadTreeNode)e.Node;
Response.Redirect(e.ItemMenu.navigateUrl);
}

In the end what a want is to navigate to another page, but this page should open in the specified target and have the node information in that page.
Without have to build a menu for each treeNode. Because if i do that everything works fine.

Can someone englight me on the path to follow? If anymore information needed please ask me.

By the way i'm using IE8 and the version of Telerik Controls is 2009.2.286.

Thanks in advance.
Nuno Chumbo

Nikolay Tsenkov
Telerik team
 answered on 29 Jul 2010
1 answer
109 views
Hi,
I have a RadCombo inside div..
.
.
.
<div>
  
<div style="font-size: 15px">
  
<b>Manage records</b>
  
</div>
  
<br />
  
<div>
  
<b>ADD New Record: </b> 
  
<telerik:RadComboBox ID="ddl2" runat="server" EmptyMessage="Type a Record"
  
DataSourceID="SqlDataSource6" DataTextField="name" DataValueField="id"
  
Skin="Web20">
  
</telerik:RadComboBox>
.
.
.

When i click the drop down button most of the times the list will appear on the top of the page!
I dont use a modalpopupextender neither on the master nor on the child page...
I use ie 7 and on the master page there is the following style:

<style type="text/css" >
        div, td, span,li ,ul
        {
            -moz-box-sizing:border-box;
            box-sizing:border-box;
        }
    </style>

Any sugestions on the problem would be helpfull!
Kalina
Telerik team
 answered on 29 Jul 2010
3 answers
152 views
I have web user control with RadScheduler (Q1 2010 SP1) which works fine with ASP.Net
I am using ObjectDataSource.

When trying to move the code to SharePoint 2010 I have a lot of problems.
Initially the problems were around web.config - ObjectDataSource and SafeControls.

I think I resolved them but I still can't get the scheduler to render properly - headers/colors show OK but the table with timeslots is "squished" to single vertical line and I javascript error:

Message: '0._preInitialized' is null or not an object
Line: 1050
Char: 1
Code: 0
....
How to initialize properly RadScheduler in Sharepoint? Not sure if this is related to SPS 2010?


Peter
Telerik team
 answered on 29 Jul 2010
3 answers
140 views
Hi ,

 I'm using Ajax RadGrid with NestedViewTamplates. So when I insert a row into master table, after inserting I would like to expand the inserted row,  and work with content in nestedview template
And second question is how I can put inserted row at top of table, right now it goes botoom

Thank you for your answer


Shinu
Top achievements
Rank 2
 answered on 29 Jul 2010
1 answer
68 views
I have a Radgrid that is using a OpenAccess data source.  Due to some complex business rules, I can not do all of my data filtering at the data source.  Is it possible to not bind specific rows to the grid that come back from the data source?  I have tries setting the rows to not be visible but then I have a weird issue where all of my row counts are are off by the number of hidden rows.

Thanks for any suggestions.

Josh
Tsvetoslav
Telerik team
 answered on 29 Jul 2010
2 answers
103 views
This code is loosely based on several of the demos. My main problem here is that when i run my program and happen to see my gridview the datas are not the same as with my datas in my table in my database.

And when i tried to hit the edit button.. and make some few changes.. it updates my gridview but not the same as my datas in my table in my database..

hope someone could lend a helping hand..

here's my code.. by the way i'm just a newbie in asp.net ..please be gentle.. thanks

ASPX

<%@ Page Language="VB" MasterPageFile="~/Admin/Admin.master" AutoEventWireup="false" CodeFile="TeacherRole.aspx.vb" Inherits="Admin_TeacherRole" title="Untitled Page" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">
     
  
<html>
 
<body>
       <!-- content start -->
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
 
        <script type="text/javascript">
            function RowDblClick(sender, eventArgs) {
                sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
            }
        </script>
 
    </telerik:RadCodeBlock>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" 
        DefaultLoadingPanelID="RadAjaxLoadingPanel1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
 
       <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True"
            AllowPaging="True" AllowSorting="True" OnUpdateCommand = "RadGrid1_UpdateCommand"
            AutoGenerateEditColumn="True"  GridLines="None"
            Skin="Black"
        AllowAutomaticUpdates="True" ShowGroupPanel="True" GroupPanel-ID = "RadAjaxLoadingPanel1">
         
             <MasterTableView EditMode="PopUp" AutoGenerateColumns="False"  DataKeyNames = "user_id"
                CommandItemDisplay="Top">
                 
                <Columns>
                     <telerik:GridBoundColumn DataField="user_id" DataType="System.Int32"
                        HeaderText="User ID" SortExpression="user_id" UniqueName="user_id" ReadOnly="True">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="lastname" HeaderText="Last Name"
                        SortExpression="lastname" UniqueName="lastname" ReadOnly="False">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="firstname" HeaderText="First Name"
                        SortExpression="firstname" UniqueName="firstname" ReadOnly="False">
                    </telerik:GridBoundColumn>
 
                </Columns>
                 
                <EditFormSettings CaptionFormatString="Edit User ID: {0}"  CaptionDataField="user_id" PopUpSettings-Modal="True" PopUpSettings-ScrollBars="Auto"
                EditFormType= "AutoGenerated">
                    <FormTableItemStyle Width="100%" Height="29px"></FormTableItemStyle>
                    <FormTableStyle GridLines="None" CellSpacing="0" CellPadding="2"></FormTableStyle>
                    <FormStyle Width="100%" BackColor="#eef2ea"></FormStyle>
                    <EditColumn ButtonType="PushButton" />
                     
<PopUpSettings ScrollBars="Auto" Modal="True"></PopUpSettings>
                </EditFormSettings>
            </MasterTableView>
             <ClientSettings AllowDragToGroup="True">
                <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                <ClientEvents OnRowDblClick="RowDblClick" />
            </ClientSettings>
        </telerik:RadGrid>
   
    
    <!-- content end -->
 
</body>
</html>
</asp:Content>


VB
Imports System
Imports System.Configuration
Imports System.Data
Imports System.Data.Common
Imports System.Data.SqlClient
Imports System.Globalization
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports Telerik.Web.UI
 
Partial Class Admin_TeacherRole
    Inherits System.Web.UI.Page
 
    Private Sub RadGrid1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGrid1.PreRender
        If Not IsPostBack Then
            For Each item As GridItem In RadGrid1.MasterTableView.Items
                If TypeOf item Is GridEditableItem Then
                    Dim editableItem As GridEditableItem = CType(item, GridDataItem)
                    editableItem.Edit = True
                End If
            Next
            RadGrid1.Rebind()
        End If
    End Sub
    Private Sub Page_PreRender(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.PreRender
        If Not MyBase.IsPostBack Then
            Me.RadGrid1.MasterTableView.Items(0).Edit = True
            Me.RadGrid1.MasterTableView.Rebind()
        End If
    End Sub
    Public ReadOnly Property UserData() As DataSet
        Get
            Dim obj As Object = Me.Session("UserData")
            If Not obj Is Nothing Then
                Return CType(obj, DataSet)
            End If
 
            Dim MyUserData As DataSet = New DataSet
 
            Dim ConnString As String = ConfigurationManager.ConnectionStrings("ProLearnConnectionString").ConnectionString
            Dim conn As SqlConnection = New SqlConnection(ConnString)
            Dim adapter As SqlDataAdapter = New SqlDataAdapter
            adapter.SelectCommand = New SqlCommand("SELECT user_id, lastname, firstname FROM tblStudents ORDER BY user_id", conn)
 
            adapter.Fill(MyUserData, "tblStudents")
 
            Me.Session("UserData") = MyUserData
 
            Return MyUserData
        End Get
    End Property
    Private Sub RadGrid1_NeedDataSource(ByVal source As System.Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource
        RadGrid1.DataSource = Me.UserData
        Me.UserData.Tables("tblStudents").PrimaryKey = New DataColumn() {Me.UserData.Tables("tblStudents").Columns("user_id")}
    End Sub
    Protected Sub RadGrid1_UpdateCommand(ByVal source As System.Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.UpdateCommand
 
        Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem)
        Dim editMan As GridEditManager = editedItem.EditManager
 
        Dim column As GridColumn
 
        For Each column In e.Item.OwnerTableView.Columns
            If TypeOf column Is IGridEditableColumn Then
                Dim editableCol As IGridEditableColumn = CType(column, IGridEditableColumn)
                If (editableCol.IsEditable) Then
                    Dim editor As IGridColumnEditor = editMan.GetColumnEditor(editableCol)
 
                    Dim editorType As String = CType(editor, Object).ToString()
                    Dim editorText As String = "unknown"
                    Dim editorValue As Object = Nothing
 
                    If (TypeOf editor Is GridTextColumnEditor) Then
                        editorText = CType(editor, GridTextColumnEditor).Text
                        editorValue = CType(editor, GridTextColumnEditor).Text
                    End If
 
                    If (TypeOf editor Is GridBoolColumnEditor) Then
                        editorText = CType(editor, GridBoolColumnEditor).Value.ToString()
                        editorValue = CType(editor, GridBoolColumnEditor).Value
                    End If
 
                    If (TypeOf editor Is GridDropDownColumnEditor) Then
                        editorText = CType(editor, GridDropDownColumnEditor).SelectedText & "; " & CType(editor, GridDropDownColumnEditor).SelectedValue
                        editorValue = CType(editor, GridDropDownColumnEditor).SelectedValue
                    End If
 
                    Try
                        Dim changedRows As DataRow() = Me.UserData.Tables("tblStudents").Select("user_id = " & editedItem.OwnerTableView.DataKeyValues(editedItem.ItemIndex)("user_id"))
                        changedRows(0)(column.UniqueName) = editorValue
                        Me.UserData.Tables("tblStudents").AcceptChanges()
 
                    Catch ex As Exception
                        RadGrid1.Controls.Add(New LiteralControl("<strong>Unable to set value of column '" & column.UniqueName & "'</strong> - " + ex.Message))
                        e.Canceled = True
                    End Try
 
                End If
            End If
        Next
 
 
    End Sub
 
End Class
Radoslav
Telerik team
 answered on 29 Jul 2010
1 answer
76 views
Hi Telerik Support team,
                 I am using Telerik Radgrid,RadTree and RadTabcontrol for my website.When i browse in IE8 it has a good response rate.But when i use IE7 to browse it is really too slow.I think these might be a Telerik rendering problem.Hope you get me some solution.

Thanks
Deepan
 
   
Iana Tsolova
Telerik team
 answered on 29 Jul 2010
1 answer
192 views
Hello,
sorry but after several searches I could not find how to set filter conditions programmatically and show them in rad filter , any suggestion would be appreciated,
thanks
Nikolay Rusev
Telerik team
 answered on 29 Jul 2010
1 answer
128 views
OK so i have a Grid that Uses a Global Template.

I need to get a cell value of the Selected record to compare it for validation. All i seem to get client-side is the Template Column HTML

Here is my Code

<telerik:RadGrid ID="ClassGrid" runat="server" AllowMultiRowSelection="false" AutoGenerateColumns="False"
    OnNeedDataSource="ClassGrid_NeedDataSource" OnDataBound="ClassGrid_DataBound"
    Skin="WebBlue" GridLines="Both" ShowGroupPanel="false"  ShowHeader="true" OnItemDataBound="ClassGrid_ItemDataBound"
    AllowPaging="true" PageSize="10" AllowFilteringByColumn="true">
    <ExportSettings FileName="AvailableClassListExport" ExportOnlyData="true" OpenInNewWindow="True"
        HideStructureColumns="true">
    </ExportSettings>
    <MasterTableView Width="100%" CommandItemDisplay="TopAndBottom" PagerStyle-AlwaysVisible="true">
        <CommandItemSettings ShowAddNewRecordButton="false" ShowExportToExcelButton="true"
            ShowExportToCsvButton="true" ShowExportToWordButton="true" ShowExportToPdfButton="true" />
        <RowIndicatorColumn Visible="True">
        </RowIndicatorColumn>
        <ItemTemplate>
            <div style="float:left; padding: 0px 15px 0px 0px">
                <span><b>
                    <%#Eval("Class_Date", "{0:MMM dd, yyyy}")%></b>
                    <br />
                    <%#Eval("Class_Start_Time").ToString()%>
                    -
                    <%#Eval("Class_End_Time").ToString()%>
                    <br /><br /><br /><br /><br />
                </span>
            </div>
            <div>
                <span><b>
                    <%# Container.DataItem("Location_Name") %></b>
                    <%#IIf(Container.DataItem("isSpanish") = "Y", " (Spanish)", " (English)")%>
                    <br />
                    <%# Container.DataItem("Street_Address") %>
                    <br />
                    <%# Container.DataItem("City") %>,
                    <%# Container.DataItem("FK_State_Code") %>
                    <%# Container.DataItem("Zip") %>
                    <br />
                    <b>Cross Streets:</b>
                    <%# container.DataItem("Cross_Streets") %>
                    <br />
                    <!-- Map -->
                    <%#"<a href=""http://www.mapquest.com/maps?city=" + Container.DataItem("City") + "&state=" + Container.DataItem("FK_State_Code") + "&address=" + Container.DataItem("Street_Address") + "&zipcode=" + Container.DataItem("Zip") + "&country=US&CID=lfmaplink"" target=""_Blank"">Map</a>"%>
                    <!-- Seperator -->
                    |
                    <!-- Directions -->
                    <%#"<a href=""http://www.mapquest.com/maps?2c=" + Container.DataItem("City") + "&2s=" + Container.DataItem("FK_State_Code") + "&2a=" + Container.DataItem("Street_Address") + "&2z=" + Container.DataItem("Zip") + "&2y=US&Form=directions&CID=lfddlink"" target=""_Blank"">Directions</a>"%>
                    <br />
                    <br />
                </span>
            </div>
        </ItemTemplate>
        <Columns>
            <telerik:GridBoundColumn DataField="Class_ID" Display="false" HeaderText="ID">
            </telerik:GridBoundColumn>
            <telerik:GridDateTimeColumn UniqueName="Class_Date" DataField="Class_Date" Display="true" HeaderText="Date"
                AllowFiltering="true" PickerType="DatePicker" ItemStyle-Width="200px">
            </telerik:GridDateTimeColumn>
            <telerik:GridBoundColumn DataField="Class_Start_Time" Display="false" HeaderText="Start Time"
                AllowFiltering="true">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Class_End_Time" Display="false" HeaderText="End Time"
                AllowFiltering="true">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Location_Name" Display="false" HeaderText="Location">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Street_Address" Display="false" HeaderText="Address">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="City" Display="false" HeaderText="_City">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="FK_State_Code" Display="false" HeaderText="State">
            </telerik:GridBoundColumn>
            <telerik:GridDateTimeColumn DataField="Zip" Display="false" HeaderText="Zip">
            </telerik:GridDateTimeColumn>
            <telerik:GridBoundColumn DataField="Class_Status" Display="false" HeaderText="Status">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="isSpanish" Display="false" HeaderText="Spanish"
                AllowFiltering="true">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Location_DisplayCity" Display="false" HeaderText="City"
                AllowFiltering="true">
            </telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
    <ClientSettings ReorderColumnsOnClient="True" AllowDragToGroup="True" AllowColumnsReorder="True">
        <Selecting AllowRowSelect="True"></Selecting>
        <Resizing AllowRowResize="True" AllowColumnResize="True" EnableRealTimeResize="True"
            ResizeGridOnColumnResize="False"></Resizing>
    </ClientSettings>
    <GroupingSettings ShowUnGroupButton="true" />
    <PagerStyle Mode="NextPrevAndNumeric" Position="TopAndBottom" />
</telerik:RadGrid>


Heres my Test JS Code

<script type="text/javascript">
                window.setTimeout("TEST();", 5000);
                function TEST()
                {
                var _ClassGrid = $find("<%= AZADDClassGrid.ClientID %>_ClassGrid");
                     var _MasterTable = _ClassGrid.get_masterTableView();
                     var _SelectedRows = _ClassGrid.get_selectedItems();
 
                     if (_SelectedRows.length > 0) {
                         for (var i = 0; i < _SelectedRows.length; i++) {
                             var record = _SelectedRows[i];
                             var classDate = new Date(_MasterTable.getCellByColumnUniqueName(record, "Class_Date"));
                             alert(_MasterTable.getCellByColumnUniqueName(record, "Class_ID").innerHTML);
                         }
                     }
                }
            </script>
Tsvetoslav
Telerik team
 answered on 29 Jul 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?