Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
115 views
If an unhandled exception occurs within the page that's loaded in the Telerik Window, how would we close the window and show the unhandled exception in the main page?

I understand that I can inject the javascript to close the window from the server side, but If I inject the script on the OnError handler on the page, the page never completes rendering and the javascript for closing the window never fires.

PS: Currently, we are using the Application_Error in Global.asax.cs to handle unhandled exceptions.
Marin Bratanov
Telerik team
 answered on 07 Apr 2011
1 answer
62 views
Hi,

I'm trying to implement the client side editing with server side updating but I'm running into a problem.  Our grid has two drop downs which need to be loaded with data from the database if the cell that contains the drop down is double clicked.  Are there any events that can be captured client side, or is there a way we can raise an event of our own to populate the drop down?

Another problem is that the second drop down's data is dependent on what is selected from the first drop down.  Would there be a way to load data from the database when an item is selected from the first drop down?  If we can't do this is there another way we can do batch that will fix all of these problems?
Daniel
Telerik team
 answered on 07 Apr 2011
1 answer
50 views
I have a ASP.NET website that allows the user to stay logged in for an indefinite time.  I am trying to show a certain page or non closable rad window etc. every 30 days.  Right now I put the code below in my Master Page. The problem is that this runs on every page and I am sure there is a better way to do this.  I would redirect them to a page that checked this on login but they do not login for each visit.  I thought there may be a way to use the Global.asax page.  Any thought would be greatly appreciated.
if( !IsPostBack)
        {
            // Show Must Read Message When Profile Message Column is set to "Show"
                if (Profile.Message == "Show")
                {
                    Response.Redirect("~/xProfileMessage.aspx");
                }
 
            // Show Update Profile Page Every 30 days
                int DaysSinceProfileUpdate = (DateTime.Now - Profile.LastUpdatedDate).Days;
                 
                if (DaysSinceProfileUpdate > 30)
                {
                    Response.Redirect("~/xEditProfileAuto.aspx");
                }
}
Marin Bratanov
Telerik team
 answered on 07 Apr 2011
2 answers
64 views
I was playing with the dashboard recently and trying to adapt it to an alternate datasource but after trying to track down a problem I was encountering I noticed that it's actually a problem in the Sales Dashboard example itself. When you click on a person's name the silverlight controls in the main content area all update based off of an employee id being access in the Javascript, but the silverlight controls don't update correctly on the first attempt.

Sales Dashboard Example

If you open up the example, you'll get metrics for the first peron in the list, Nancy. And the Representative Sales of that first pair of data points is $7,332 (first green bar). If you select the next person over (Andrew), you'll notice the Rep Sales total of that first green bar stays at $7,332, it doesn't update at all. But if you select Andrew again, it NOW updates and shows the correct value of $3,099. After playing with the code that drives this I came to the conclusion that although the content for the main panel is being updated via using AJAX, the page is not correctly updating the Id that is stored in Javascript for access by the silverlight controls.

My question is, given this problem (if I'm right) how would you fix it? I mean, aren't the examples supposed to show working demos ;-)
Iana Tsolova
Telerik team
 answered on 07 Apr 2011
1 answer
217 views
I have a RadGrid with 2 inner layers of details tables.

I set this.radGrid.MasterTableView.HierarchyDefaultExpanded = true; before rebinding my grid for the export but it only expands 1 inner details table. How to expand all inner details tables? Thanks,
Pooya
Top achievements
Rank 1
 answered on 07 Apr 2011
