Telerik Forums
UI for ASP.NET AJAX Forum
7 answers
285 views
I have a RadGrid, displays strings and ints, and lets you edit them easily.

When I insert, i require a drop down box to be able to select a product, and another drop down box which will let you select units (count, box of 12, case of 4 boxes) etc.  Each Unit is dependent on the Product selected.

Currently the first drop down box has an SelectedIndexChanged Event, which will update the ObjectDataSource and requery.

Now I need to be able to grab the second (unit) Combobox, and do a rebind.

It seems since it's in an insert row, it's difficult to find the control in the grid.

Any Suggestions?
Jayesh Goyani
Top achievements
Rank 2
 answered on 07 Sep 2011
0 answers
46 views

Hi,

Now i am able to print RadGrid selected row with the help of following article:
http://www.telerik.com/community/forums/aspnet-ajax/grid/how-to-print-selected-radgrid-row-and-add-new-link-button-in-command-item-template.aspx

I need to print Header Row along with selected row.

How can i achieve this requirement.

Thanks in advance...

Guruvu
Top achievements
Rank 1
 asked on 07 Sep 2011
1 answer
165 views
Hello!

I used a radwindow to show detail and use wnd.Center() to center the popup radwindow.
The problem is that when I choose 50 rows and scroll the grid the popup window (position fixed to the grid) also move with the grid to the top.

I checked all the answers telerik master posted. one is using

 

 

.RadWindow

 {  

 

height:200px;

position: fixed !important;

}

The solution works only for a few top records. when bottom record is clicked the window won't be shown ( I think it maybe shown somewhere which I can't see) and the whole grid page is grayed out.

I don't know how to solve the problem. please help.
My code is code for reference. Thanks again.

        function ShowDetail(sender, args) {
            var id = args.getDataKeyValue("RowID");
            var wnd = window.radopen("CommLogDetail.aspx?RowID=" + id, "RecordDetailWindow");
            wnd.Center();
}
    <script type="text/javascript">
        .RadWindow
        
            height:200px;
            position: fixed !important;
            
        }
    </script>
  
