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

Hi There,
I have seen this topic come up before but without an answer so I thought I'd define the problem as simply  as possible.

I have a LINQ command creating a query:

var gridData =     from au in dc.aspnet_Users 
                            join aur in dc.aspnet_UsersInRoles  
                            on au.UserId equals aur.UserId 
                            join ar in dc.aspnet_Roles  
                            on aur.RoleId equals ar.RoleId 
                            join am in dc.aspnet_Memberships  
                            on au.UserId equals am.UserId 
                   select new 
                   { 
                            au.UserName, 
                            ar.RoleName, 
                            am.Email, 
                            am.IsApproved, 
                            am.IsLockedOut 
                   }; 
 


THE IMPORTANT POINT IS THAT THIS USES MORE THAN 1 TABLE.


Note: This is accessing the Roles and Users tables in the standard MS Login scenario.


Then I have a simple RadGrid:

<telerik:RadGrid ID="rgUsers" runat="server" AllowAutomaticDeletes="True" 
        AllowAutomaticUpdates="True" AutoGenerateDeleteColumn="True" 
        AutoGenerateEditColumn="True" GridLines="None"
 
    <MasterTableView EditMode="InPlace"
       <RowIndicatorColumn> 
             <HeaderStyle Width="20px"></HeaderStyle> 
       </RowIndicatorColumn> 
       <ExpandCollapseColumn> 
             <HeaderStyle Width="20px"></HeaderStyle> 
       </ExpandCollapseColumn> 
    </MasterTableView> 
 
</telerik:RadGrid> 


Finally I bind the data to the grid in Page_Load

rgUsers.AutoGenerateColumns = true
rgUsers.DataSource = gridData.ToList(); 
rgUsers.DataBind(); 
 

 

This will display the data from the 4 tables correctly. 

However, when Edit is pressed on the Grid the fields are not editable.


I have tried the following:

1) 1) I can use a LinqDataSource that allows Edit/Update BUT only if there is only 1 table in the LINQ query.

2)  2) I can use a ObjectDataSource onto a dataset but once again this only works if the the dataset adaptor is accessing a single table.


I have looked at the variouse suggested demos and example code but they have all ignored the multiple table/Join problem:

http://www.telerik.com/community/code-library/aspnet-ajax/grid/automatic-operations-with-linqdatasource.aspx

http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/threelevel/defaultcs.aspx

http://www.telerik.com/community/code-library/aspnet-ajax/grid/automatic-operations-with-linqdatasource.aspx

 

I am not wedded to LINQ.  I am quite happy to adapt in order to get a RadGrid that can support Update and Edit to multiple tables.


What should I do to achieve a grid that displays records composed from multiple tables with Update and Edit available?

Thanks for any help

Richard

Richard Byrne
Top achievements
Rank 1
 answered on 04 Mar 2010
2 answers
154 views
In my grid, there are two different columns for edit and delete a record.
And I am opening a popup while editing or inserting a new record.
Now, I need to display the edit and delete buttons at the top like the "Add new" button.

I came across this sample, http://demos.telerik.com/aspnet-ajax/toolbar/examples/applicationscenarios/gridcommanditem/defaultcs.aspx, in which, radtoolbar has been used. But here it is not clear how can I open a popup on edit.
Right now i have one image button and on _ItemDataBound, adding an "onclick" attribute to open popup.
I need to get DataKeyNames for selected row while opening popup.

Is there any direct way to open popup, by, edit button on top ?
Marcus
Top achievements
Rank 1
 answered on 04 Mar 2010
16 answers
400 views
I've searched all over for the solution to my problem but haven't been able to find it so I figure I must be overlooking something really simple ;-)

I've got a simple page containing one LinkButton and a RadToolTipManager (used instead of RadToolTip because in the real app there's multiple tooltips loaded on demand). The LinkButton triggers the ToolTip.

The tooltip contains a simple usercontrol, containing only one button. So far so good, tooltip opens just fine.

There is a client-script inside the usercontrol (OnClientClick for Button-control). The problem is that a javascript-error appears instead of the desired client-side behavior:

'ClientClick' is undefined.

ClientClick is defined in the user control, not in the parent page. How can I use client-scripting in usercontrols inside tooltip-templates?

Could you please point me in the right direction?

Kind regards, Martine.

ASPX:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> 
 
<%@ Register Assembly="Telerik.Web.UI, Version=2008.2.826.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4" 
    Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<%@ Register Src="WebUserControl.ascx" TagName="WebUserControl" TagPrefix="uc1" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml">  