5 answers
267 views
I am trying to accomplish using a single Radgrid for 7 different tables.  (one aspx page)  I am also wrapping my datasource updates (CRUD) in a Property procedure.  It is working pretty well except for inserting a new row in a table.  My problem is that it is posting the update to the radgrid control and the database twice,  I have spent many hours trying to debug my problem using the call stack and various other methods and what I have determined is that when I press the Insert link button (in-place editing), it is running the Radgrid_InsertCommand procedure twice and I am going slowly mad trying to figure out why.  My code is attached,  This could be a real challenge for the telerik MVPs. (or not!)  Thanks in advance.  (if I could, I would award 1000 points - but that's another site ;->)
P.S.  The Delete and Update commands work just fine using this code.  The difference is the insert process is activated from a RadButton outside the grid.  My aspx file has only the OnInsert, OnDelete, OnUpdate Commands.and the various SQLDataSources  The grid columns are built dynamically in code behind depending on the table the user chooses.
Protected Sub rgDisplay_InsertCommand(sender As Object, e As Telerik.Web.UI.GridCommandEventArgs) Handles rgDisplay.InsertCommand
        Dim editeditem As GridEditableItem = CType(e.Item, GridEditableItem)
        Dim dataTbl As DataTable = Me.GridSource
        Dim newRow As DataRow = dataTbl.NewRow
  
            Try 'calculate the next record key
                cmd.CommandText = "SELECT MAX(CMT_REC_ID) FROM tblTSComments"
                cmd.Connection = conn
                conn.Open()
                intLastKey = Convert.ToInt16(cmd.ExecuteScalar().ToString)
                intLastKey += 1
            Finally
                conn.Close()
            End Try
  
            Dim newValues As Hashtable = New Hashtable
            e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editeditem)
            Try
                For Each entry As DictionaryEntry In newValues
                    If entry.Key = "CMT_REC_ID" Then
                        newRow("CMT_REC_ID") = intLastKey
                    Else
                        newRow(entry.Key) = entry.Value
                    End If
                Next
                dataTbl.Rows.Add(newRow)
                Me.GridSource = dataTbl
            Catch ex As Exception
                ' Error message goes here
                e.Canceled = True
            End Try
    End Sub
