Telerik Forums
UI for ASP.NET AJAX Forum
16 answers
249 views
Hi,

How can I keep track of the first column in the selected row.

I remember in ASP.NET grid I use selectedRow.cells[1]

I want to pass the value of the first cell in the selected row. I have tried grid.selectedItems, grid.selectedvalue..etc non works

How can I do that in telerik grid ?


Thanks,
Musab
Daniel
Telerik team
 answered on 22 Apr 2010
2 answers
846 views
Hello friends,

I am developing a Usercontrol that will be mounted on the main page of a WSS 3.0 Site Collection using "Return of SmartPart v3.0". Done all the AJAX configurations on the server and tested it using the Sample Ajax User control included in the with the SmartPart installation.

I have also moved the Telerik:RadScriptManager & the Telerik:RadAjaxmanager to the WSS Master page:

Seen below:

default.master

<WebPartPages:SPWebPartManager id="m" runat="Server" /> 
      <!-- Added --> 
   <telerik:RadScriptManager ID="radScriptManager" runat="server"
    </telerik:RadScriptManager> 
    <telerik:RadAjaxManager ID="radAjaxManager" runat="server"
        <AjaxSettings> 
        </AjaxSettings> 
    </telerik:RadAjaxManager> 
  <!-- End of Added --> 

Using RadAjaxManajerProxy from the user control. Here is the user control ascx:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MessageControl.ascx.cs" Inherits="Cubana.Web.UserControl.UserControls.MessageControl" %> 
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik"  %> 
 
    <telerik:RadCodeBlock ID="radCodeBlock" runat="server"
        <script type="text/javascript"
            var messageId, currentMessage, currentRowIndex = null
 
            function pageLoad(sender, args)  
            { 
 
            } 
          
            function rowSelected(sender, args)  
            { 
                $find("<%= radTabStrip.ClientID %>").set_selectedIndex(0); 
                var ajaxManager = $find('<%= radAjaxManagerProxy.ClientID %>'); 
                var selectedIndex = args.get_itemIndexHierarchical(); 
                ajaxManager.ajaxRequestWithTarget('<%= this.UniqueID %>', selectedIndex) 
                DisableControls(); 
 
            } 
             
             
            function tabSelected(sender, args)  
            { 
                 
                switch (args.get_tab().get_index()) { 
                    case 1: 
                        { 
                            EnableControls(); 
                            break; 
                        } 
                    default: 
                        { 
                            DisableControls();  
                            break; 
                        } 
            } 
 
 
            function EnableControls()  
            { 
                var txtUsernameState = $find("<%= txtUsername.ClientID %>"); 
                txtUsernameState.enable(); 
 
                var txtSubjectState = $find("<%= txtSubject.ClientID %>"); 
                txtSubjectState.enable(); 
 
                var txtReceivedState = $find("<%= txtReceived.ClientID %>"); 
                txtReceivedState.disable(); 
 
                var txtBodyState = $find("<%= txtBody.ClientID %>"); 
                txtBodyState.enable(); 
            } 
 
            function DisableControls()  
            { 
                var txtUsernameState = $find("<%= txtUsername.ClientID %>"); 
                txtUsernameState.disable(); 
 
                var txtSubjectState = $find("<%= txtSubject.ClientID %>"); 
                txtSubjectState.disable(); 
 
                var txtReceivedState = $find("<%= txtReceived.ClientID %>"); 
                txtReceivedState.disable(); 
 
                var txtBodyState = $find("<%= txtBody.ClientID %>"); 
                txtBodyState.disable(); 
            } 
                 
            } 
             
             
        </script> 
 
    </telerik:RadCodeBlock> 
    <style type="text/css"
        .body 
        { 
            margin: 0px; 
            padding: 0px; 
            height: 100%; 
            width: 100%; 
            background-color: #FFFFE0; 
        } 
        .grid td 
        { 
            cursor: pointer; 
        } 
        .button 
        { 
            background-color: Silver; 
            border: medium none; 
            height: 28px; 
            width: 90px; 
        } 
        .label 
        { 
            font-family:Verdana; 
            font-size:10px; 
        } 
    </style> 
<form id="form1" runat="server">  
<!--<telerik:RadScriptManager ID="radScriptManager" runat="server"
    </telerik:RadScriptManager>--> 
