Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
112 views
Hello,

I'm currently attempting to retrieve the value of a selection from a dropdown in the edit pop-up. I have been able to retrieve the values entered in a textbox and checkbox as follows:

string ProjectName = (editedItem["ProjectName"].Controls[0] as TextBox).Text;
bool IsActive = (editedItem["IsActive"].Controls[0] as CheckBox).Checked;

When I try to do so with similarly with my dropdown (shown below) I'm getting an error saying the value is null.

(editedItem["ddlContactName"].Controls[0] as DropDownList).SelectedItem.Value;

Is a different approach needed to retrieve values from dropdown cloumns?
Thanks in advance.
Matt
Top achievements
Rank 1
 answered on 17 Nov 2008
2 answers
137 views
Hi guys,

I need to sort my RadGrid by the selected value in the DropDown list. The problem (not counting the fact that i am an absolute newbie in the asp.net/c#/Telerik world and the whole code is the legacy redirected to me from someone who worked on it before me) is that the values which fill the dropdown are not selected from the DataBase, they are dynamically generated in the codebehind... Oh, well, what am I talking about... here is the part of the code with the DropDownList:

<telerik:RadGrid ID="RadGrid1" runat="server" Width="100%" AllowSorting="true" AllowMultiRowSelection="True" 
            AllowPaging="true" PageSize="5" Skin="Telerik" OnItemDataBound="RadGrid1_ItemDataBound" 
            OnNeedDataSource="RadGrid1_NeedDataSource" 
            OnItemCreated="RadGrid1_ItemCreated" onitemcommand="RadGrid1_ItemCommand"
<MasterTableView AutoGenerateColumns="False" CommandItemDisplay="Bottom" AllowSorting="true"
<telerik:GridTemplateColumn HeaderText="Role" UniqueName="Role"
                        <ItemTemplate> 
                            <asp:DropDownList ID="ddl_Roles" CssClass="roles_list" runat="server"
                                <asp:ListItem Text="User" Value="User"></asp:ListItem> 
                                <asp:ListItem Text="Observer" Value="Observer" Enabled="false"></asp:ListItem> 
                                <asp:ListItem Text="Editor" Value="Editor" Enabled="false"></asp:ListItem> 
                                <asp:ListItem Text="Manager" Value="Manager" Enabled="false"></asp:ListItem> 
                                <asp:ListItem Text="Admin" Value="Admin"></asp:ListItem> 
                            </asp:DropDownList> 
                            <div class="button"
                            <asp:Button ID="ChangeRoleButton" CssClass="roles_change" runat="server" OnClientClick="return confirm('Are you sure you want to change this users role?');" CommandName="SaveRole" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "ID") %>' Text="Save Role" /> 
                            </div> 
                        </ItemTemplate> 
</telerik:GridTemplateColumn> 