<head runat="server">  
    <title>Untitled Page</title> 
</head> 
<body> 
    <form id="form1" runat="server">  
        <telerik:RadScriptManager ID="ScriptManager1" runat="server" EnableTheming="True">  
        </telerik:RadScriptManager> 
        <br /> 
        <div> 
            <asp:LinkButton ID="LinkButton1" runat="server">Show ToolTip</asp:LinkButton><br /> 
            <telerik:RadToolTipManager ID="RadToolTipManager1" runat="server" ManualClose="True" 
                Modal="True" OnAjaxUpdate="RadToolTipManager1_AjaxUpdate">  
                <TargetControls> 
                    <telerik:ToolTipTargetControl IsClientID="False" TargetControlID="LinkButton1" Value="" /> 
                </TargetControls> 
            </telerik:RadToolTipManager> 
            &nbsp;</div> 
    </form> 
</body> 
</html> 
 

.cs:

using System;  
using System.Data;  
using System.Configuration;  
using System.Web;  
using System.Web.Security;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using System.Web.UI.WebControls.WebParts;  
using System.Web.UI.HtmlControls;  
 
public partial class _Default : System.Web.UI.Page   
{  
    protected void Page_Load(object sender, EventArgs e)  
    {  
 
    }  
    protected void RadToolTipManager1_AjaxUpdate(object sender, Telerik.Web.UI.ToolTipUpdateEventArgs e)  
    {  
        WebUserControl UC = (WebUserControl)Page.LoadControl("WebUserControl.ascx");  
        e.UpdatePanel.ContentTemplateContainer.Controls.Add(UC);  
    }  

ASCX:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="WebUserControl" %> 
<%@ Register Assembly="Telerik.Web.UI, Version=2008.2.826.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4" 
    Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<asp:Button ID="Button1" runat="server" OnClientClick="ClientClick" Text="Button in UserControl" /> 
<script language="javascript" type="text/javascript">  
    function ClientClick(sender, args)   
    {  
        Alert('Clicked!');  
    }  
</script> 
 
 
Svetlina Anati
Telerik team
 answered on 04 Mar 2010
3 answers
268 views
Hello all,
I have a general question about button style navigation in RadRotator. 
I've implemented paging in my solution and my default setting is to display 10 items per page. Whether it is in horizontal or vertical display mode, once I get to item 10 (index of 9) and click 'Next/Forward', the RadRotator will move back to it Item 1 (index of 0)  - It is after all a rotator/carousel!
Is there any way to achieve (either in the RadControl properties or Code-behind) it such that once you get to the last item you can't move back to Item 1 as it were. Either being able to detect you are on the last item and disable the 'Next/Forward' button (would be ideal) or at least not do any action if the button is clicked.
Look forward to any responses/suggestions.
Regards,
Praveen.
Fiko
Telerik team
 answered on 04 Mar 2010
1 answer
103 views
When I create a tab like so:

<

 

telerik:RadTab Text="Another Tab" AccessKey="3"> </telerik:RadTab>

 

 

 

 

 



It adds a 3 (bolded and underlined) before the "Another Tab" text. What I would like to do is control the style of the "3."

I looked at the style sheets and it looks like it is adding the style inline. Is there any way to override this behavior?

I can control the style when the AccessKey is _part_ of the Text.

Thanks,
David




Yana
Telerik team
 answered on 04 Mar 2010
3 answers
118 views
I have an application that opens to a screen with a radtabstrip.  The tabstrip has 3 tabs.  The first is loaded when the page is loaded.  The second and third tabs have grids displayed in their associated pageviews.  What I would like to do is to make the grids not visible when the page loads, but have them load and display when the user clicks on the tab.  The idea is to save the resources of loading the grids until the user actually wants to see them.

I tried setting Visible = false on both grids, then I have this for my AjaxManager (I'm actually using a AjaxManagerProxy because I have a RadAjaxManager on my master page):

<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">  
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="gridCMs">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="gridCMs" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                    <telerik:AjaxUpdatedControl ControlID="RadToolTipManager1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
            <telerik:AjaxSetting AjaxControlID="gridInOpEquip">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="gridInOpEquip" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                    <telerik:AjaxUpdatedControl ControlID="RadToolTipManager1" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
            <telerik:AjaxSetting AjaxControlID="tabMain">  
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="gridCMs" LoadingPanelID="RadAjaxLoadingPanel1" /> 
                    <telerik:AjaxUpdatedControl ControlID="gridInOpEquip" /> 
                </UpdatedControls> 
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManagerProxy> 

where tabMain is my tabstrip and gridCMs is the grid that should appear on the second tab while gridInOpEquip would show on the third tab.  Then I added this code to handle the tab_click:
Protected Sub tabMain_TabClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadTabStripEventArgs) Handles tabMain.TabClick  
        Select Case e.Tab.Value  
            Case "OpenCMs"  
                If gridCMs.Visible = False Then  
                    gridCMs.Visible = True 
                    gridCMs.DataBind()  
                End If  
            Case "InOpEquip"  
                If gridInOpEquip.Visible = False Then  
                    gridInOpEquip.Visible = True 
                    gridInOpEquip.DataBind()  
                End If  
        End Select  
    End Sub 

Yes, I did try just making it visible without the call to DataBind.  When I have this code enabled, the code executes but the tab is no longer selected, so I can't even see the selected pageview.  If I comment out this code, and change the grids from Visible=false to Visible=true, it works just fine...except that I don't have the delayed loading of the grids.

I look forward to any tips that you can provide.  Many thanks!


x
Pavlina
Telerik team
 answered on 04 Mar 2010
5 answers
342 views
I have been working on a RadGrid implementation where I am using a GridAttachmentColumn. For some reason every time I try to upload a .pdf file it ends up in the invalid files collection of the RadUpload control. I have tried adding .pdf to the allowed file extensions and application/pdf to the allowed mime types, and neither seems to be working.

I have not had any trouble uploading various image formats(.png,.jpg.gif) or text files(.txt,.doc). Is there a reason that pdfs are different?

FYI I am not actually inserting the blob into the database. I am intercepting the insert and update events and saving the file to the server. I have also tried using a GridTemplateColumn but I wasn't able to get the RadUpload control to work inside the template.

Here is some of the code from my insert method...
//Cast EditableItem 
GridEditableItem editedItem = e.Item as GridEditableItem; 
 
//Get the ColumnEditor for the FileColumn 
//Get the RadUpload from the ColumnEditor 
GridAttachmentColumnEditor editor = GridAttachmentColumnEditor)editedItem.EditManager.GetColumnEditor("FileColumn"); 
RadUpload upload = (RadUpload)editor.RadUploadControl; 
                 