// and I also try to merge these codes into it ( another solution)  which doesn't work.
        function ShowDetail(sender, args) {
            var id = args.getDataKeyValue("RowID");
            var wnd = window.radopen("Detail.aspx?RowID=" + id, "RecordDetailWindow");
            //wnd.Center();
            GetSelectedWindow();
            PositionWindow();
        }
        function GetSelectedWindow() {
            var oManager = GetRadWindowManager();
            return oManager.getActiveWindow();
        }
  
        function PositionWindow() {
  
            var oWindow = GetSelectedWindow();
            if (!oWindow) {
                return;
            }
////
            <telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true">
                <Windows>
                    <telerik:RadWindow ID="RecordDetailWindow" runat="server" Title="Record Detail" Height="700px"
                        Width="900px" ReloadOnShow="true" ShowContentDuringLoad="false" Modal="true"
                        CssClass="RadWindow" />
                </Windows>
            </telerik:RadWindowManager>

Shinu
Top achievements
Rank 2
 answered on 07 Sep 2011
1 answer
756 views
Hi,

   I have a combo box in the edit Form in a radgrid. Im using Entity Framework and a business layer class to return an IEnumerable List
<Employees> to bind to the grid. When the edit form comes up I want the titles and names of the employees to be shown in the combo box. like as the  DataTextField like :

"{Title}:" + {FirstName}  + " " + {LastName}

and I want to bind another property in the Employee class employee_Id as the DataValueField.

Can someone show me how to do this, I am doing something similar in a GridCalculatedColumn where I am able to combine these multiple fields and show them in an expression like shown above. Please see Grid calculated column below. How can I bind the combo box like this so i can see the title: FirstName  Lastname  in the text field. Please note that I dont want a multi column grid as shown in this example here
http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/multicolumncombo/defaultcs.aspx  

I want to show them all together. and be able to bind the employee_id property as the DataValueField so when i submit the form I can read that, can someone please show me how to do this in code, thanks.   Please see below for the CalculatedGridColumn where i am showing same information.

<telerik:GridCalculatedColumn SortExpression="Employee.FirstName" HeaderText="Employees" AutoPostBackOnFilter="true"
 DataFields="Employee.Title,Employee.FirstName, Employee.LastName" Expression='{0}  + ":" + {1} + " " + {2}' >                        
 <HeaderStyle HorizontalAlign="Left" Width="30%" />
                         <ItemStyle HorizontalAlign="Left" />
                    </telerik:GridCalculatedColumn>
Shinu
Top achievements
Rank 2
 answered on 07 Sep 2011
1 answer
242 views
I've got a fairly generic radgrid that uses "EditForms" for the edit mode.

I have the edit column set to:

<

 

 

EditColumn CancelText="Cancel" UpdateText="Update" ButtonType="PushButton"></EditColumn>

 


and as expected the buttons appear at the bottom of the form which is fairly long with 40+ items. I'd also like to put the two buttons at the top of the edit form so the user doesn't have to scroll so far to update or cancel. Is there an easy way to do this? Thanks.

-Tim
Princy
Top achievements
Rank 2
 answered on 07 Sep 2011
10 answers
456 views
Hi,

I have a DateTime column on the RadGrid. I would like to add a time picker to the column. Please send directions and/or sample codes.

thanks,
Minh Bui
Minh
Top achievements
Rank 1
 answered on 07 Sep 2011
6 answers
99 views
Hi all,

I have a Grid which contains a detail Grid. When I click on "expand" icon to expand the detail Grid (its width may be greater than its parent's width), I want Text in the Detail Grid must be on the second line if it exceeds the parent's width) but the detail Grid always extend its Width automatically.

Please let me know how can I do this.

Thanks in advance.
Phuc
Top achievements
Rank 1
 answered on 07 Sep 2011
2 answers
106 views
i have grid2 & btnUpdate inside grid1 "MasterTableViewEditForms" (Template)
and i've successfully bind grid2 datasource inside grid1
my problems is, i can't get values from grid2 when hitting btnUpdate

Protected Sub grid1_UpdateCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles grid1.UpdateCommand
    Dim grd2 As RadGrid = TryCast(TryCast(e.Item, GridDataItem).ChildItem.FindControl("grid2"), RadGrid)
    lblMsg.Text = grd2.Items(0).Cells(2).Text
End Sub

the following error occured when hitting btnUpdate "Object reference not set to an instance of an object."

i have search some post in this forums but couldn't find any solution, please help
thanks in advance.
Silver
Top achievements
Rank 1
 answered on 07 Sep 2011
5 answers
157 views
Hi

I've been playing with the demo's and really like the AJAX kit so will be buying it once I get paid for my current job, but whilst using the trial version I have come across an error with the RadTooltipManager and would appreciate some help if anyone is able to please.

Basically it works fine everywhere on the site, apart from the home page, but to make it more confusing it doesn't work when loaded via http://www.domain.com/ but it does work when I add default.aspx so http://www.domain.com/default.aspx

The error I get is:

RadToolTipManager response error:
Exception=Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 405


I've also attached a screenshot of the error.

My code is:

default.aspx

<%@ Page Title="" Language="VB" MasterPageFile="~/main.master" AutoEventWireup="true" CodeFile="default.aspx.vb" Inherits="_default3" EnableEventValidation="false" ViewStateEncryptionMode="Never" validaterequest="false" enableviewstatemac="false" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register Src="~/ProductDetails.ascx" TagName="ProductDetails" TagPrefix="uc1" %>
 
<asp:content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
<meta name="keywords" content="keys" id="keywords" runat="server" />
<meta name="description" content="description" id="description" runat="server" />
<link rel="stylesheet" type="text/css" href="/skins/MyCustomSkin/ToolTip.MyCustomSkin.css" />
</asp:content>
<asp:content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <script type="text/javascript">
    var combo = null;
    function CloseActiveToolTip() {
        var tooltip = Telerik.Web.UI.RadToolTip.getCurrent();
        if (tooltip) tooltip.hide();
    }
    function OnClientHide(sender, args) {
        if (combo) {
            $find(combo.id).hideDropDown();
        }
    }
</script>
<telerik:radscriptmanager ID="RadScriptManager1" runat="server">
</telerik:radscriptmanager>
<telerik:radtooltipmanager runat="server" ID="RadToolTipManager1" Position="Center"
    RelativeTo="Element" Width="545px" Height="320px" Animation="Fade" HideEvent="LeaveTargetAndToolTip"
    OnAjaxUpdate="OnAjaxUpdate" OnClientHide="OnClientHide"
    EnableShadow="true" EnableEmbeddedSkins="false" Skin="Transparent"
    RenderInPageRoot="true" AnimationDuration="300"
    enableajaxskinrendering="True" autoclosedelay="60000">
</telerik:radtooltipmanager>
<asp:datalist id="dlProducts" runat="server" repeatcolumns="3" repeatdirection="Horizontal" repeatlayout="Table" cssclass="productlist" cellpadding="0" cellspacing="0" gridlines="None" borderstyle="None" datakeyfield="ProductID">
    <itemtemplate><div id="smallImage" class="productlistitems" runat="server"><%# BoxDetails(Container.DataItem)%></div></itemtemplate>
</asp:datalist>
<asp:label id="lblText" runat="server" />
</asp:content>

default.aspx.vb

Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Data
Imports System.Data.SqlClient
Imports System.Drawing
Imports System.IO
Imports System.Web
Imports System.Web.SessionState
Imports System.Web.UI
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls
Imports Telerik.Web.UI
 
Partial Class _default3
    Inherits System.Web.UI.Page
 
    Public Function BoxDetails(ByVal DataItem As Object) As String
        Dim MyConnection As SqlConnection
        MyConnection = New SqlConnection()
        MyConnection.ConnectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
 
        Dim myTxt As String = ""
        If DataItem("TypeID").Equals(1) Then
            If Not DataItem("title").Trim().Equals("") Then
                myTxt = "<a class=""basic"" href=""" & DataItem("url").Trim() & """><img src=""/images/home/tn/" & DataItem("filename").Trim() & """ alt=""" & DataItem("title").Trim() & """ title=""" & DataItem("title").Trim() & """ /></a><div class=""productlisttitles""><a href=""" & DataItem("url").Trim() & """>" & DataItem("title").Trim() & "</a></div>"
            Else
                myTxt = "<a class=""basic"" href=""" & DataItem("url").Trim() & """><img src=""/images/home/tn/" & DataItem("filename").Trim() & """ alt=""" & DataItem("title").Trim() & """ title=""" & DataItem("title").Trim() & """ /></a>"
            End If
        End If
        If DataItem("TypeID").Equals(2) Then
            Dim strID As Integer = DataItem("ProductID")
            Dim sql As String = "SELECT ProductID, ProductName, price, url, " _
                & "(SELECT ImageFileName FROM ProductImages WHERE ProductID = Products.ProductID AND tn = 1) As Img1 " _
                & "FROM Products WHERE ProductID = @id"
 
            Dim objDR As SqlDataReader
            Dim CmdR As New SqlCommand(sql, MyConnection)
            With CmdR.Parameters
                .Add(New SqlParameter("@id", strID))
            End With
 
            MyConnection.Open()
            objDR = CmdR.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
            While objDR.Read()
                myTxt = "<a class=""basic"" href=""/product/" & objDR("url").Trim() & """><img src=""/images/products/mid/" & objDR("img1").Trim() & """ alt=""" & objDR("ProductName").Trim() & """ class=""noborder"" /></a><div class=""productlisttitles""><a class=""basic"" href=""/product/" & objDR("url").Trim() & """>" & objDR("ProductName").Trim() & "</a><br />£" & Decimal.Round(CDec(objDR("Price")), 2) & "</div>"
            End While
            MyConnection.Close()
        End If
        If DataItem("TypeID").Equals(3) Then
            myTxt = "<div class=""text255items"">" & DataItem("text").Trim() & "</div>"
            'myTxt = DataItem("text").Trim()
        End If
        Return myTxt
    End Function
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        RadToolTipManager1.TargetControls.Clear()
        'RadToolTipManager1.UpdatePanel.ClientIDMode = System.Web.UI.ClientIDMode.AutoID
        If Not Page.IsPostBack Then
            BindData()
        End If
    End Sub
 
    Private Sub BindData()
        Dim body As HtmlGenericControl = DirectCast(Page.Master.FindControl("bodyTag"), HtmlGenericControl)
        body.Attributes.Add("class", "Home")
 
        Dim MyConnection As SqlConnection
        MyConnection = New SqlConnection()
        MyConnection.ConnectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
 
        Dim sql As String = "SELECT * FROM CONTENT_PAGES WHERE PageID = 1"
 
        Dim objDR As SqlDataReader
        Dim CmdR As New SqlCommand(sql, MyConnection)
        MyConnection.Open()
        objDR = CmdR.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
        While objDR.Read()
            Page.Title = Replace(objDR("PageTitleTag").Trim(), "&", "and")
            keywords.Attributes("content") = Replace(objDR("PageKeywords").Trim(), "&", "and")
            description.Attributes("content") = Replace(objDR("PageDesc").Trim(), "&", "and")
            'lblTitle.Text = Replace(objDR("PageTitle").Trim(), "&", "and")
            Dim strText As String = objDR("PageText").Trim()
            If strText.StartsWith("<p>") Then
                lblText.Text = "</span>" & objDR("PageText").Trim() & "<span>"
            Else
                lblText.Text = "</span><p>" & objDR("PageText").Trim() & "</p><span>"
            End If
        End While
        MyConnection.Close()
 
        Dim sql3 As String = "SELECT * FROM HOME_SELECTIONS"
 
        Dim resultsDataSet3 As New DataSet()
        Dim myDataAdapter3 As SqlDataAdapter = New SqlDataAdapter(sql3, MyConnection)
        myDataAdapter3.Fill(resultsDataSet3, "title_meta")
        dlProducts.DataSource = resultsDataSet3
        dlProducts.DataBind()
    End Sub
 
    Protected Sub OnAjaxUpdate(ByVal sender As Object, ByVal args As ToolTipUpdateEventArgs)
        Me.UpdateToolTip(args.Value, args.UpdatePanel)
    End Sub
 
    Private Sub UpdateToolTip(ByVal elementID As String, ByVal panel As UpdatePanel)
        Dim ctrl As Control = Page.LoadControl("~/ProductDetails.ascx")
        panel.ContentTemplateContainer.Controls.Add(ctrl)
        Dim details As ProductDetails = DirectCast(ctrl, ProductDetails)
        details.ProductID = elementID
    End Sub
 
    Protected Sub ListBox_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
        dlProducts.DataBind()
    End Sub
 
    Protected Sub dlProducts_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles dlProducts.ItemDataBound
        Dim image As Control = e.Item.FindControl("smallImage")
        Dim currentRow As DataRowView = DirectCast(e.Item.DataItem, DataRowView)
        'Add the image id to the tooltip manager
        If Not currentRow.Row("ProductID").ToString() = 0 Then
            Me.RadToolTipManager1.TargetControls.Add(image.ClientID, currentRow.Row("ProductID").ToString(), True)
        End If
    End Sub
End Class

I've just re-downloaded and re-installed the trial, to make sure it wasn't something to do with that.

Many thanks in advance.

Rich
Richard
Top achievements
Rank 1
 answered on 06 Sep 2011
2 answers
228 views
Hi Telerik,

As a disclaimer, this question is vague. My issue is that, under certain conditions, a RadWindow will re-open itself and become non-responsive to user interaction. For instance, if I have some client-side code which is executing (may or may not center the RadWindow), and the user closes the window before this code finishes executing. Then, when the code finishes executing, the window pops back open! If the user clicks on the 'X' it does not close the window.

I suspect this is entirely my fault... possibly should not allow closing of the window until fully loaded, or find a way to cancel client-side script execution. Regardless, I was looking for a blanket fix to make sure this problem doesn't accidentally rear its head to a customer.

At this point, I'm doing something like this:

//This will only trigger when the browser window resizes.
//Fix the display of the dashboard, if theres an open window, re-center it.
function OnMainSplitterResizing() {
    displayOverBaseID = baseSplitterID;
 
    if (oWindow && oWindow.isVisible) oWindow.center();
}

In this scenario, I handle the browser window resizing. If there is an open window, I would like to move it back to the center of the page. It is my impression that calling oWindow.center on an element which is defined, but not visible, is dangerous in that it may show the window again?

Does what I'm doing make sense? Have you heard of other users experiencing similar issues / is there a standard way of handling this? Or is it just "code better and not defensively" and make sure that the state of my window is such that at any point in time, if its closed, it can respond intuitively.

Cheers,

Sean
Sean
Top achievements
Rank 2
 answered on 06 Sep 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?