and in the codebehind, here is how it is generated:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    { 
        
        if (e.Item is GridDataItem) 
        { 
 
            GridDataItem item = (GridDataItem)e.Item; 
 
            //Access the GridDataItem using the ColumnUniqueName 
            string UserName = item["UserName"].Text; 
            string businessShortName = item["SBN"].Text; 
 
            DropDownList roleListing = (DropDownList)item["Role"].Controls[1]; 
 
            if (Roles.IsUserInRole(UserName, businessShortName + "_admin")) 
            { 
                item["UserName"].Text = roleListing.SelectedValue = "Admin"
            } 
            else if (Roles.IsUserInRole(UserName, businessShortName + "_manager")) 
            { 
                item["UserName"].Text = roleListing.SelectedValue = "Manager"
            } 
            else if (Roles.IsUserInRole(UserName, businessShortName + "_editor")) 
            { 
                item["UserName"].Text = roleListing.SelectedValue = "Editor"
            } 
            else if (Roles.IsUserInRole(UserName, businessShortName + "_observer")) 
            { 
                item["UserName"].Text = roleListing.SelectedValue = "Observer"
            } 
            else 
            { 
                item["UserName"].Text = roleListing.SelectedValue = "User"
            } 




any ideas how to do it? Google search and specific search through Telerik forums didn't help me...
Seidhkona
Top achievements
Rank 1
 answered on 17 Nov 2008
3 answers
135 views
Hi telerik team
I use the last build (evaluate version) of your controls. I want to develop a page to implement a Outlook navigation, based on your on line example. But I want also dock the panel bar at the bottom of my page, showing the maximum number of PanelBarItem in the available space (I using a RadSplitter too). Of course, if all panelbaritem are showed, the PanelBar must be docked on the bottom of the page.
To supply this functionality, I think that a good approach could be calculate the height of PanelBar in term of PanelBarItem elements, something of this:
(number of PanelBarItem) * (height of each PanelBarItem) = total space of PanelBar
Which is the height of each PanelBarItem? And what is the best approach to supply this information?
Thanks in advance
nadiagi
Atanas Korchev
Telerik team
 answered on 17 Nov 2008
1 answer
112 views
I have a requirement where i need to add a radupload control dynamically to page :-

RadUpload

upload = new RadUpload();
.
. set all properties here.
.
Then add it to the control collection of a parent container say Table.
 
Naturally the the control does not exist on the server side.
How do i get the uploaded files collection at the server end?
Or is there any work around for getting the files uploaded?

Pls advice, its urgent.

 

Atanas Korchev
Telerik team
 answered on 17 Nov 2008
1 answer
97 views
i hope to get a answer ASAP
i have a RadScript Manager on my master page, on my content pages controls i drop, show me this error
though when the pages are loaded every thing seems fine.

i made most of the pages initially without master page so had Script manager on each page -- i had to take them off as i already have it on master page.. can this problem be solved
plus can i use ScriptManagerProxy that comes with MS Ajax tools. 
Maria Ilieva
Telerik team
 answered on 17 Nov 2008
1 answer
294 views
Hi

I'd like to use the following sample radupload:
http://demos.telerik.com/aspnet/prometheus/Controls/Examples/Integration/RadUploadInAjaxifiedGrid/DefaultCS.aspx?product=upload

But some errors are occurring in the compilation:

Error    1    Brand server unknown: 'sds:SessionDataSource'.    C:\Inetpub\wwwroot\upvb\Default.aspx    103   
Error    3    Element 'SessionDataSource' is not a known element. This can occur if there is a compilation error in the Web site.    C:\Inetpub\wwwroot\upvb\Default.aspx    103    14    C:\...\upvb\
Error    4    Validation (XHTML 1.0 Transitional): Element 'insertparameters' is not supported.    C:\Inetpub\wwwroot\upvb\Default.aspx    108    14    C:\...\upvb\
Error    5    Element 'Parameter' is not a known element. This can occur if there is a compilation error in the Web site.    C:\Inetpub\wwwroot\upvb\Default.aspx    109    22    C:\...\upvb\
Error    7    Element 'SessionParameter' is not a known element. This can occur if there is a compilation error in the Web site.    C:\Inetpub\wwwroot\upvb\Default.aspx    111    22    C:\...\upvb\
Error    8    Validation (XHTML 1.0 Transitional): Element 'updateparameters' is not supported.    C:\Inetpub\wwwroot\upvb\Default.aspx    113    14    C:\...\upvb\
Error    13    Validation (XHTML 1.0 Transitional): Element 'deleteparameters' is not supported.    C:\Inetpub\wwwroot\upvb\Default.aspx    119    14    C:\...\upvb\



Default.aspx

<%@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Register TagPrefix="sds" Namespace="Telerik.Web.SessionDS" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd">
<html xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Test</title>
    
</head>
<body class="BODY">
    <form runat="server" id="mainForm" method="post" style="width: 100%">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        
        <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">

            <script type="text/javascript">
                    //On insert and update buttons click temporarily disables ajax to perform upload actions
                    function conditionalPostback(e, sender)
                    {
                        var theRegexp = new RegExp("\.UpdateButton$|\.PerformInsertButton$", "ig");
         if (sender.EventTarget.match(theRegexp))
         {
         var upload = $find(window['UploadId']);
                    
         //AJAX is disabled only if file is selected for upload
         if(upload.getFileInputs()[0].value != "")
         {
         sender.EnableAjax = false;
         }
         }
                    }
            </script>

        </telerik:RadScriptBlock>
        <asp:HiddenField ID="ComboValue" runat="server" />
        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" ClientEvents-OnRequestStart="conditionalPostback">
            <telerik:RadProgressManager ID="RadProgressManager1" runat="server" />
            <telerik:RadGrid runat="server" ID="RadGrid1" AllowPaging="True" AllowSorting="True"
                AutoGenerateColumns="False" Width="97%" DataSourceID="SqlDataSource1" AllowAutomaticInserts="true"
                AllowAutomaticUpdates="true" AllowAutomaticDeletes="true" OnUpdateCommand="RadGrid1_UpdateCommand"
                OnInsertCommand="RadGrid1_InsertCommand" Skin="Web20" OnItemDataBound="RadGrid1_ItemDataBound"
                ShowStatusBar="True" GridLines="None">
                <PagerStyle Mode="NextPrevAndNumeric" />
                <MasterTableView Width="100%" CommandItemDisplay="Top" DataKeyNames="ID" DataSourceID="SqlDataSource1">
                    <Columns>
                        <telerik:GridEditCommandColumn>
                        </telerik:GridEditCommandColumn>
                        <telerik:GridTemplateColumn HeaderText="Image Name" UniqueName="ImageName" SortExpression="Name">
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lblName" Text='<%# Eval("Name") %>' />
                            </ItemTemplate>
                            <EditItemTemplate>
<asp:TextBox runat="server" Style="width: 205px; margin-left: 3px;" ID="txbName"
Text='<%# Bind("Name") %>' />
<asp:RequiredFieldValidator ID="Requiredfieldvalidator1" runat="server" ControlToValidate="txbName"
ErrorMessage="Please, enter a name!" Display="Dynamic" SetFocusOnError="true">
                                </asp:RequiredFieldValidator>
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn HeaderText="Description" UniqueName="Description" DataField="Description">
                            <ItemTemplate>
                                <asp:Label ID="lblDescription" runat="server" Text='<%# Eval("Description") %>' />
                            </ItemTemplate>
                            <EditItemTemplate>
<asp:TextBox ID="txbDescription" Style="width: 205px; margin-left: 4px;" runat="server"
TextMode="MultiLine" Text='<%# Bind("Description") %>' />
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn HeaderText="Image" UniqueName="Upload">
                            <ItemTemplate>
                                <a href="ShowImageCS.aspx?id=<%# Eval("ID") %>">
<asp:Image runat="server" ID="ImageThumbnail" AlternateText="Click here to open the real size image"
ImageUrl='<%# "ShowImageCS.aspx?thumbnail=true&ID=" + Eval("ID")%>' Style="border-width: 0px;" />
                                </a>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <telerik:RadUpload ID="RadUpload1" runat="server" InitialFileInputsCount="1" MaxFileInputsCount="1"
                                    ControlObjectsVisibility="None" MaxFileSize="1000000" AllowedFileExtensions=".jpg,.bmp,.gif,.dib,.jpeg,.jpe,.jfif,.png,.tif,.tiff" />
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridButtonColumn HeaderText="Delete" Text="Delete" CommandName="Delete"
                            UniqueName="column">
                        </telerik:GridButtonColumn>
                    </Columns>
                    <EditFormSettings>
                        <EditColumn UniqueName="EditCommandColumn1">
                        </EditColumn>
                    </EditFormSettings>
                    <ExpandCollapseColumn>
                        <HeaderStyle Width="20px" />
                    </ExpandCollapseColumn>
                    <RowIndicatorColumn>
                        <HeaderStyle Width="20px" />
                    </RowIndicatorColumn>
                </MasterTableView>
                <FilterMenu EnableTheming="True" Skin="Web20">
                    <CollapseAnimation Duration="200" Type="OutQuint" />
                </FilterMenu>
            </telerik:RadGrid>
        </telerik:RadAjaxPanel>
        <sds:SessionDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"
            SelectCommand="SELECT * FROM [Images]"
            InsertCommand="INSERT INTO [Images] ([Name], [Description], [Data]) VALUES (@Name, @Description, @Data)"
            UpdateCommand="UPDATE [Images] SET [Name] = @Name, [Description] = @Description, [Data] = @Data WHERE [ID] = @ID"
            DeleteCommand="DELETE FROM [Images] WHERE [ID] = @ID" PrimaryKeyFields="ID" SessionKey="UploadGridCS">
            <InsertParameters>
                <asp:Parameter Name="Name" Type="String" />
                <asp:Parameter Name="Description" Type="String" />
                <asp:SessionParameter SessionField="DataCS" Name="Data" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="Name" Type="String" />
                <asp:Parameter Name="Description" Type="String" />
                <asp:SessionParameter SessionField="DataCS" Name="Data" />
                <asp:Parameter Name="ID" Type="Int32" />
            </UpdateParameters>
            <DeleteParameters>
                <asp:Parameter Name="ID" Type="Int32" />
            </DeleteParameters>
        </sds:SessionDataSource>
        
      
    </form>
</body>
</html>

Default.aspx.vb

Imports System
Imports System.Data
Imports System.Configuration
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Imports System.IO

Imports Telerik.Web.UI
Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub
End Class



Namespace Telerik.Web.Examples.Ajax.Integration.RadUploadInAjaxifiedGrid
    Partial Public Class DefaultVB

        Inherits System.Web.UI.Page
        Dim RadAjaxPanel1 As RadAjaxPanel
        Protected Sub RadGrid1_UpdateCommand(ByVal source As Object, ByVal e As GridCommandEventArgs)
            InitializeUpdateParameter(DirectCast(e.Item.FindControl("RadUpload1"), RadUpload))
        End Sub

        Protected Sub RadGrid1_InsertCommand(ByVal source As Object, ByVal e As GridCommandEventArgs)
            InitializeUpdateParameter(DirectCast(e.Item.FindControl("RadUpload1"), RadUpload))
        End Sub

        Private Sub InitializeUpdateParameter(ByVal currentUpload As RadUpload)
            If currentUpload.UploadedFiles.Count > 0 Then
                Dim data As Byte() = New Byte(currentUpload.UploadedFiles(0).ContentLength) {}
                currentUpload.UploadedFiles(0).InputStream.Read(data, 0, data.Length)
                Session("DataVB") = data
            End If
        End Sub

        Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs)


            If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then

                Dim upload As RadUpload = DirectCast(e.Item.FindControl("RadUpload1"), RadUpload)
                RadAjaxPanel1.ResponseScripts.Add(String.Format("window['UploadId'] = '{0}';", upload.ClientID))
            End If
        End Sub

    End Class
End Namespace







Atanas Korchev
Telerik team
 answered on 17 Nov 2008
1 answer
168 views
Hi,

We're trying to optimize the process in the MOSS datasheet view for SPLists. The problem with MOSS datasheet view is that it does a post-back for any updates, and prompts for a refresh.

Do you have a replacement (feature) for the datasheet view that we can install?

Thank,
Vincent
Nikolay Rusev
Telerik team
 answered on 17 Nov 2008
1 answer
112 views
Hi,

When the user filters the grid in Boosting Performance with LINQ, the number of items in the grid is displayed incorrectly.

This error was present in the previous releases. However, as of version Q3 2008; Autopage="false" declaration in the ASPX file and the e.Arguments.TotalRowCount = 1000000 statement in C# file are not required.

Grid displays the number of items correctly when the data is bound and after the filtering without those statements. Can you please update the demo to reflect the latest changes ?

Thanks,
Oner


Nikolay Rusev
Telerik team
 answered on 17 Nov 2008
1 answer
50 views
Hi,

I want to display a RadToolbar when user click on the command button in RadDock titlebar under the position of the command button.
Please guide that how can I solve that ?

Thanks




Petko
Telerik team
 answered on 17 Nov 2008
1 answer
183 views
Hi

I've a simple RadMenu and as soon as I add

securityTrimmingEnabled

 

="true"

 

 to the web config file, none of the nodes are shown, and no matter what I try with security setting (allow / deny) in bothe the web config and sitemap I cant get them to display.

Andy Ideas / examples.

Andy
Atanas Korchev
Telerik team
 answered on 17 Nov 2008
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?