Telerik Forums
UI for ASP.NET AJAX Forum
14 answers
272 views
Hello,

I am trying to combine two of the demos into one application and I am running into trouble.  I am doing the same thing as the RadGrid Hierarchy with Templates.  When an item in the grid is selected and it loads the nesteditem, I want to load my tabs and pageviews dynamically with user controls as in the TabStrip / Load on Demand RadPageView demo. I am having a coupld of problems with this:

1. How can I add the tabs only to the item that is being selected from the grid?  I have tried calling the addtab function from the ItemCreated and ItemDataBound methods of the RadGrid but of course it creates the tabs for every item (and also the pageview for the first tab) and I get the "multiple controls with the same ID" error.  If I try to call the addtab from the ItemCommand method of the RadGrid, it works the first time through but as soon as I try to collapse the current item it throws the same error.

2. When the PageViewCreated method fires and loads the user control onto the page, I need to be able to set a public property of that user control.  As it relates to the Telerik expample, I would need to be able to get the EmployeeID from the grid and assign it to the control (as the control needs that ID to load its data).  At the point where the pageview is being created, I can't figure out how to find the EmployeeID for that particular grid item.  I have tried using the DataKeyValues but I can't figure out how to get the index of the particular item that is selected on the grid as it is not being passed to the RadMultiPage controls PageViewCreated method.

Here is my aspx code:

    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="RadGrid1">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
            <telerik:AjaxSetting AjaxControlID="RadTabStrip1">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadTabStrip1" /> 
                    <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
            <telerik:AjaxSetting AjaxControlID="RadMultiPage1">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting>              
        </AjaxSettings> 
    </telerik:RadAjaxManager> 
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />         
      
    <script type="text/javascript">    
    function onTabSelecting(sender, args) {  
        if (args.get_tab().get_pageViewID()) {  
            args.get_tab().set_postBack(false);  
        }  
    }          
    </script>      
 
    <h4>Attendee List</h4>   
         
    <asp:ObjectDataSource ID="odsAttendeeList" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="dsAttendeeList" TypeName="WorkshopsLibrary.CAttendees">  
        <SelectParameters> 
            <asp:SessionParameter Name="sUserID" SessionField="UserID" Type="String" /> 
            <asp:SessionParameter Name="sWorkshopID" SessionField="AdminWorkshopID" Type="String" /> 
        </SelectParameters> 
    </asp:ObjectDataSource> 
      
    <telerik:RadGrid ID="RadGrid1" DataSourceID="odsAttendeeList" runat="server" AutoGenerateColumns="False" AllowSorting="True" AllowMultiRowSelection="False" AllowPaging="True" PageSize="5" GridLines="None" ShowGroupPanel="true" OnPreRender="RadGrid1_PreRender">  
        <PagerStyle Mode="NumericPages" /> 
        <MasterTableView DataSourceID="odsAttendeeList" DataKeyNames="RegistrationID" AllowMultiColumnSorting="True" GroupLoadMode="Server">  
            <NestedViewTemplate> 
                <asp:Panel runat="server" ID="InnerContainer" CssClass="viewWrap" Visible="false">  
                    <telerik:RadTabStrip ID="RadTabStrip1" SelectedIndex="0" CssClass="tabStrip" runat="server" MultiPageID="RadMultiPage1" Orientation="HorizontalTop" OnClientTabSelecting="onTabSelecting" OnTabClick="RadTabStrip1_TabClick" /> 
                    <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0" CssClass="multiPage" OnPageViewCreated="RadMultiPage1_PageViewCreated" /> 
                </asp:Panel> 
            </NestedViewTemplate>                      
            <Columns> 
                <telerik:GridBoundColumn SortExpression="RegistrationID" HeaderText="RegistrationID" HeaderButtonType="TextButton" DataField="RegistrationID" UniqueName="RegistrationID" /> 
                <telerik:GridBoundColumn SortExpression="FirstName" HeaderText="First Name" HeaderButtonType="TextButton" DataField="FirstName" UniqueName="FirstName" /> 
                <telerik:GridBoundColumn SortExpression="LastName" HeaderText="Last Name" HeaderButtonType="TextButton" DataField="LastName" UniqueName="LastName" /> 
                <telerik:GridBoundColumn SortExpression="Citizenship" HeaderText="Citizenship" HeaderButtonType="TextButton" DataField="Citizenship" UniqueName="Citizenship" /> 
                <telerik:GridBoundColumn SortExpression="Phone" HeaderText="Phone" HeaderButtonType="TextButton" DataField="Phone" UniqueName="Phone" /> 
                <telerik:GridBoundColumn SortExpression="Email" HeaderText="Email" HeaderButtonType="TextButton" DataField="Email" UniqueName="Email" /> 
                <telerik:GridBoundColumn SortExpression="Cancelled" HeaderText="Cancelled" HeaderButtonType="TextButton" DataField="Cancelled" UniqueName="Cancelled" /> 
                <telerik:GridBoundColumn SortExpression="Accepted" HeaderText="Accepted" HeaderButtonType="TextButton" DataField="Accepted" UniqueName="Accepted" />                                                                  
            </Columns> 
        </MasterTableView> 
        <ClientSettings AllowDragToGroup="true" /> 
    </telerik:RadGrid> 