//If file invalid, Throw an error 
if (upload.UploadedFiles.Count == 0 && upload.InvalidFiles.Count > 0) 
   { 
        throw new Exception("Invalid File Type."); 
   } 
//If no file found, Throw an error 
else if (upload.UploadedFiles.Count == 0 && upload.InvalidFiles.Count == 0)  
   { 
        throw new Exception("No file to Upload."); 
   } 

Everything I have tried always throws the Invalid File Type exception if I try to upload a pdf.

If anyone can help me out it would be appreciated.
Paul
Top achievements
Rank 1
 answered on 04 Mar 2010
1 answer
131 views
Hi,

In my grid I have set ShowGroupPanel to true and under ClientSetting AllowDragToGroup is also set to true. In my grid I have simple templete which contains Hyperlink. I want to disable AllowDragToGroup for this column. Is that possible?

Thanks
MP
Princy
Top achievements
Rank 2
 answered on 04 Mar 2010
1 answer
116 views
Hi,

I placed a RadToolBar in a GridTemplateColumn, the RadGrid is ajaxfied and is placed at UserControl. The RadToolBar contains SplitButtons with child ToolBarbuttons. Each RadToolBarButton has a design-time setting of ImageUrl.

The problem I have is...When browsing the page, images are not diplayed, but when the mouse is over the toolbar control, the image is refreshed and displayed.

BTW: The usercontrol is placed in a "sub" web application while the images are placed (shared) in "parent" web application. I don't thing that this is the reason, since other images are displayed correctlly at grid CommandTemplate.

Any idea how resolve this issue?

Avidan
T. Tsonev
Telerik team
 answered on 04 Mar 2010
2 answers
146 views
Hi all

I'm using Rad grid 2.0.

I have a couple of issues needing attention. They are the following:

1)  I am unable to do a multi group with different columns. Each time I try it overwrites the current grouping.

2) I am able to group on a column and it refreshes quickly. But when trying to ungroup, the grid "freezes" and only shows "refreshing..." at the bottom of the grid while doing nothing.

Please advice

Thank you
Yavor
Telerik team
 answered on 04 Mar 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?