Private Property GridSource As DataTable
        Get
            Dim obj As Object = Me.ViewState("_gvs")
            If (Not obj Is Nothing) Then
                Return CType(obj, DataTable)
            Else
                Dim intRpt As Integer = Request("Report")
                Select Case intRpt
                    Case 0 'Comments
                        adp.SelectCommand = New OleDbCommand("SELECT CMT_REC_ID, CMT_DESCRIPTION FROM tblTSComments", conn)
                        Dim cmtstbl As New DataTable
                        conn.Open()
                        Try
                            adp.Fill(cmtstbl)
                        Finally
                            conn.Close()
                        End Try
                        Me.ViewState("_gvs") = cmtstbl
                        Return cmtstbl
                    Case 1 'Teams
                        adp.SelectCommand = New OleDbCommand("SELECT CT_TEAM_REC_ID, CT_TEAM_NAME, CT_REPORTS_TO FROM tblControllerTeam", conn)
                        Dim teamTbl As New DataTable
                        conn.Open()
                        Try
                            adp.Fill(teamTbl)
                        Finally
                            conn.Close()
                        End Try
                        Me.ViewState("_gvs") = teamTbl
                        Return teamTbl
                    Case 2 'Status
                        adp.SelectCommand = New OleDbCommand("SELECT TCS_STATUS_CODE, TCS_DESCRIPTION FROM tblEmplStatus", conn)
                        Dim statusTbl As New DataTable
                        conn.Open()
                        Try
                            adp.Fill(statusTbl)
                        Finally
                            conn.Close()
                        End Try
                        Me.ViewState("_gvs") = statusTbl
                        Return statusTbl
                    Case 3 'PayPeriod
                        adp.SelectCommand = New OleDbCommand("SELECT PAYPERIOD, PAYPERIODNBR, PAYPERIODLOCKED, PAYPERIODLOCKEDDATE, PAYPERIODLOCKID FROM PayPeriods ORDER BY PAYPERIOD", conn)
                        Dim ppTbl As New DataTable
                        conn.Open()
                        Try
                            adp.Fill(ppTbl)
                        Finally
                            conn.Close()
                        End Try
                        Me.ViewState("_gvs") = ppTbl
                        Return ppTbl
                    Case 4 'Team Leader
                        adp.SelectCommand = New OleDbCommand("SELECT OPF_NTUSER_ID, OPF_FNAME, OPF_MINIT, OPF_LNAME, OPF_REGION FROM tblOpsFacilitator", conn)
                        Dim leadTbl As New DataTable
                        conn.Open()
                        Try
                            adp.Fill(leadTbl)
                        Finally
                            conn.Close()
                        End Try
                        Me.ViewState("_gvs") = leadTbl
                        Return leadTbl
                    Case 5 'Vacation and Pers Choice Available
                        adp.SelectCommand = New OleDbCommand("SELECT TTE_NTUSER_ID, TTE_SOCIAL_SECURITY_NBR, TTE_FNAME + ' ' + TTE_LNAME AS NAME, TTE_TOTL_VAC_AVAIL, TTE_TOTL_PERS_CHOICE_AVAIL FROM tblTCCTimeCardEmployees WHERE TTE_EMPL_STATUS = 'A' ORDER BY TTE_NTUSER_ID", conn)
                        Dim vacPCHTbl As New DataTable
                        conn.Open()
                        Try
                            adp.Fill(vacPCHTbl)
                        Finally
                            conn.Close()
                        End Try
                        Me.ViewState("_gvs") = vacPCHTbl
                        Return vacPCHTbl
                    Case 6 'Rates
                        adp.SelectCommand = New OleDbCommand("SELECT TTE_NTUSER_ID, TTE_SOCIAL_SECURITY_NBR, TTE_FNAME + ' ' + TTE_LNAME AS NAME, TTE_EMPL_CATEGORY, TTE_CALC_TIMESHEET, TTE_FIVE_PCNT_RATE, TTE_TEN_PCNT_RATE FROM tblTCCTimeCardEmployees WHERE TTE_EMPL_STATUS = 'A' ORDER BY TTE_NTUSER_ID", conn)
                        Dim rateTbl As New DataTable
                        conn.Open()
                        Try
                            adp.Fill(rateTbl)
                        Finally
                            conn.Close()
                        End Try
                        Me.ViewState("_gvs") = rateTbl
                        Return rateTbl
                End Select
            End If
        End Get
        Set(value As DataTable)
            Dim intRpt As Integer = Request("Report")
            Select Case intRpt
                Case 0 'Comments
                    Try
                        adp.SelectCommand = New OleDbCommand("SELECT CMT_REC_ID, CMT_DESCRIPTION FROM tblTSComments", conn)
                        Dim cmdBldr As OleDbCommandBuilder = New OleDbCommandBuilder(adp)
                        conn.Open()
                        adp.Update(value)
                    Catch ex As Exception
                        'Error during update, add code to locate error, reconcile and try again
                    Finally
                        conn.Close()
                    End Try
                Case 1 'Teams
                    Try
                        adp.SelectCommand = New OleDbCommand("SELECT CT_TEAM_REC_ID, CT_TEAM_NAME, CT_REPORTS_TO FROM tblControllerTeam", conn)
                        Dim cmdBldr As OleDbCommandBuilder = New OleDbCommandBuilder(adp)
                        conn.Open()
                        adp.Update(value)
                    Catch ex As Exception
                        'Error during update, add code to locate error, reconcile and try again
                    Finally
                        conn.Close()
                    End Try
                Case 2 'Status
                    Try
                        adp.SelectCommand = New OleDbCommand("SELECT TCS_STATUS_CODE, TCS_DESCRIPTION FROM tblEmplStatus", conn)
                        Dim cmdBldr As OleDbCommandBuilder = New OleDbCommandBuilder(adp)
                        conn.Open()
                        adp.Update(value)
                    Catch ex As Exception
                        'Error during update, add code to locate error, reconcile and try again
                    Finally
                        conn.Close()
                    End Try
                Case 3 'PayPeriod
                    Try
                        adp.SelectCommand = New OleDbCommand("SELECT PAYPERIOD, PAYPERIODNBR, PAYPERIODLOCKED, PAYPERIODLOCKEDDATE, PAYPERIODLOCKID FROM PayPeriods ORDER BY PAYPERIOD", conn)
                        Dim cmdBldr As OleDbCommandBuilder = New OleDbCommandBuilder(adp)
                        conn.Open()
                        adp.Update(value)
                    Catch ex As Exception
                        'Error during update, add code to locate error, reconcile and try again
                    Finally
                        conn.Close()
                    End Try
                Case 4 'Team Leader
                    Try
                        adp.SelectCommand = New OleDbCommand("SELECT OPF_NTUSER_ID, OPF_FNAME, OPF_MINIT, OPF_LNAME, OPF_REGION FROM tblOpsFacilitator", conn)
                        Dim cmdBldr As OleDbCommandBuilder = New OleDbCommandBuilder(adp)
                        conn.Open()
                        adp.Update(value)
                    Catch ex As Exception
                        'Error during update, add code to locate error, reconcile and try again
                    Finally
                        conn.Close()
                    End Try
                Case 5 'Vacation and Pers Choice Available
                    Try
                        adp.SelectCommand = New OleDbCommand("SELECT TTE_NTUSER_ID, TTE_SOCIAL_SECURITY_NBR, TTE_FNAME + ' ' + TTE_LNAME AS NAME, TTE_TOTL_VAC_AVAIL, TTE_TOTL_PERS_CHOICE_AVAIL FROM tblTCCTimeCardEmployees WHERE TTE_EMPL_STATUS = 'A' ORDER BY TTE_NTUSER_ID", conn)
                        Dim cmdBldr As OleDbCommandBuilder = New OleDbCommandBuilder(adp)
                        conn.Open()
                        adp.Update(value)
                    Catch ex As Exception
                        'Error during update, add code to locate error, reconcile and try again
                    Finally
                        conn.Close()
                    End Try
                Case 6 'Rates
                    Try
                        adp.SelectCommand = New OleDbCommand("SELECT TTE_NTUSER_ID, TTE_SOCIAL_SECURITY_NBR, TTE_FNAME + ' ' + TTE_LNAME AS NAME, TTE_EMPL_CATEGORY, TTE_CALC_TIMESHEET, TTE_FIVE_PCNT_RATE, TTE_TEN_PCNT_RATE FROM tblTCCTimeCardEmployees WHERE TTE_EMPL_STATUS = 'A' ORDER BY TTE_NTUSER_ID", conn)
                        Dim cmdBldr As OleDbCommandBuilder = New OleDbCommandBuilder(adp)
                        conn.Open()
                        adp.Update(value)
                    Catch ex As Exception
                        'Error during update, add code to locate error, reconcile and try again
                    Finally
                        conn.Close()
                    End Try
            End Select
        End Set
    End Property
  
    Protected Sub cmdAdd_Click(sender As Object, e As System.EventArgs) Handles cmdAdd.Click
        rgDisplay.MasterTableView.InsertItem()
    End Sub
