Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
54 views

The closest post to what I want to do is: http://www.telerik.com/community/forums/aspnet-ajax/general-discussions/any-way-to-prevent-telerik-from-including-jquery.aspx

But the suggestion is to include jquery into the telerik which i dont want to do.

I want to run jquery and jquery-ui independently of telerik so that i don't have to go change all the existing:

$(document).ready(...) 

code.

At the moment everything is fine, but I can't use the jQuery.ui library because telerik breaks it, and I can't include the libraries into the script manage because that breaks existing jQuery stuff. 

How can i run jQuery/jQuery-UI in-dependently of Telerik stuff...

NaturalCause
Top achievements
Rank 1
 answered on 04 Feb 2011
2 answers
300 views
I have a grid where "OnRowSelected" I fire a javascript function that moves the selection's data to another part of the screen, it works kind of like an old school windows multi-select slide over box. This is working fine, and I have no issues with it.

My problem is that this is all part of a data item that can be saved and edited later. In the event that the user wishes to edit the item later, I need to load in the grid with the data items pre-selected. I know how to do that, and have that part working.

My question is: Is there an easy way to fire my client-side events after I bind the grid and force selection server side, so that the UI will look as if the user clicked the selections (all my javascript gets executed is my main goal here). I'd like to send all the selection code down the same funnel, so that the de-select code all functions properly in the aforementioned scenario.

I am trying to avoid postbacks, ajax or otherwise, as my users' machines are very old, and even nicely setup update panels and ajaxmanagers seem to take forever to execute.

Vince Ockerman
Top achievements
Rank 1
 answered on 03 Feb 2011
2 answers
108 views
Hi I have a problem with RadRating control.

I have a RadGrid in which there is a <ItemTemplate> section that allows to define the look of the unit displayed on the grid. In it, I want to add RadRating control and ultimately be able to rate a unit and make a call to a database to update a rating field WITHOUT reloading the page. (using Update Panel)

So the very first thing I did was to add the control to the <itemTemplate> like it is shown in your examples. However, the control is not added to the list of recognizable controls to call methods on ( from codebehind) and it is not added to the designer file of the control. So there is no way either Update panel or codebehind will be able to reference the rating control.

How do I go around that?

What I have noticed was that if I add the control outside <itemTemplate> it will register control properly as well as add it to the list of  possible objects to do declarations on (from CodeBehind)