And here is my codebehind:

    Protected WithEvents RadTabStrip1 As RadTabStrip  
    Protected WithEvents RadMultiPage1 As RadMultiPage  
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load  
 
        Dim cPageRoutines As New CPageRoutines  
        Dim cWorkshops As New CWorkshops  
 
        If HttpContext.Current.Session("UserID") Is Nothing Then  
            cPageRoutines.Login(User)  
        End If  
        cPageRoutines.VerifyRole("SystemAdministrator")  
        cPageRoutines.VerifyAdminWorkshop("AdminWorkshopID")  
 
    End Sub  
 
    Private Sub AddPageView(ByVal tab As RadTab)  
 
        For Each nestedItem As GridNestedViewItem In RadGrid1.MasterTableView.GetItems(GridItemType.NestedView)  
            Dim RadMultiPage1 As RadMultiPage = DirectCast(nestedItem.FindControl("RadMultiPage1"), RadMultiPage)  
            Dim pageView As RadPageView = New RadPageView  
            pageView.ID = tab.Text.Replace(" ", "")  
            RadMultiPage1.PageViews.Add(pageView)  
            pageView.CssClass = "pageView" 
            tab.PageViewID = pageView.ID  
        Next  
 
    End Sub  
 
    Private Sub AddTab(ByVal tabName As String)  
 
        For Each nestedItem As GridNestedViewItem In RadGrid1.MasterTableView.GetItems(GridItemType.NestedView)  
            Dim RadTabStrip1 As RadTabStrip = DirectCast(nestedItem.FindControl("RadTabStrip1"), RadTabStrip)  
            Dim tab As RadTab = New RadTab  
            tab.Text = tabName 
            RadTabStrip1.Tabs.Add(tab)  
        Next  
 
    End Sub  
 
    Protected Sub RadGrid1_PreRender(ByVal sender As Object, ByVal e As EventArgs) Handles RadGrid1.PreRender  
 
        If Not Page.IsPostBack Then  
            RadGrid1.MasterTableView.Items(0).Expanded = False 
            RadGrid1.MasterTableView.Items(0).ChildItem.FindControl("InnerContainer").Visible = True 
        End If  
 
    End Sub  
 
    Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As GridCommandEventArgs) Handles RadGrid1.ItemCommand  
 
        If e.CommandName = RadGrid.ExpandCollapseCommandName Then  
            DirectCast(e.Item, GridDataItem).ChildItem.FindControl("InnerContainer").Visible = Not e.Item.Expanded  
        End If  
 
    End Sub  
 
    Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As GridItemEventArgs) Handles RadGrid1.ItemCreated  
 
        If TypeOf e.Item Is GridNestedViewItem Then  
            e.Item.FindControl("InnerContainer").Visible = (DirectCast(e.Item, GridNestedViewItem)).ParentItem.Expanded  
 
            Dim nestedItem As GridNestedViewItem = DirectCast(e.Item, GridNestedViewItem)  
            Dim RadTabStrip1 As RadTabStrip = DirectCast(nestedItem.FindControl("RadTabStrip1"), RadTabStrip)  
            AddTab("Attendee")  
            AddPageView(RadTabStrip1.FindTabByText("Attendee"))  
            AddTab("Additional Questions")  
            Dim cCustomFields As New CCustomFields  
            Dim dt As DataTable = cCustomFields.dsCustomFieldList(HttpContext.Current.Session("UserID").ToString, HttpContext.Current.Session("AdminWorkshopID").ToString).Tables(0)  
            If dt.Rows.Count > 0 Then  
                AddTab("Additional Questions")  
            End If  
            AddTab("Orders")  
            AddTab("Payments")  
        End If  
 
    End Sub  
 
    Protected Sub RadMultiPage1_PageViewCreated(ByVal sender As Object, ByVal e As RadMultiPageEventArgs) Handles RadMultiPage1.PageViewCreated  
 
        Dim userControlName As String = e.PageView.ID & ".ascx"  
        Dim userControl As Control = Page.LoadControl(userControlName)  
        userControl.ID = e.PageView.ID & "_userControl"  
        userControl.GetType().GetProperty("RegistrationID").SetValue(userControl, RadGrid1.MasterTableView.DataKeyValues(??)("RegistrationID").ToString, Nothing)  
        e.PageView.Controls.Add(userControl)  
 
    End Sub  
 
    Protected Sub RadTabStrip1_TabClick(ByVal sender As Object, ByVal e As RadTabStripEventArgs) Handles RadTabStrip1.TabClick  
 
        AddPageView(e.Tab)  
        e.Tab.PageView.Selected = True 
 
    End Sub 