End Class
Chuck Harrington
Top achievements
Rank 1
 answered on 07 Apr 2011
5 answers
162 views
Hi,
I am using Vertical RadSpliter  with 2 RadPane inside. But as I collapse the left pane, the collapse/resize button disappears and I cannot rezise this right pane. The left pane is also partially hidden by the vertical scroll bar.

I really need you help to solve the problem. This is very urgent.

Thanks,
Hai Tran
Hai
Top achievements
Rank 1
 answered on 07 Apr 2011
2 answers
64 views
Hi there,

I'm trying to develop an aspx website to dynamically generate HTML pages made up of predefined elements stored in a database.

Basically the generated pages consist of elements occupying 50% of the width of the page, and elements spanning 100%.
I'd like to create a drag and drop interface allowing users to drag the predefined elements to a 'layout' grid containing two columns. One for the left part of the generated html file, and one for the right part. The dropped elements should then be edited by the user so that he/she can input values like name and id for each dropped element.

Any suggestions which controlls to use and how to use them?
Thanks in advance.

Erik
Erik
Top achievements
Rank 1
 answered on 07 Apr 2011
1 answer
73 views

Hi,

I have a telrik grid which shows Hierarchical data in telrik grid. I want to populate one more grid(gridTeamMembers) in code below when user selects a row from detailtables ie groupID. I have problem selecting the groupID of Hierarchical  grid which I want to pass to the 3rd grid(gridTeamMembers). I want to use this groupID in SqlDataSource3 to populate the gridTeamMembers grid.

Please help. Here is my code.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
   <script type="text/javascript">
     //<![CDATA[
    

       var grid;

       function GridCreated() {
           grid = this;
       }

     
     
          //]]>
        </script>
       
   