<div style="height: 100%; padding: 10px"
    <%--<telerik:RadAjaxManager ID="radAjaxManager" runat="server"
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="rgData"
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="rgData" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManager>--%> 
    <telerik:RadAjaxManagerProxy ID="radAjaxManagerProxy" runat="server"
       </telerik:RadAjaxManagerProxy> 
    <telerik:RadWindowManager ID="radWindowManager" runat="server"
            </telerik:RadWindowManager>  
             <telerik:RadTabStrip ID="radTabMailBox" Style="margin-top: 10px;" 
        SelectedIndex="0" AutoPostBack="True" runat="server"  
        ontabclick="radTabMailBox_TabClick"
        <Tabs> 
            <telerik:RadTab Text="Inbox" Selected="True" /> 
            <telerik:RadTab Text="Sent Items" Selected="False" /> 
        </Tabs> 
    </telerik:RadTabStrip> 
    <telerik:RadGrid ID="radgridList" CssClass="grid" runat="server" GridLines="None" 
        AutoGenerateColumns="False" OnSelectedIndexChanged="radgridList_SelectedIndexChanged"
        <MasterTableView TableLayout="Fixed"
            <Columns> 
                <telerik:GridBoundColumn UniqueName="MessageId" DataField="MessageId" DataType="System.Guid" 
                    Visible="false" HeaderText="MessageId"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn UniqueName="UserName" DataField="UserName" Visible="true" 
                    HeaderText="Sender"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn UniqueName="Title" DataField="Title" Visible="true" HeaderText="Subject"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn UniqueName="DateTimeCreated" DataField="DateTimeCreated" 
                    Visible="true" HeaderText="Received"
                </telerik:GridBoundColumn> 
            </Columns> 
        </MasterTableView> 
        <ClientSettings> 
            <Selecting AllowRowSelect="true" /> 
            <ClientEvents OnRowSelected="rowSelected" /> 
            <Scrolling AllowScroll="true" UseStaticHeaders="true" /> 
        </ClientSettings> 
    </telerik:RadGrid> 
    <telerik:RadTabStrip ID="radTabStrip" OnClientTabSelected="tabSelected" Style="margin-top: 10px;" 
        SelectedIndex="0" AutoPostBack="True" OnTabClick="RadTabStrip_TabClick" runat="server"
        <Tabs> 
            <telerik:RadTab Text="View Message" Selected="True" /> 
            <telerik:RadTab Text="New Message" Selected="False" /> 
        </Tabs> 
    </telerik:RadTabStrip> 
    <div style="border: 1px solid threedshadow;"
        <table border="0" style="margin-top: 20px; width: 100%;"
            <tr> 
                <td> 
                </td> 
                <td> 
                    <asp:Button ID="btnDelete" CssClass="button" Style="float: right; margin-right: 10px; 
                        color: black; font-weight: bold;" Text="Delete" runat="server" OnClick="btnDelete_Click" /> 
                    <asp:Button ID="btnSend" CssClass="button" Style="float: right; margin-right: 10px; 
                        color: black; font-weight: bold;" Text="Send" runat="server" OnClick="btnSend_Click" /> 
                </td> 
            </tr> 
            <tr> 
                <td> 
                    <asp:Label ID="lblUserName" Text="Sender" CssClass="label" runat="server"></asp:Label> 
                </td> 
                <td> 
                    <telerik:RadComboBox ID="txtUsername" CssClass="label" runat="server" Width="500px" 
                        AllowCustomText="True" /> 
                    &nbsp; &nbsp;<asp:Label ID="lblUsernameError" Text="Please choose a Recipient" CssClass="label" 
                        runat="server" ForeColor="Red" Visible="False"></asp:Label> 
                </td> 
            </tr> 
            <tr> 
                <td> 
                    <asp:Label ID="lblSubject" Text="Subject" CssClass="label" runat="server"></asp:Label> 
                </td> 
                <td> 
                    <telerik:RadTextBox ID="txtSubject" runat="server" Width="500px" /> 
                </td> 
            </tr> 
            <tr> 
                <td> 
                    <asp:Label ID="lblReceived" Text="Received" CssClass="label" runat="server"></asp:Label> 
                </td> 
                <td> 
                    <telerik:RadTextBox ID="txtReceived" runat="server" Width="250px" /> 
                </td> 
            </tr> 
            <tr> 
                <td style="vertical-align: top;"
                    <asp:Label ID="lblBody" Text="Body" CssClass="label" runat="server"></asp:Label> 
                </td> 
                <td> 
                    <telerik:RadTextBox ID="txtBody" runat="server" Height="500px" Width="500px" Columns="2" 
                        TextMode="MultiLine" /> 
                </td> 
            </tr> 
        </table> 
    </div> 