Tsvetoslav
Telerik team
 answered on 24 Feb 2012
2 answers
68 views
Hi,

I am not able to set the collapse value when i am reading from table. I can save the collapse value. plz help me out for this issue. i tried manually but not working. in table i am storing only dock id,dockname,collapse value and zone id.my codes are below: 

   Protected Sub RadDockLayout1_LoadDockLayout(ByVal sender As Object, ByVal e As DockLayoutEventArgs) Handles RDLOccurrence.LoadDockLayout
        If Not Page.IsPostBack Then
            Dim stateList1 As List(Of Widget) = Me.Presenter.GetWidgetInfo() ' getting all values from table
            For Each state1 As Widget In stateList1
                 Dim state As New DockState
                e.Positions(state.UniqueName) = zoneid & zone
                e.Indices(state.UniqueName) = 0
            Next
        End If
    End Sub

Here stateList1 or state1 contains the widgetid,widgetname,zoneid and collapse value. state have only 2 properties e.Position and e.Indices, here no any properties who can handle the collapse value and same it can display.

Please provide the solution.
Rajesh
Top achievements
Rank 1
 answered on 24 Feb 2012
1 answer
77 views
hi in my web page
the RadGrid updated by RadTreeview
and RadTreeView updated By RadGrid
RadGrid updated by itself
when i add Ajaxifing for Linkbutton inside Template Column for a Panel
i getting the followinf error msg
Microsoft JScript runtime error: Sys.InvalidOperationException: Could not find UpdatePanel with ID 'ctl00_ContentPlaceHolder1_ctl00_ContentPlaceHolder1_PanelViewerPagePanel'. If it is being updated dynamically then it must be inside another UpdatePanel.
i add new linkbutton outside of RadGrid for testing
i add ajaxifing for the outside link button for the same panel at runtime
the panel updated without the above error msg
so the pbm is not the Panel the pbm is Linkbutton inside RadGrid
how to solve this pbm
Johnny
Top achievements
Rank 2
 answered on 24 Feb 2012
1 answer
71 views
hi i set visible and hide the controls in the Javascript depend on hidden filed value
i call this function from AjaxManager OnRequestEnd working fine
in the RadWindow close time i postback the page by
form1.submit()
the form is postback and the event is called but the visibles not happening
how to solve this problem