</head>
<body>
    <form runat="server" id="mainForm" method="post">
      
     <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
        <!-- content start -->
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>

        <telerik:RadSplitter ID="RadSplitter1" Width="700px" runat="server" Orientation="Vertical">
            <telerik:RadPane ID="gridPane" runat="server" Height="307px"
                Scrolling="None">
               

        <telerik:RadGrid ID="RadGrid1" OnPreRender="RadGrid1_PreRender" ShowStatusBar="true" DataSourceID="SqlDataSource1"
            runat="server" AutoGenerateColumns="False" PageSize="7" AllowSorting="True" AllowMultiRowSelection="true"
            AllowPaging="True" GridLines="None">
            <PagerStyle Mode="NumericPages"></PagerStyle>
          
            <MasterTableView DataSourceID="SqlDataSource1" DataKeyNames="MainGroupID" AllowMultiColumnSorting="True">
          
                <DetailTables>
                    <telerik:GridTableView DataKeyNames="GroupID" DataSourceID="SqlDataSource2" Width="100%"
                        runat="server">
                      
                        <ParentTableRelation>
                            <telerik:GridRelationFields DetailKeyField="MainGroupID" MasterKeyField="MainGroupID" />
                        </ParentTableRelation>
                       
                        <Columns>
                            <telerik:GridTemplateColumn UniqueName="GroupID" DataField="GroupID">
                                <ItemTemplate>
                                    <asp:Label ID="Label1" Font-Bold="true" Font-Italic="true" Text='<%# Eval("GroupID") %>' Visible="false" runat="server" />
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridBoundColumn SortExpression="GroupID" HeaderText="GroupID" HeaderButtonType="TextButton"
                                DataField="GroupID" UniqueName="GroupID">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="GroupName" HeaderText="Group Name" HeaderButtonType="TextButton"
                                DataField="GroupName" UniqueName="GroupName">
                            </telerik:GridBoundColumn>                           
                        </Columns>
                        <SortExpressions>
                            <telerik:GridSortExpression FieldName="GroupName"></telerik:GridSortExpression>
                        </SortExpressions>
                      
                    </telerik:GridTableView>
                </DetailTables>
                <Columns>
                   
                    <telerik:GridBoundColumn SortExpression="MainGroupID" HeaderText="MainGroupID" HeaderButtonType="TextButton"
                        DataField="MainGroupID" UniqueName="MainGroupID">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="MainGroupName" HeaderText="MainGroup Name" HeaderButtonType="TextButton"
                        DataField="MainGroupName" UniqueName="MainGroupName">
                    </telerik:GridBoundColumn>
                   
                </Columns>
                <SortExpressions>
                    <telerik:GridSortExpression FieldName="MainGroupName"></telerik:GridSortExpression>
                </SortExpressions>
                
            </MasterTableView>
            <ClientSettings EnablePostBackOnRowClick="true">
                            <Selecting AllowRowSelect="True" />
                        </ClientSettings>
        </telerik:RadGrid>

         </telerik:RadPane>
            <telerik:RadSplitBar CollapseMode="Both" ID="RadSplitBar2" runat="server" EnableResize="True">
            </telerik:RadSplitBar>
            <telerik:RadPane ID="listBoxPane" runat="server" CssClass="TextStyle" BackColor="#d9eeff">
               
                   <div id="divTeamMembers" style="height:260px;overflow-y:auto;padding:10px 10px 10px 10px; margin:10px 10px 10px 10px;">
                          <telerik:RadGrid ID="gridTeamMembers" runat="server"
                            DataSourceID="SqlDataSource3" Skin="Office2007"                            
                            AllowSorting="true" AllowPaging="false" AllowFilteringByColumn="false"
                            AutoGenerateColumns="false" ShowStatusBar="true" AllowMultiRowSelection="True"
                            Width="99%"
                            >
                                                   
                          
                           <MasterTableView Width="100%" DataKeyNames="MemID"
                                CommandItemDisplay="Top"    DataSourceID="dsTeamMemberInfo"
                                HorizontalAlign="NotSet"
                                AutoGenerateColumns="False"
                                AllowAutomaticUpdates="False"
                                AllowAutomaticInserts="False"
                                AllowAutomaticDeletes="False"
                                EditMode="PopUp">

                           

                            <Columns>
                              
                                <telerik:GridBoundColumn UniqueName="FirstName" DataField="FirstName" HeaderText="First Name" SortExpression="FirstName" AllowFiltering="false" ItemStyle-HorizontalAlign="Left" />
                                <telerik:GridBoundColumn UniqueName="LastName" DataField="LastName" HeaderText="Last Name" SortExpression="LastName" AllowFiltering="false" ItemStyle-HorizontalAlign="Left" />
                              
                            </Columns>
                        </MasterTableView>
                        <ClientSettings EnableRowHoverStyle="true">
                            <Selecting AllowRowSelect="True" />
                             <ClientEvents OnGridCreated="GridCreated"></ClientEvents>                                                         
                        </ClientSettings>                                                           
                        </telerik:RadGrid>
                        </div>
                
            </telerik:RadPane>
        </telerik:RadSplitter>

        <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:testConnectionString %>"
            ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM TestGroups"
            runat="server"></asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource2" ConnectionString="<%$ ConnectionStrings:testConnectionString %>"
            ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM TestGroups1 Where MainGroupID = @MainGroupID"
            runat="server">
            <SelectParameters>
                <asp:Parameter Name="MainGroupID" Type="string" />
            </SelectParameters>
        </asp:SqlDataSource>
       
        <!-- content end -->

        <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
        ConnectionString="<%$ ConnectionStrings:EIProfileConnectionString %>"
        SelectCommand="GetMemberDetail" SelectCommandType="StoredProcedure">
         <SelectParameters>
            <asp:ControlParameter ControlId="Radgrid1" Name="GroupID" PropertyName="SelectedValue" Type="Int32"/>
        </SelectParameters>
    </asp:SqlDataSource>
     
    </form>

</body>
</html>

Iana Tsolova
Telerik team
 answered on 07 Apr 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?