Here is my code:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
           <AjaxSettings>
              <telerik:AjaxSetting AjaxControlID="RadGrid1">
                   <UpdatedControls>
                       <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                   </UpdatedControls>
               </telerik:AjaxSetting>
           </AjaxSettings>
       </telerik:RadAjaxManager>
        
  
       <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px"
           Width="75px" Transparency="5">
           <img style="margin-top: 150px;" alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading4.gif") %>' />
       </telerik:RadAjaxLoadingPanel>
        
      
   
             
      
            <telerik:RadGrid ID="RadGrid1" EnableViewState="False" OnPageIndexChanged="RadGrid1_PageIndexChanged"
                runat="server" DataSourceID="SqlDataSource1" GridLines="None" Width="850px" Height="100%"
                Skin="Telerik" PageSize="20" AllowPaging="True">
                <PagerStyle Mode="NumericPages" PageButtonCount="1" Position="TopAndBottom" />
                <MasterTableView BorderStyle="None" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
                    PageSize="20">
                    <NoRecordsTemplate>
                        <div>
                            Nothing was found, start your search again. To Refresh, click <a href="inventory.aspx?reset=no&make=clear&model=clear&yearFromGrid=clear">
                                here</a></div>
                    </NoRecordsTemplate>
                    <Columns>
                        <telerik:GridBoundColumn DataField="ID" HeaderText="ID" SortExpression="ID" UniqueName="ID"
                            DataType="System.Int32" ReadOnly="True" Visible="False" AutoPostBackOnFilter="True">
                        </telerik:GridBoundColumn>
                    </Columns>
                     
                    <ItemTemplate>
                        <div style="height: auto; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px;">
                            <table width="95%" border="0" cellspacing="0" cellpadding="0">
                                <tr style="border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px">
                                    <td style="border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px">
                                        <div style="font-size: medium; font-weight: bold; text-align: left;">
                                              <a class="nikfont2" style="color: black; font-size: medium;"><%#Eval("Year") & " " & Eval("Make") & " " & Eval("Model") %></a></div>
                                    </td>
                                    <tr style="border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px">
                                        <td style="border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px">
                                            <table border="0">
                                                <tr style="border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px">
                                                    <td style="border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px">
                                                        <div runat="server" visible="false" id="myDiv">
                                                            <%#Eval("Stock Number") %></div>
                                                        <br />
                                                    </td>
                                                    <td style="border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px">
                                                        <a href="productdetails.aspx?sid=<%#Eval("Stock Number") %>&sysn=<%#Eval("Sys2KNum") %>">
                                                            <img id="imgItem1" alt="" src="<%# GetJobImageHtml(DirectCast(Eval("Stock Number"), String), DirectCast(Eval("PicturePackage"), String),DirectCast(Eval("Sys2KNum"), String) )%>"
                                                                style="width: 120px; border: 1px solid rgb(195, 195, 195);" />
                                                        </a>
                                                    </td>
                                                    <td style="text-align: left; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px">
                                                        <table style="border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px">
                                                            <tr style="border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px">
                                                                <td width="60px">
                                                                    Stock #:<br />
                                                                    Int Color:<br />
                                                                    UVW:<br />
                                                                    Length:<br />
                                                                    Category:<br />
                                                                     
                                                                </td>
                                                                <td width="100px" style="">
                                                                    <%#eval("Stock Number") %><br />
                                                                    <%# Eval("Color")%><br />
                                                                    <%# Eval("Weight")%><br />
                                                                    <%# LengthOuputer(DirectCast(myCStr(Eval("Length")), String))%><br />
                                                                    <%# Eval("InternetClass") %><br />
                                                                </td>
                                                                
                                                            </tr>
                                                            <tr style="border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px">
                                                                <td colspan="4" style="border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px">
                                                                    <span id="lblDescription">
                                                                         <%--IIf(myCStr(Eval("Sales Description")) <> "", myCStr(Eval("Sales Description")).ToString().Substring(0, Math.Min(150, myCStr(Eval("Sales Description")).Length)) & "...  <a href=""productdetails.aspx?sid=" & myCStr(Eval("Stock Number")) & """>[View More]</a>", "")--%>
                                                                    </span>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </td>
                                                    <td width="250px">
                                                        <table style="border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px">
                                                            <tr>
                                                                 
                                                                <td>
                                                                 <%# loadAddress(DirectCast(myCStr(Eval("Address1")), String), _
                                                                                                                                             DirectCast(myCStr(Eval("Address2")), String), _
                                                                                                                                             DirectCast(myCStr(Eval("City")), String), _
                                                                                                                                             DirectCast(myCStr(Eval("State")), String), _
                                                                                                                                             DirectCast(myCStr(Eval("Zip")), String), _
                                                                                                                                             DirectCast(myCStr(Eval("MainPhone")), String))%>
                                                                   
                                                                  
                                                                     
                                                                                <telerik:RadRating ID="RadRating1" runat="server" AutoPostBack="False" OnRate="RadRating1_Rate"  Precision="Exact"  />
                                                                          
 
                                                                    <%--<telerik:RadRating ID="RadRating1" runat="server" AutoPostBack="True" OnRate="RadRating1_Rate"  Precision="Exact"  />--%>
                                                                    
                                                                   <%-- <telerik:RadComboBox ID="RadComboBox1" runat="server" OnSelectedIndexChanged="RadRating1_Rate">
                                                                         <Items>
                                                                            <telerik:RadComboBoxItem runat="server" Text="Select Criteria" Value="none" Selected="True" />
                                                                            <telerik:RadComboBoxItem runat="server" Text="Length Ascending" Value="LengthA" Selected="False" />
                     
                                                                          </Items>
                                                                    </telerik:RadComboBox>--%>
                                                                    
                                                                       
                                                                </td>
                                                                <td width="120px">
                                                                    <div style="font-size: large; font-weight: bold; vertical-align: top">
                                                                        <%# price(DirectCast(myCStr(Eval("SalePrice")), String), _
                                                                        DirectCast(myCStr(Eval("Suggested Selling Price")), String), _
                                                                        DirectCast(myCStr(Eval("OurPrice")), String), _
                                                                        DirectCast(myCStr(Eval("SpecialPrice")), String), _
                                                                        DirectCast(myCStr(Eval("MSRP")), String), _
                                                                        DirectCast(myCStr(Eval("Sys2KNum")), String))%>
                                                                    </div>
                                                                     <div >
                                                                        <a href="productdetails.aspx?sid=<%#Eval("Stock Number") %>&sysn=<%#Eval("Sys2KNum") %>">
                                                                            <img src="images/viewdetails.png" alt="" name="<%#Eval("Stock Number") %>" border="0"
                                                                                style="margin-bottom: 5px" /></a><br />
                                                                    </div>
                                                                    <br />
                                                                    <div>
                                                                        <%# zip(DirectCast(myCStr(Eval("Radius")), String), DirectCast(myCStr(Eval("DealerCity")), String))%>
                                                                    </div>
                                                                </td>
                                                                 
                                                            </tr>
                                                        </table>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                            </table>
                        </div>
                    </ItemTemplate>
                    <EditFormSettings>
                        <FormTemplate>
                        </FormTemplate>
                    </EditFormSettings>
                    <PagerStyle Mode="NumericPages" Position="TopAndBottom" />
                </MasterTableView>
                <ActiveItemStyle BorderStyle="None" />
            </telerik:RadGrid>
        </td>
    </tr>
</table>
 
 
 
 
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
    ConnectionString="<%$ ConnectionStrings:TestString %>"
    SelectCommand="SELECT * FROM Vehicles WHERE Sys2KNum = '007414'" >
</asp:SqlDataSource>

Nikita Yaroshevsky
Top achievements
Rank 1
 answered on 03 Feb 2011
2 answers
162 views
Hi I have a Telerik RadGrid and I'm trying to hook up my own event to RadRating control placed inside the ItemTemplate of the grid.
The added handler does not fire..

<telerik:RadGrid ID="RadGrid1" EnableViewState="False" OnPageIndexChanged="RadGrid1_PageIndexChanged"
                runat="server" DataSourceID="SqlDataSource1" GridLines="None" Width="850px" Height="100%"
                Skin="Telerik" PageSize="20" AllowPaging="True">
                <PagerStyle Mode="NumericPages" PageButtonCount="1" Position="TopAndBottom" />
                <MasterTableView BorderStyle="None" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
                    PageSize="20">
                    <NoRecordsTemplate>
                        <div>
                            Nothing was found, start your search again. To Refresh, click <a href="inventory.aspx?reset=no&make=clear&model=clear&yearFromGrid=clear">
                                here</a></div>
                    </NoRecordsTemplate>
                    <Columns>
                        <telerik:GridBoundColumn DataField="ID" HeaderText="ID" SortExpression="ID" UniqueName="ID"
                            DataType="System.Int32" ReadOnly="True" Visible="False" AutoPostBackOnFilter="True">
                        </telerik:GridBoundColumn>
                    </Columns>
                 <itemTemplate>
                  <asp:UpdatePanel runat="server" ID="panel1">
                                                                                <ContentTemplate>
                                                                                <telerik:RadRating ID="RadRating1" Value="3.5" runat="server" AutoPostBack="false"  Precision="Exact" />
                                                                                </ContentTemplate>
                                                                                </asp:UpdatePanel>
 
</ItemTemplate>
                    <EditFormSettings>
                        <FormTemplate>
                        </FormTemplate>
                    </EditFormSettings>
                    <PagerStyle Mode="NumericPages" Position="TopAndBottom" />
                </MasterTableView>
                <ActiveItemStyle BorderStyle="None" />
            </telerik:RadGrid>


Private Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemCreated
    If Not IsPostBack Then
 
 
        For Each gridDataItem As GridDataItem In RadGrid1.Items
            Dim radRate As RadRating = DirectCast(gridDataItem.FindControl("RadRating1"), RadRating)
            AddHandler radRate.Rate, AddressOf CControls_UnitGrid.Rate
 
            radRate.Value = 1
            radRate.AutoPostBack = True
            Dim panel1 As UpdatePanel = DirectCast(gridDataItem.FindControl("panel1"), UpdatePanel)
            AddHandler panel1.Load, AddressOf CControls_UnitGrid.Rate
        Next
    End If
End Sub

Shared Sub Rate(ByVal sender As Object, ByVal e As EventArgs)
        Dim radRate As RadRating = DirectCast(sender, RadRating)
 
        radRate.Value = 2
    End Sub

Here is my codeBehind, what am I doing wrong?
Nikita Yaroshevsky
Top achievements
Rank 1
 answered on 03 Feb 2011
2 answers
94 views
Trying to get value from RadRate (which is created dynamically) in <itemTemplate>. Could somebody tell me what I'm doing wrong?

<telerik:RadGrid ID="RadGrid1" EnableViewState="False" OnPageIndexChanged="RadGrid1_PageIndexChanged"
                runat="server" DataSourceID="SqlDataSource1" GridLines="None" Width="850px" Height="100%"
                Skin="Telerik" PageSize="20" OnItemCreated="RadGrid1_ItemCreated" AllowPaging="True">
                <PagerStyle Mode="NumericPages" PageButtonCount="1" Position="TopAndBottom" />
                <MasterTableView BorderStyle="None" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" 
                    PageSize="20">
                    <NoRecordsTemplate>
                        <div>
                            Nothing was found, start your search again. To Refresh, click <a href="inventory.aspx?reset=no&make=clear&model=clear&yearFromGrid=clear">
                                here</a></div>
                    </NoRecordsTemplate>
                    <Columns>
                        <telerik:GridBoundColumn DataField="ID" HeaderText="ID" SortExpression="ID" UniqueName="ID"
                            DataType="System.Int32" ReadOnly="True" Visible="False" AutoPostBackOnFilter="True">
                        </telerik:GridBoundColumn>
                    </Columns>
                    <ItemTemplate>
                                                                                <asp:UpdatePanel UpdateMode="Conditional" runat="server" ID="panel1"> 
                                                                                <Triggers>
                                                                                
                                                                                </Triggers>                                                                               
                                                                                <ContentTemplate>
                                                                                <telerik:RadRating ID="RadRating1" Value="3"  runat="server" ViewStateMode="Enabled" AutoPostBack="True"    />
                                                                                </ContentTemplate>
                                                                                <Triggers>
                                                                                <asp:AsyncPostBackTrigger ControlID="RadRating1" EventName="Rate" />                                                                                
                                                                                </Triggers>
                                                                                </asp:UpdatePanel>                      
                    </ItemTemplate>
                    <EditFormSettings>
                        <FormTemplate>
                        </FormTemplate>
                    </EditFormSettings>
                    <PagerStyle Mode="NumericPages" Position="TopAndBottom" />
                </MasterTableView>
                <ActiveItemStyle BorderStyle="None" />
            </telerik:RadGrid>
--------------------------------------------------------------------------------------------

    Public Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemCreated
        If e.Item.ItemType = GridItemType.AlternatingItem Or e.Item.ItemType = GridItemType.Item Then
            Dim item As Telerik.Web.UI.GridDataItem
            item = e.Item

            Dim radRate As Telerik.Web.UI.RadRating = item("ID").FindControl("RadRating1")

            Dim panel1 As UpdatePanel = item("ID").FindControl("panel1")

            AddHandler panel1.Load, AddressOf CControls_UnitGrid.up1_Load            
            AddHandler radRate.Rate, AddressOf CControls_UnitGrid.Rate

            Dim apt As New AsyncPostBackTrigger
            apt.ControlID = radRate.ID
            apt.EventName = "Rate"
            panel1.Triggers.Add(apt)

        End If
    End Sub
Nikita Yaroshevsky
Top achievements
Rank 1
 answered on 03 Feb 2011
0 answers
136 views
We just recently upgrade our control set and it seemed to have broke our implementation of using the radtooltipmanager with the radscheduler. I have been following the tutorial below and have created a test project that is the exact same and can't seem to get it working.

http://demos.telerik.com/aspnet-ajax/scheduler/examples/radtooltip/defaultcs.aspx

I took all the code from the demo page and put it into a test page. When the AjaxUpdate code runs as seen below, the FindByID returns a null. Also when I rollover the appointment the AppointmentCreated method gets called as well.

Code-Behind
private void Page_Load(object sender, EventArgs e)
    {
        RadScheduler1.AppointmentCreated += RadScheduler1_AppointmentCreated;
        RadScheduler1.DataBound += RadScheduler1_DataBound;
 
        this.RadScheduler1.DataSource = GetApps();
        this.RadScheduler1.DataBind();
    }
 
    private List<Appointment> GetApps()
    {
        List<Appointment> appList = new List<Appointment>();
 
        for (int i = 0; i < 10; i++)
        {
            Appointment app = new Appointment();
            app.ID = Guid.NewGuid();
            app.Subject = "Apt" + i.ToString();           
            app.Start = DateTime.Now.AddDays(i);
            app.End = DateTime.Now.AddDays(i).AddMinutes(30);
            appList.Add(app);
        }
 
        return appList;
    }
 
    protected void RadScheduler1_AppointmentCreated(object sender, AppointmentCreatedEventArgs e)
    {
        if (e.Appointment.Visible && !IsAppointmentRegisteredForTooltip(e.Appointment))
        {
            string id = e.Appointment.ID.ToString();
 
            foreach (string domElementID in e.Appointment.DomElements)
            {
                RadToolTipManager1.TargetControls.Add(domElementID, id, true);
            }
        }
    }
 
    private bool IsAppointmentRegisteredForTooltip(Appointment apt)
    {
        foreach (ToolTipTargetControl targetControl in RadToolTipManager1.TargetControls)
        {
            if (apt.DomElements.Contains(targetControl.TargetControlID))
            {
                return true;
            }
        }
 
        return false;
    }
 
    protected void RadScheduler1_DataBound(object sender, EventArgs e)
    {
        RadToolTipManager1.TargetControls.Clear();
        ScriptManager.RegisterStartupScript(this, typeof(Page), "HideToolTip", "hideActiveToolTip();", true);
    }
 
    protected void RadToolTipManager1_AjaxUpdate(object sender, ToolTipUpdateEventArgs e)
    {       
        Appointment apt = RadScheduler1.Appointments.FindByID(new Guid(e.Value));
         
        Portal_Controls_AppointmentToolTip toolTip = (Portal_Controls_AppointmentToolTip)LoadControl("Portal/Controls/AppointmentToolTip.ascx");
        toolTip.TargetAppointment = apt;
        e.UpdatePanel.ContentTemplateContainer.Controls.Add(toolTip);
    }

 


html
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" %>
<%@ Reference Control="Portal/Controls/AppointmentToolTip.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
    <link rel="stylesheet" type="text/css" href="/Resources/css/styles.css" />
    <script language="javascript" src="/Resources/js/modals.js" type="text/javascript"></script>
    <script type="text/javascript">
        //<![CDATA[
        function hideActiveToolTip() {
            var tooltip = Telerik.Web.UI.RadToolTip.getCurrent();
            if (tooltip) {
                tooltip.hide();
            }
        }
 
        Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequestHandler);
        function beginRequestHandler(sender, args) {
            var prm = Sys.WebForms.PageRequestManager.getInstance();
            if (args.get_postBackElement().id.indexOf('RadScheduler1') != -1) {
                hideActiveToolTip();
            }
        }
 
        function clientBeforeShow(sender, eventArgs) {
            w = $telerik.$(window).width() / 2;
            h = $telerik.$(window).height() / 2;
 
            if ((sender._mouseX > w) && (sender._mouseY > h)) {
                sender.set_position(Telerik.Web.UI.ToolTipPosition.TopLeft);
                return;
            }
            if ((sender._mouseX < w) && (sender._mouseY > h)) {
                sender.set_position(Telerik.Web.UI.ToolTipPosition.TopRight);
                return;
            }
            if ((sender._mouseX > w) && (sender._mouseY < h)) {
                sender.set_position(Telerik.Web.UI.ToolTipPosition.BottomLeft);
                return;
            }
            sender.set_position(Telerik.Web.UI.ToolTipPosition.BottomRight);
        }
        //]]>
    </script>
</head>
<body id="body" runat="server" style="background-color:White;">
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <div style="padding:20px 20px 20px 20px;">
     
        <asp:UpdatePanel runat="server" ID="UpdatePanel1" UpdateMode="Conditional">
            <ContentTemplate>
                <telerik:RadScheduler runat="server"
                    ID="RadScheduler1"
                    Width="750px"
                    Height="600px"
                    TimeZoneOffset="03:00:00"                   
                    DayStartTime="08:00:00"
                    DayEndTime="18:00:00"
                    DataKeyField="ID"
                    DataSubjectField="Subject"
                    DataStartField="Start"
                    DataEndField="End"                   
                    DisplayDeleteConfirmation="false"
                    SelectedView="MonthView">
                    <AdvancedForm Modal="true" />
                    <TimelineView UserSelectable="false" />
                    <TimeSlotContextMenuSettings EnableDefault="true" />
                    <AppointmentContextMenuSettings EnableDefault="true" />
                </telerik:RadScheduler>
                <telerik:RadToolTipManager
                    runat="server"
                    ID="RadToolTipManager1"
                    Width="320"
                    Height="210"
                    Animation="None"
                    HideEvent="LeaveToolTip"
                    Text="Loading..."
                    RelativeTo="Element"
                    OnAjaxUpdate="RadToolTipManager1_AjaxUpdate"
                    OnClientBeforeShow="clientBeforeShow"
                    EnableShadow="true"/>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    </form>
</body>
</html>


If you could point me in the right directory that would be great. I have attached the test file I have been working on.

thanks
Daniel Tharp
Top achievements
Rank 1
 asked on 03 Feb 2011
3 answers
85 views
Hello,

I have a scenario where I am using a RadGrid to display Terms and Conditions to the user.  I have turned off headers and attempted to turn off all grid lines.  I am having an issue where there are faint lines appearing and I have not been able to turn them off.  The code is included.  I believe that with this code, someone should be able to replicate the issue (seems like there is a faint line under every second row).  Help would greatly be appreciated.

Designer Code
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HideGridLines.aspx.cs"
    Inherits="Test.HideGridLines" %>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="ScriptManager" runat="server" />
    <table width="763" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td valign="top">
                <asp:UpdatePanel ID="UpdatePanelOptIn" runat="server">
                    <ContentTemplate>
                        <telerik:RadGrid ID="RadGridOptIn" runat="server" AutoGenerateColumns="false" ShowHeader="false"
                            ItemStyle-BackColor="Transparent" AlternatingItemStyle-BackColor="Transparent"
                            BorderColor="Transparent" OnItemDataBound="RadGridOptIn_ItemDataBound">
                            <MasterTableView DataKeyNames="OptInTypeId" BackColor="Transparent" BorderColor="Transparent"
                                GridLines="None">
                                <Columns>
                                    <telerik:GridTemplateColumn DataField="IsRequired" ItemStyle-HorizontalAlign="Right"
                                        ItemStyle-VerticalAlign="Top">
                                        <ItemTemplate>
                                            <asp:PlaceHolder ID="plhOptInRequired" runat="server" />
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridTemplateColumn UniqueName="IsSelected" ItemStyle-HorizontalAlign="Left"
                                        ItemStyle-VerticalAlign="Top">
                                        <ItemTemplate>
                                            <asp:CheckBox ID="cboIsSelected" runat="server" AutoPostBack="true" OnCheckedChanged="cboIsSelected_CheckedChanged"
                                                TabIndex="30" />
                                        </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                                    <telerik:GridBoundColumn DataField="OptInHtml" ItemStyle-HorizontalAlign="Left" ItemStyle-VerticalAlign="Top" />
                                </Columns>
                            </MasterTableView>
                        </telerik:RadGrid>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
        </tr>
    </table>
    </form>
</body>
</html>

Code Behind Page
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
  
using Telerik.Web.UI;
  
namespace Test
{
    public partial class HideGridLines : System.Web.UI.Page
    {
        #region Properties
  
        #region HcpOptIns
        private UserProfileOptInList HcpOptIns
        {
            get
            {
                if (ViewState["HcpOptIns"] == null)
                {
                    ViewState["HcpOptIns"] = UserProfileOptInList.GetUserProfileOptInList();
                }
                return (UserProfileOptInList)ViewState["HcpOptIns"];
            }
            set
            {
                ViewState["HcpOptIns"] = value;
            }
        }
        #endregion
  
        #endregion
  
        #region Events
  
        #region cboIsSelected_CheckedChanged
        protected void cboIsSelected_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                CheckBox optIn = (CheckBox)sender;
                bool isSelected = optIn.Checked;
  
                GridDataItem item = (GridDataItem)optIn.NamingContainer;
  
                // get UserProfileOptInCollection record by datakey from the grid
                long optInTypeID = Convert.ToInt64(item.GetDataKeyValue("OptInTypeId"));
  
                UserProfileOptIn regOptIn = HcpOptIns.ItemByOptInTypeId(optInTypeID);
                regOptIn.IsSelected = isSelected;
  
                BindOptIns();
            }
            catch (Exception ex)
            {
                string message = ex.Message;
            }
        }
        #endregion
  
        #region Page_Load
        protected void Page_Load(object sender, EventArgs e)
        {
            BindOptIns();
        }
        #endregion
  
        #region RadGridOptIn_ItemDataBound
        protected void RadGridOptIn_ItemDataBound(object sender, GridItemEventArgs e)
        {
            try
            {
                if (e.Item is GridDataItem)
                {
                    if (e.Item.DataItem is UserProfileOptIn)
                    {
                        PlaceHolder plhOptInRequired = (PlaceHolder)e.Item.FindControl("plhOptInRequired");
                        CheckBox chkOptIn = (CheckBox)e.Item.FindControl("cboIsSelected");
                        UserProfileOptIn optIn = (UserProfileOptIn)e.Item.DataItem;
                        System.Web.UI.WebControls.Image imgESignature = (System.Web.UI.WebControls.Image)e.Item.FindControl("imgESignature");
  
                        if (optIn.IsRequired)
                        {
                            AddContentToPlaceHolderControl(@"<span class=""RequiredFieldAsterik"">  * </span>", ref plhOptInRequired);
                        }
                        else
                        {
                            AddContentToPlaceHolderControl(" ", ref plhOptInRequired);
                        }
  
                        if (optIn.IsSelected)
                        {
                            chkOptIn.Checked = true;
                        }
                        else
                        {
                            chkOptIn.Checked = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
            }
        }
        #endregion
  
        #endregion
  
        #region Methods
  
        #region AddContentToPlaceHolderControl
        /// <summary>
        /// Method to indicate required fields
        /// </summary>
        /// <param name="controlHTML">HTML Literal Control to be added to the PlaceHolder Control.</param>
        /// <param name="inputPlaceHolderControl">PlaceHolder Control that will have literal control added to it.</param>
        public static void AddContentToPlaceHolderControl(string controlHTML, ref PlaceHolder inputPlaceHolderControl)
        {
            Literal htmlForPlaceHolder = new Literal();
            htmlForPlaceHolder.Text = controlHTML;
  
            inputPlaceHolderControl.Controls.Add(htmlForPlaceHolder);
        }
        #endregion
  
        #region BindOptIns
        private void BindOptIns()
        {
            RadGridOptIn.DataSource = HcpOptIns;
            RadGridOptIn.DataBind();
        }
        #endregion
  
        #endregion
    }
}

UserProfileOptIn Class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
  
namespace Test
{
    [Serializable]
    public class UserProfileOptIn
    {
        #region Instance Variables
        private long _userProfileOptInTypeId;
        private long _optInTypeId;
        private bool _isRequired;
        private bool _isDisplayed;
        private bool _isSelected;
        private string _optInHtml = string.Empty;
        #endregion
  
        #region Properties
        public long UserProfileOptInTypeId
        {
            get { return this._userProfileOptInTypeId; }
            set { this._userProfileOptInTypeId = value; }
        }
  
        public long OptInTypeId
        {
            get { return this._optInTypeId; }
            set { this._optInTypeId = value; }
        }
  
        public bool IsRequired
        {
            get { return this._isRequired; }
        }
  
        public bool IsDisplayed
        {
            get { return this._isDisplayed; }
            set { this._isDisplayed = value; }
        }
  
        public bool IsSelected
        {
            get { return this._isSelected; }
            set { this._isSelected = value; }
        }
          
        public string OptInHtml
        {
            get { return this._optInHtml; }
            set { this._optInHtml = value; }
        }
        #endregion
  
        #region Constructor
        private UserProfileOptIn(long userProfileOptInTypeId, long optInTypeId, bool isRequired, bool isDisplayed, bool isSelected, string optInHtml)
        {
            this._userProfileOptInTypeId = userProfileOptInTypeId;
            this._optInTypeId = optInTypeId;
            this._isRequired = isRequired;
            this._isDisplayed = isDisplayed;
            this._isSelected = isSelected;
            this._optInHtml = optInHtml;
        }
        #endregion
  
        #region Factory Methods
        public static UserProfileOptIn NewUserProfileOptInt(long userProfileOptInTypeId, long optInTypeId, bool isRequired, bool isDisplayed, bool isSelected, string optInHtml)
        {
            return new UserProfileOptIn(userProfileOptInTypeId, optInTypeId, isRequired, isDisplayed, isSelected, optInHtml);
        }
        #endregion
    }
  
    [Serializable()]
    public class UserProfileOptInList : List<UserProfileOptIn>
    {
        #region Constructor
        private UserProfileOptInList(bool getList)
        {
            if (getList)
            {
                this.Add(UserProfileOptIn.NewUserProfileOptInt(1, 1, true, true, false, "This is the first condition."));
                this.Add(UserProfileOptIn.NewUserProfileOptInt(2, 3, true, true, false, "This is the second condition."));
                this.Add(UserProfileOptIn.NewUserProfileOptInt(3, 1, true, true, false, "This is the third condition."));
                this.Add(UserProfileOptIn.NewUserProfileOptInt(4, 4, true, true, false, "This is the fourth condition."));
                this.Add(UserProfileOptIn.NewUserProfileOptInt(5, 5, true, true, false, "This is the fifth condition."));
                this.Add(UserProfileOptIn.NewUserProfileOptInt(6, 6, true, true, false, "This is the sixth condition."));
            }
        }
        #endregion
  
        #region Factory Methods
        public static UserProfileOptInList NewUserProfileOptInList()
        {
            return new UserProfileOptInList(false);
        }
  
        public static UserProfileOptInList GetUserProfileOptInList()
        {
            return new UserProfileOptInList(true);
        }
        #endregion
  
        #region Methods
        public UserProfileOptIn ItemByOptInTypeId(long optInTypeId)
        {
            foreach (UserProfileOptIn userProfileOptInItem in this)
            {
                if (userProfileOptInItem.OptInTypeId == optInTypeId)
                {
                    return userProfileOptInItem;
                }
            }
            return null;
        }
        #endregion
    }
}



Thanks,
Tom
Top achievements
Rank 1
 answered on 03 Feb 2011
2 answers
68 views
Hello,

I have a grid which has around 2000 records in it. When I click on edit to edit the row it opens the random record in the edit mode. I mean if I click on a row with id=5 it opens some other record with different id. I don't know how to solve this issue. I have 2 databases (one for development and one for production) and they both are 100% same. The grid works fine when I use development database but it acts weird when I use the production database. I don't know whether this issue was already there or it is something new. 

Any help will be appreciated.

thanks,
Parth
Parth
Top achievements
Rank 1
 answered on 03 Feb 2011
2 answers
696 views
I have a RadTreeView inside a RadComboBox and am implementing autocomplete behaviour when the user types into the combobox.
The tree results are being filtered properly but I'm at a loss as to how to enable keyboard navigation.

My needs are pretty basic:
  • When the user hits the down arrow or tab key while focus is on the combobox, the dropdown will expand (if not already) and focus will move to the first visible leaf node in the tree.
  • The user can use the up and down arrow keys to navigate between leaf nodes
  • The user can hit enter to select the currently highlighted/selected leaf node

I have an event handler registered for the KeyUp event on the combobox. When the down arrow is encountered, I'm using this code:
if (key == 40 || key == 9) // down arrow or tab
{
  // open combobox if not already
  if (!comboBox.get_dropDownVisible()) {
    comboBox.showDropDown();
    comboBox._childListElementWrapper.style.height = "400px";
  }
 
  // focus first visible child node
  $(nodes).each(
    function (sender, args) {
      var node = args;
      if (node.get_nodes().get_count() == 0 && // leaf node
                        !$(node._element).is(':hidden')) // and hasn't been filtered out
      {
        $(node._contentElement).focus();
        node.highlight();
        // node.set_selected(true);
        return false;
      }
    }
  );
}

This is working in that the first visible node (I make the node._element <LI> hidden elsewhere) looks selected, but keyboard input isn't changing selected tree items. After fiddling, the focus has either stayed stuck in the textbox, or it focuses the dropdown/treeview and I can scroll the list of items with the keyboard (similar to rolling the mouse scroll wheel).

How can I focus the first tree item and navigate between the visible items with keyboard arrows? I don't think the AccessKey or TabIndex options are appropriate, as this combobox/treeview combo is inside a User Control and there will be several on the page. I do not want the browser's tab key hijacked - I only want to focus the treeview and allow navigation when the user hits the down arrow when the combobox textbox has focus.

If anyone with an understanding of how the treeview object works could point me toward the right approach (narrative or pseudocode is fine) I'd really appreciate it.

Thanks,
Stefan
Stefan
Top achievements
Rank 1
 answered on 03 Feb 2011
2 answers
126 views
I have a row in a RadGrid that contains three buttons:

<asp:Button ID="Button1" CommandName="ExpandCollapse" CommandArgument="1" Text="Button 1" runat="server" />
<asp:Button ID="Button2" CommandName="ExpandCollapse" CommandArgument="2" Text="Button 2" runat="server" />
<asp:Button ID="Button3" CommandName="ExpandCollapse" CommandArgument="3" Text="Button 3" runat="server" />

In my code-behind, I have the following code:

protected void RadGrid_ItemCommand(object sender, GridCommandEventArgs e)
{
    if ((e.CommandName == RadGrid.ExpandCollapseCommandName) && !e.Item.Expanded)
    {
        // Do stuff here...
    }
}

When I click on a button for the first time, I have a NestedViewTemplate that gets shown. How do I keep the NestedViewTemplate open if I click a different button in the same row? For example, I click button 1 to open the NestedViewTemplate and then I click button 2 to keep the NestedViewTemplate open while showing different data.
Troy
Top achievements
Rank 1
 answered on 03 Feb 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?