</div> 
</form> 
 

Even though there is only one ScriptManager present I am getting the following error when the main page loads from the Site Collection.

Only one instance of a ScriptManager can be added to the page.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Only one instance of a ScriptManager can be added to the page.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[InvalidOperationException: Only one instance of a ScriptManager can be added to the page.]
System.Web.UI.ScriptManager.OnInit(EventArgs e) +384553
Telerik.Web.UI.RadScriptManager.OnInit(EventArgs e) +68
System.Web.UI.Control.InitRecursive(Control namingContainer) +333
System.Web.UI.Control.InitRecursive(Control namingContainer) +210
System.Web.UI.Control.InitRecursive(Control namingContainer) +210
System.Web.UI.Control.AddedControl(Control control, Int32 index) +198
System.Web.UI.ControlCollection.Add(Control child) +80
SmartPart.SmartPart.CreateChildControls() +46
System.Web.UI.Control.EnsureChildControls() +87
System.Web.UI.Control.PreRenderRecursiveInternal() +44
System.Web.UI.WebControls.WebParts.WebPart.PreRenderRecursiveInternal() +42
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842




Any help would be greatly appreciated. Let me know if I have to sent through more information.

Thank you,
Pierre.
Eliza Sahoo
Top achievements
Rank 1
 answered on 22 Apr 2010
3 answers
152 views
Hi, i face grouping error in groping resources in radscheduler.
 I had follow all the steps in the demo but  when it come to groupby it fail.
My error is as below :
Line :3396
Char:26
Err:'this.cells0.offsetHeight is null or not an object'
code:0

Does anyone has idea on this ??