Johnny
Top achievements
Rank 2
 answered on 24 Feb 2012
5 answers
245 views
Hello.

I am trying to set up the grid default filter, but i cannot. Your example is wrong.

Why?

I am binding the grid using the NeedDataSource in the same way as you are writing in Advanced Data-binding (using NeedDataSourceEvent).

I can read:

If you are binding the grid using the NeedDataSource event, you can set the initial filter in the NeedDataSource event handler and omit the call to the Rebind method. The code for setting the filter must still be placed inside an if statement that checks that Page.IsPostBack is False.

No, It cannot be done.

Reason?

Grid has no columns at this time. RadGrid1.MasterTableView.GetColumnSafe("") always returns null. (although datasource has already be assigned).

I also don't need to call  RadGrid1.MasterTableView.FilterExpression = "SQL expression" because my data has been already filtered. I am using SQL SERVER power to do that and I think that everybody must prefer server technology for this type of task.

So I must use PreRender event, but:

(!)

I must call this.RadGrid1.Rebind(); If I don't, the filter function is preselected, but filter value TextBox is empty !!!!

What does Rebind do really? MY grid has thousands of rows. Is it really needed to call rebind because of one value needs to be inserted in a TextBox? The filter function is preselected, so why TextBox is empty?

Thank you very much.

Tom


OfficeBooks Team
Top achievements
Rank 1
 answered on 24 Feb 2012
2 answers
400 views
Hi there,

Now i'm not sure if there's a solution for this particular problem.

Scenario; Client has a site(a) in which they want to embed sections from the site i'm developing, site(b).
To enable them to do so i'm providing them with some iframe markup to put into their CMS.

The problem being, that some of the pages they're embedding have radwindows in, and these RadWindows are wider than the size of the iframe the page is contained within.

Try try and resolve this i made the iframe larger than the actual content, and overlay some of their content on site(a), using a transparent background on the iframe. This allowed my RadWindow sufficient space.

However, what i had overlooked is if there's any content underneath the iframe, such as links etc, they're no longer accessible because the iframe is above them .

So i guess my question would be; is there a solution for this ? I guess what i need is the RadWindow to open independantly so its not restricted by the size of the iframe it's in. However, i also need it to be able to interact with the page at which it is called from (i use the closeandrebind event for radgrid/window).

Any suggestions welcome,

Alan
Alan T
Top achievements
Rank 1
 answered on 23 Feb 2012
12 answers
462 views

Is it possible to allow end user to upload multiple images using AsyncUploaded to the temporyfolder and display those temporary file images via RadBinaryImage (IE in a repeater or listview etc) allowing user to preview those images before submitting the images to the filesystem or database.

Note that the end user might upload one image at a time or mutiple images at once to the form and even remove images before finally hitting the submit button to move the previewed uploaded files from the temporary location to the filesystem or database.

If so how and is there an example somewhere?

Thanks

Glenn
Top achievements
Rank 1
 answered on 23 Feb 2012
1 answer
158 views
I have a radgrid that I need to be about 40 px wide. Is there anyway to change the width of the filter textbox? It's too big and pushes the filter button out anyways. See my attachment for a better explanation.
Casey
Top achievements
Rank 1
 answered on 23 Feb 2012
4 answers
376 views
I need to get the number of items being filtered in the drop down? Is this possible?

Duncan
Duncan
Top achievements
Rank 2
 answered on 23 Feb 2012
1 answer
60 views
I have a simple radgrid that is attached to a SQL database table whose scheme I am not able to alter. There are a number of fields that do not allow NULLS in the database but for my purposes I can allow NULLS for certain fields.
My question is, what is the best way to handle this? there are probably a dozen fields in this grid and the majority are simply text boxes. My first thought was that when the update command is fired to loop through all of the controls to check if they are NULL and if they are to simply make them pass a space. My problem is I am not sure how to do this easily. 
Can anyone think of a better way to do this? 
Thank you 
Adam 
Elliott
Top achievements
Rank 2
 answered on 23 Feb 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?