My coding is as below :
<telerik:RadScheduler ID="RadScheduler1" runat="server" GroupBy="LineNum"  
        DataKeyField="ID" DataSubjectField="Desc" 
                DataStartField="StartDate" DataEndField="EndDate" 
                DataRecurrenceField="ID" SelectedDate="2010-04-22" 
                DataRecurrenceParentKeyField="ID" RowHeaderWidth="52px" 
                 SelectedView =TimelineView  
                > 
                <AdvancedForm Modal="true" /> 
    
        </telerik:RadScheduler> 
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 
 
     
 
 
        Try 
            If Not Page.IsPostBack = True Then 
               CreateTable() 
               AddRowTomdsResult() 
 
                RadScheduler1.DataSource = mdsResult 
                RadScheduler1.DataBind() 
            
 
 
            End If 
        Catch ex As Exception 
            Throw ex 
        End Try 
       
       Private Sub AddRowTomdsResult() 
 
        Dim dr As Data.DataRow 
 
        Try 
            dr = mdsResult.Tables(0).NewRow 
            dr("ID") = 1 
            dr("LineNum") = "1.1" 
            dr("ShiftNum") = "Morning" 
            dr("Desc") = "X1" 
            dr("StartDate") = "3/3/2010" 
            dr("EndDate") = "3/3/2010" 
            mdsResult.Tables(0).Rows.Add(dr) 
 
 
            dr = mdsResult.Tables(0).NewRow 
            dr("ID") = 2 
            dr("LineNum") = "1.1" 
            dr("ShiftNum") = "Morning" 
            dr("Desc") = "X1" 
            dr("StartDate") = "3/3/2010" 
            dr("EndDate") = "3/3/2010" 
            mdsResult.Tables(0).Rows.Add(dr) 
 
 
            dr = mdsResult.Tables(0).NewRow 
            dr("ID") = 3 
            dr("LineNum") = "1.1" 
            dr("ShiftNum") = "Morning" 
            dr("Desc") = "X1" 
            dr("StartDate") = "3/3/2010" 
            dr("EndDate") = "3/3/2010" 
            mdsResult.Tables(0).Rows.Add(dr) 
 
            dr = mdsResult.Tables(0).NewRow 
            dr("ID") = 4 
            dr("LineNum") = "1.2" 
            dr("ShiftNum") = "Grave" 
            dr("Desc") = "X1" 
            dr("StartDate") = "4/22/2010" 
            dr("EndDate") = "4/22/2010" 
            mdsResult.Tables(0).Rows.Add(dr) 
 
 
            dr = mdsResult.Tables(0).NewRow 
            dr("ID") = 5 
            dr("LineNum") = "1.2" 
            dr("ShiftNum") = "Grave" 
            dr("Desc") = "X1" 
            dr("StartDate") = "4/22/2010" 
            dr("EndDate") = "4/22/2010" 
            mdsResult.Tables(0).Rows.Add(dr) 
 
 
            dr = mdsResult.Tables(0).NewRow 
            dr("ID") = 6 
            dr("LineNum") = "1.2" 
            dr("ShiftNum") = "Grave" 
            dr("Desc") = "X1" 
            dr("StartDate") = "4/22/2010" 
            dr("EndDate") = "4/22/2010" 
            mdsResult.Tables(0).Rows.Add(dr) 
 
 
        Catch ex As Exception 
            Throw ex 
        End Try 
 
    End Sub 
 
 
    Private Sub CreateTable() 
        Dim table As New DataTable 
        Dim column As DataColumn 
 
        Try 
            column = New DataColumn() 
            column.DataType = System.Type.GetType("System.Int32") 
            column.ColumnName = "ID" 
            column.ReadOnly = False 
            column.Unique = False 
            table.Columns.Add(column) 
 
 
 
            column = New DataColumn() 
            column.DataType = System.Type.GetType("System.String") 
            column.ColumnName = "LineNum" 
            column.ReadOnly = False 
            column.Unique = False 
            table.Columns.Add(column) 
 
            column = New DataColumn() 
            column.DataType = System.Type.GetType("System.String") 
            column.ColumnName = "ShiftNum" 
            column.ReadOnly = False 
            column.Unique = False 
            table.Columns.Add(column) 
 
 
            column = New DataColumn() 
            column.DataType = System.Type.GetType("System.String") 
            column.ColumnName = "Desc" 
            column.ReadOnly = False 
            column.Unique = False 
            table.Columns.Add(column) 
 
 
            column = New DataColumn() 
            column.DataType = System.Type.GetType("System.DateTime") 
            column.ColumnName = "StartDate" 
            column.ReadOnly = False 
            column.Unique = False 
            table.Columns.Add(column) 
 
            column = New DataColumn() 
            column.DataType = System.Type.GetType("System.DateTime") 
            column.ColumnName = "EndDate" 
            column.ReadOnly = False 
            column.Unique = False 
            table.Columns.Add(column) 
 
            mdsResult.Tables.Add(table) 
 
        Catch ex As Exception 
            Throw ex 
        End Try 
 
    End Sub 
 
 
 
 
    End Sub
johnson lim
Top achievements
Rank 1
 answered on 22 Apr 2010
2 answers
148 views
When I entered edit mode, rows under my  GridDropDownColumn are not being populated. Img1 shows view mode and img2 shows the edit mode of the Radgrid. Here are the codes:
protected void grdSalesPerson_ItemDataBound(object sender, GridItemEventArgs e) 
        { 
            if (e.Item is GridEditableItem && (e.Item as GridEditableItem).IsInEditMode) 
            { 
                GridEditableItem editedItem = e.Item as GridEditableItem; 
                GridEditManager editMan = editedItem.EditManager; 
 
                GridDropDownColumnEditor editor = editMan.GetColumnEditor("Manager"as GridDropDownColumnEditor; 
                Int64 selectedManagerID = ((User)editedItem.DataItem).ManagerID; 
               
                editor.DataSource = Managers; 
                editor.DataTextField = "FullName"
                editor.DataValueField = "UserID"
                editor.DataBind(); 
 
                editor.SelectedValue = selectedManagerID.ToString(); 
               
            } 
        } 
:

<MasterTableView EditMode="InPlace" DataKeyNames="UserID"
    <Columns> 
        <telerik:GridBoundColumn DataField="FullName" HeaderText="Salesperson"  
            UniqueName="FullName" ReadOnly="True"
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Email" HeaderText="Email"  
            UniqueName="Email" ReadOnly="True"
        </telerik:GridBoundColumn> 
        <telerik:GridDropDownColumn UniqueName="Manager" ListDataMember="Users" 
            ListTextField="ManagerFullName" ListValueField="ManagerID" 
            HeaderText="Manager" DataField="ManagerID"
        </telerik:GridDropDownColumn> 
    </Columns> 
</MasterTableView> 
    </telerik:RadGrid> 

Web team
Top achievements
Rank 1
 answered on 22 Apr 2010
1 answer
256 views

 

MasterTableView.FilterExpression in a RadGrid in a FormView

I tried to apply a filter to a Radgrid found in a FormView, but apparently the filter is not applied correctly, I am using the following:

 

 ((RadGrid)FormView1.FindControl("gvregion")).MasterTableView.FilterExpression = "([Localidad] LIKE '%SANTA%')";  
 ((RadGrid)FormView1.FindControl("gvregion")).MasterTableView.Rebind(); 

 

Check if the property was correctly set will with the following:

Response.Write(((RadGrid)FormView1.FindControl("gvregion")).MasterTableView.FilterExpression); 

 

But it does not filter properly, displays: "No records to display." There are records that affect the criteria but does not display, anyone can help me?, Thanks.

 

 

Radoslav
Telerik team
 answered on 22 Apr 2010
1 answer
82 views

I am building a page in which a user can re-configure the Site Map. In summary:

1  The site map's pages are displayed on the page in a tree layout.

2  On the client side, the user can drag and drop pages in the tree to reconfigure it.

3  When the user has completed the changes, they are uploaded to the server to update the site map database table.

Can I use your Drag and Drop facility to do this?

If so, please refer me to appropriate tutorials and examples.

Your help would be much appreciated.

Thanking you in anticipation.

Roger

 

Nikolay Tsenkov
Telerik team
 answered on 22 Apr 2010
1 answer
102 views
Hi All,
          I m developing a webpart (in Sharepoint) in which I m using RadAjaxPanel to bind the control to the RadAjaxPanel in oeder to prevent postback. The webpart  displays the set of result bind in a datalist in which each raow contain one hyperlink upon the click of which it will redirect to a new page. Till here all works well but if I click on back button all the result set get vanished. I do figure out that using RadAjaxPanel the ViewStateof the page is not maintained. Can anybody help me out on how to preserve the viewstate of the page when using RadAjaxPane when redirected to other page. I m adding RadAjaxPanel Dynamically.


Any help will be appreciated.

Regards
Ajeet 
Iana Tsolova
Telerik team
 answered on 22 Apr 2010
1 answer
129 views
I am using classical version of telerik controls in my project.

I am trying to do the following thing.

Scenario: 
I have dock objects. Each dock object contain a button. when the button is clicked a new window will open within that dock object. 
I attached a jpg file for proper visualization. 

I have no idea is it possible or not. 

Animesh Chandra Dey



Pero
Telerik team
 answered on 22 Apr 2010
1 answer
65 views
Hi,

I've got a grid containing various columns from several joined tables. Also, the client requested Excell style filtering which means that for each column I'm generating a custom filter control in the header to mimic Excell (basically combobox checklist dropdown).

Now I also require updates to be possible for a few fields in this set, basically that shouldn't be too much of a problem. Let the update column generate and use the command events.
However, as I mention above, binding the grid takes some work and therefore some time as well. Clearly you can imagine that it's not desireable for any user to have to wait for the entire process to run each time an itemcommand is fired.
Both 'edit' and 'update' will  trigger the selecting events for each datasource. So the whole grid gets bound (selecting event of the main datasource/NeedDataSource event) and the combobox filters also get rebound (selecting event of those controls' respective datasources).

So ... shouldn't there be some way I can put a row in edit mode w/o rebinding the whole thing?

Actually it's sort of the same thing for the filtering. Can I not bind the data to the grid w/o rebinding all the custom filters?

Greetz
Yavor
Telerik team
 answered on 22 Apr 2010
4 answers
92 views
Hello,
how can i change the font / size of the current file? With the CSS selector .ruCurrentFile i can only set background-color etc but not the font or the size of the font.

with best regards
Meik Napierski
Meik Napierski
Top achievements
Rank 1
 answered on 22 Apr 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
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?