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

Hello, excuse me for my English I am French ...
I try to call in my code the RadUpload control with ID = radupload1

I tried several methods to find the RadUpload control example:
 

Dim RadUpload1 As RadUpload = CType(MyUserControl.FindControl("RadUpload1"), RadUpload)

 
but I get the error message:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Check the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.


1. here is my code aspx
:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="admin_Default2" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title></title>

</head>

<body>

    <form id="form1" runat="server">

    <div>

    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">

 

<ajaxsettings>

<telerik:AjaxSetting AjaxControlID="RadGrid1">

<updatedcontrols>

<telerik:AjaxUpdatedControl ControlID="RadGrid1" />

 

</updatedcontrols>

</telerik:AjaxSetting>

</ajaxsettings>

 

 

</telerik:RadAjaxManager>

 

        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">

        </telerik:RadScriptManager>

    <telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None" AutoGenerateColumns="false"  DataSourceID="SqlDataSource1" AutoGenerateEditColumn="true" >

 

    <MasterTableView Width="100%" DataKeyNames="idActualite" CommandItemDisplay="Top"

 

        EditMode="PopUp">

 

        <Columns>

 

           <telerik:GridTemplateColumn>

 

                <HeaderTemplate>

 

                    <asp:TextBox ID="txtCodeNumber" runat="server" Width="39px" />

 

                   <asp:LinkButton ID="lnkAddCode" runat="server" Text="Add Bulk Code" OnClick="lnkAddCode_Click" />

 

                </HeaderTemplate>

 

                <ItemTemplate>

 

                    <asp:TextBox ID="TextBox1" runat="server" Text='<%#Bind("titre") %>' Width="39px" />

 

                </ItemTemplate>

                  <EditItemTemplate>

                        

                         <telerik:RadUpload ID="RadUpload1" runat="server"   AllowedFileExtensions=".jpg,.jpeg" Skin="Black"></telerik:RadUpload>

                         <telerik:RadProgressArea ID="RadProgressArea1" runat="server"></telerik:RadProgressArea>

                       

                           

                        </EditItemTemplate>

 

            </telerik:GridTemplateColumn>

 

        </Columns>

 

    </MasterTableView>

 

</telerik:RadGrid>

  <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnGestion %>"

        SelectCommand="SELECT * FROM [actualites] ORDER BY idActualite DESC" InsertCommand="INSERT INTO [actualites] ([titre], [descriptif], [dataImage]) VALUES (@titre, @descriptif, @dataImage) SET @InsertedID = SCOPE_IDENTITY()"

        UpdateCommand="UPDATE [actualites] SET [titre] = @titre, [descriptif] = @descriptif, [dataImage] = @dataImage WHERE [idActualite] = @idActualite"

        DeleteCommand="DELETE FROM [actualites] WHERE [idActualite] = @idActualite"

        >

        <InsertParameters>

            <asp:Parameter Name="titre" Type="String" />

            <asp:Parameter Name="descriptif" Type="String" />

            <asp:Parameter Name="dataImage" DbType="Binary" />

            <asp:Parameter Name="InsertedID" Type="Int32" Direction="Output" />

        </InsertParameters>

        <UpdateParameters>

            <asp:Parameter Name="titre" Type="String" />

            <asp:Parameter Name="descriptif" Type="String" />

            <asp:Parameter Name="idActualite" Type="Int32" />

            <asp:Parameter Name="dataImage" DbType="Binary" />

        </UpdateParameters>

        <DeleteParameters>

            <asp:Parameter Name="idActualite" Type="Int32" />

        </DeleteParameters>

    </asp:SqlDataSource>

     

    </div>

    </form>

</body>

</html>

2. here is my code aspx.vb:

Imports System

Imports System.Drawing

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 System.Collections.Generic

Imports System.Collections

Imports System.ComponentModel

Imports System.Web.SessionState

Imports Telerik.Web.UI

Partial Class admin_Default2

    Inherits System.Web.UI.Page

    Public txtCodeNumber As RadUpload

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

    

    End Sub

    Protected Sub RadGrid1_InsertCommand(sender As Object, e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.InsertCommand

       

        Dim MyUserControl As UserControl = CType(e.Item.FindControl(GridEditFormItem.EditFormUserControlID), UserControl)

        Dim RadUpload1 As RadUpload = CType(MyUserControl.FindControl("RadUpload1"), RadUpload)

    End Sub

End Class

Thanks for your help,

Neri
Top achievements
Rank 1
 answered on 23 Aug 2012
5 answers
194 views
Long story short.  I've got a link button that refreshes the content of a telerik grid.  
I'm using the RadAjaxManager to handle the trigger and update controls.

The linkbutton is the trigger and the radgrid is one of the updated controls.  I'm also using a loading panel to show that an update is in progress.

These grids can have a lot of data and may take a few seconds to refresh.  So if somebody clicks refresh, and before it finishes updating, they click refresh again, the loading panel will display until a hard refresh of the page is done.

How can I avoid this behavior.  

Thanks,
Javier

Edit:  I've learned that this only happens when the LoadingPanel has a mindisplayTime.
Martin
Telerik team
 answered on 23 Aug 2012
3 answers
401 views
Hello,

i have some a grid and every of its rows has a subgrid (NestedViewTemplate).
The option AllowMultiRowEdit is set to "false".
This option let me select only one row per grid (which is ok) but does not prevent to select a single row in each grid/subgrid!
Is there a way to select only 1 row in ALL grids/subgrids together?
I want to have only one selected row, no matter how many subgrids are open.
So if I select a row in a subgrid, the selected row in an other subgrid should be automatically deselected.

Any solution for my request?

By the way, it should be client side only!

Thanks,
Adam
Eyup
Telerik team
 answered on 23 Aug 2012
5 answers
912 views
I have a RadGrid with a GridClientSelectColumn. I need to enable and disable some buttons on the page, client-side, when certain rows are selected by clicking in the checkbox in each row's GridClientSelectColumn.  I added an onclick event to the checkboxes for the required rows and that's all working fine.

My problem is with the select/deselect all checkboxes in the header and footer of the column. Clicking these changes the selection state of all of the rows, and it doesn't fire the onclick event for each of the individual row checkboxes.  Which means I need to catch onclick on these, as well, and do some processing to decide whether the buttons should be enabled or disabled.

I didn't have any problem attaching a function to the onclick of the header checkbox:
protected void grd_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridHeaderItem)
     {
    GridHeaderItem header = (GridHeaderItem)e.Item;
    TableCell selectBoxCell = header["ClientSelectColumn"];
    Control selectBoxControl = selectBoxCell.Controls[0];
    CheckBox selectBox = selectBoxControl as CheckBox;
    selectBox.Attributes["onclick"] = "return selectall_clicked(this);";
  }
}

The function is called, when the checkbox is clicked, and returns true, but none of the row checkboxes are changed. It looks like the selection of all of the individual rows is done in an onclick handler, and I'm replacing it, instead of extending it.

There's probably a real simple way to add another onclick handler without eliminating an existing one.  Any ideas?
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
 answered on 23 Aug 2012
5 answers
116 views
Hello,

I have a UserControl with several RadControls on it.  The control is placed in an ASPX page which uses a MasterPage.  My RadScriptManager is on the MasterPage.  Within the control I have a RadGrid used to edit some user data.  When the RadGrid initiates an Ajax postback, the RadAjaxLoadingPanel on the page fires.  The postback completes, but the RadAjaxLoadingPanel never disappears.  I have tried just about every trick I can find in the forums to no avail.  The odd thing is that if I paste the contents of the UserControl into a standalone ASPX page, it works perfectly.  The code for the UserControl follows.  What am I doing wrong?

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1" >
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="pnlContent">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="pnlContent" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxPanel runat="server" ID="pnlContent">
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Skin="Vista" EnableSkinTransparency="true"
            BackgroundPosition="Center" runat="server">
        </telerik:RadAjaxLoadingPanel>
<telerik:RadGrid ID="rgList" runat="server" AutoGenerateColumns="False" DataSourceID="lds1"
    EnableAjaxSkinRendering="true" DataKeyNames="userID" CellSpacing="0" GridLines="None"
    AllowPaging="True" AllowSorting="True" OnRowUpdating="OnUpdate" EditItemStyle-BackColor="AntiqueWhite"
    AllowAutomaticUpdates="True" AllowAutomaticDeletes="True" OnDeleteCommand="OnDelete"
    PageSize="50" PagerStyle-Position="TopAndBottom">
    <MasterTableView DataSourceID="lds1" DataKeyNames="userID">
        <CommandItemSettings ExportToPdfText="Export to PDF" />
        <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
            <HeaderStyle Width="20px" />
        </RowIndicatorColumn>
        <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
            <HeaderStyle Width="20px" />
        </ExpandCollapseColumn>
        <AlternatingItemStyle BackColor="LightGray" />
        <EditFormSettings>
            <EditColumn UniqueName="EditCommandColumn" ButtonType="ImageButton" CancelImageUrl="~/images/cancel.jpg"
                UpdateImageUrl="~/images/save.jpg">
            </EditColumn>
        </EditFormSettings>
        <Columns>
            <telerik:GridEditCommandColumn FilterControlAltText="Filter EditCommandColumn column"
                CancelImageUrl="~/images/cancel.jpg" EditImageUrl="~/images/page_edit.gif" UpdateImageUrl="~/images/save.jpg"
                ButtonType="ImageButton">
            </telerik:GridEditCommandColumn>
            <telerik:GridBoundColumn Display="false" FilterControlAltText="Filter TemplateColumn2 column"
                UniqueName="userID" ReadOnly="true" DataField="userID">
            </telerik:GridBoundColumn>
            <telerik:GridTemplateColumn HeaderText="Tools" Display="false" FilterControlAltText="Filter TemplateColumn2 column"
                UniqueName="TemplateColumn2">
                <EditItemTemplate>
                    <asp:LinkButton ID="lbResetPW" runat="server" Text="Reset Password" ClientIDMode="Static"></asp:LinkButton
                      
                    <asp:LinkButton ID="lbRoles" runat="server" Text="User Roles" ClientIDMode="Static"
                        OnClick="OnShowRoles"></asp:LinkButton></EditItemTemplate>
                <ItemTemplate>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn DataField="FirstName" FilterControlAltText="Filter FirstName column"
                UniqueName="FirstName" HeaderText="First Name" SortExpression="FirstName">
                <EditItemTemplate>
                    <asp:TextBox ID="tbFirstName" runat="server" Text='<%#Bind("FirstName") %>' /><asp:RequiredFieldValidator
                        ID="rfv1" runat="server" Display="Dynamic" ControlToValidate="tbFirstName" ForeColor="Red"
                        ErrorMessage="First name is required"></asp:RequiredFieldValidator></EditItemTemplate>
                <ItemTemplate>
                    <%#Eval("FirstName") %></ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn DataField="LastName" FilterControlAltText="Filter LastName column"
                UniqueName="LastName" HeaderText="Last Name" SortExpression="LastName">
                <EditItemTemplate>
                    <asp:TextBox ID="tbLastName" runat="server" Text='<%#Bind("LastName") %>' /><asp:RequiredFieldValidator
                        ID="rfv2" runat="server" Display="Dynamic" ControlToValidate="tbLastName" ForeColor="Red"
                        ErrorMessage="Last name is required"></asp:RequiredFieldValidator></EditItemTemplate>
                <ItemTemplate>
                    <%#Eval("LastName") %></ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn DataField="EmployeeID" FilterControlAltText="Filter EmployeeID column"
                UniqueName="EmployeeID" HeaderText="EmployeeID" SortExpression="EmployeeID">
                <EditItemTemplate>
                    <asp:TextBox ID="tbEmployeeID" runat="server" Text='<%#Bind("EmployeeID") %>' /><asp:RequiredFieldValidator
                        ID="rfv3" runat="server" Display="Dynamic" ControlToValidate="tbEmployeeID" ForeColor="Red"
                        ErrorMessage="Employee ID is required"></asp:RequiredFieldValidator></EditItemTemplate>
                <ItemTemplate>
                    <%#Eval("EmployeeID") %></ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn DataField="Email" FilterControlAltText="Filter Email column"
                UniqueName="Email" HeaderText="Email" SortExpression="Email">
                <EditItemTemplate>
                    <asp:TextBox ID="tbEmail" runat="server" Text='<%#Bind("Email") %>' /><asp:RequiredFieldValidator
                        ID="rfv4" runat="server" Display="Dynamic" ControlToValidate="tbEmail" ForeColor="Red"
                        ErrorMessage="Email is required"></asp:RequiredFieldValidator></EditItemTemplate>
                <ItemTemplate>
                    <%#Eval("Email") %></ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn DataField="Branch" FilterControlAltText="Filter Branch column"
                UniqueName="Branch" HeaderText="Branch" SortExpression="Branch">
                <EditItemTemplate>
                    <asp:TextBox ID="tbBranch" runat="server" Text='<%#Bind("Branch") %>' /><asp:RequiredFieldValidator
                        ID="rfv5" runat="server" Display="Dynamic" ControlToValidate="tbBranch" ForeColor="Red"
                        ErrorMessage="Branch is required"></asp:RequiredFieldValidator></EditItemTemplate>
                <ItemTemplate>
                    <%#Eval("Branch") %></ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridCheckBoxColumn DataField="Is24" Display="False" FilterControlAltText="Filter Is24 column"
                HeaderText="24-hour Employee" SortExpression="Is24" UniqueName="Is24">
            </telerik:GridCheckBoxColumn>
            <telerik:GridTemplateColumn DataField="JobDescription" FilterControlAltText="Filter JobDescription column"
                UniqueName="JobDescription" HeaderText="Job Description" SortExpression="JobDescription">
                <EditItemTemplate>
                    <asp:TextBox ID="tbJobDescription" runat="server" Text='<%#Bind("JobDescription") %>' /><asp:RequiredFieldValidator
                        ID="rfv6" runat="server" Display="Dynamic" ControlToValidate="tbJobDescription"
                        ForeColor="Red" ErrorMessage="Job Description is required"></asp:RequiredFieldValidator></EditItemTemplate>
                <ItemTemplate>
                    <%#Eval("JobDescription") %></ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn1 column"
                Display="false" HeaderText="District" UniqueName="District">
                <EditItemTemplate>
                    <asp:DropDownList ID="ddlDistrict" runat="server" DataSourceID="lds3" DataMember=""
                        DataValueField="DistrictID" DataTextField="DistrictName" SelectedValue='<%#Bind("DistrictID") %>'
                        AppendDataBoundItems="true">
                        <asp:ListItem Value=''>- None -</asp:ListItem>
                    </asp:DropDownList>
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn column" Display="false"
                HeaderText="District Mgr" UniqueName="DistrictMgr">
                <EditItemTemplate>
                    <asp:DropDownList ID="ddlDM" runat="server" DataSourceID="lds2" DataMember="" DataValueField="userID"
                        DataTextField="Name" SelectedValue='<%#Bind("DistrictMgr") %>' AppendDataBoundItems="true">
                        <asp:ListItem Value=''>- None -</asp:ListItem>
                    </asp:DropDownList>
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn1 column"
                Display="false" HeaderText="Region" UniqueName="Region">
                <EditItemTemplate>
                    <asp:DropDownList ID="ddlRegion" runat="server" DataSourceID="lds4" DataMember=""
                        DataValueField="RegionID" DataTextField="RegionName" SelectedValue='<%#Bind("RegionID") %>'
                        AppendDataBoundItems="true">
                        <asp:ListItem Value=''>- None -</asp:ListItem>
                    </asp:DropDownList>
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn1 column"
                Display="false" HeaderText="Regional Mgr" UniqueName="RegionalMgr">
                <EditItemTemplate>
                    <asp:DropDownList ID="ddlRM" runat="server" DataSourceID="lds2" DataValueField="userID"
                        DataTextField="Name" SelectedValue='<%#Bind("RegionalMgr") %>' AppendDataBoundItems="true">
                        <asp:ListItem Value=''>- None -</asp:ListItem>
                    </asp:DropDownList>
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridBoundColumn DataField="LastUpdated" FilterControlAltText="Filter column column"
                HeaderText="Last Updated" ReadOnly="True" SortExpression="LastUpdated" UniqueName="LastUpdated">
            </telerik:GridBoundColumn>
            <telerik:GridTemplateColumn DataField="UpdatedBy" FilterControlAltText="Filter UpdatedBy column"
                HeaderText="Updated By" ReadOnly="True" SortExpression="UpdatedBy" UniqueName="UpdatedBy">
                <ItemTemplate>
                    <asp:Label ID="lblUdb" runat="server" Text='<%#Eval("aspnet_User3.UserName") %>'></asp:Label></ItemTemplate>
            </telerik:GridTemplateColumn>
            <telerik:GridTemplateColumn UniqueName="Delete" ItemStyle-Width="18px">
                <ItemTemplate>
                    <asp:ImageButton ID="ibDelete" runat="server" CommandName="Delete" CommandArgument='<%#Eval("userID") %>'
                        ImageUrl="~/images/delete.png" AlternateText="Delete Option" OnClientClick="return confirm('Are you sure you want to delete this user?');" />
                </ItemTemplate>
                <ItemStyle Width="18px"></ItemStyle>
            </telerik:GridTemplateColumn>
        </Columns>
        <EditFormSettings>
            <EditColumn FilterControlAltText="Filter EditCommandColumn column">
            </EditColumn>
        </EditFormSettings>
    </MasterTableView>
    <EditItemStyle BackColor="AntiqueWhite" />
    <PagerStyle Position="TopAndBottom"></PagerStyle>
    <FilterMenu EnableImageSprites="False">
    </FilterMenu>
    <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
    </HeaderContextMenu>
</telerik:RadGrid>
<asp:LinqDataSource ID="lds1" runat="server" ContextTypeName="DataClassesDataContext"
    OrderBy="LastName" TableName="UserInfos" EnableDelete="True" EnableInsert="True"
    EnableUpdate="True" OnUpdating="lds1_Updating" OnSelecting="lds1_Selecting">
</asp:LinqDataSource>
<asp:LinqDataSource ID="lds2" runat="server" ContextTypeName="DataClassesDataContext"
    OnSelecting="lds2_Selecting">
</asp:LinqDataSource>
<asp:LinqDataSource ID="lds3" runat="server" ContextTypeName="DataClassesDataContext"
    OnSelecting="lds3_Selecting">
</asp:LinqDataSource>
<asp:LinqDataSource ID="lds4" runat="server" ContextTypeName="DataClassesDataContext"
    OnSelecting="lds4_Selecting">
</asp:LinqDataSource>
<telerik:RadWindow ID="rwNewUser" runat="server" VisibleOnPageLoad="false" EnableShadow="true"
    Modal="true">
    <ContentTemplate>
        <table style="width: 100%;">
            <tr>
                <td colspan="2" style="text-align: center; font-weight: bold; border-bottom: 2px solid #6666ff;">
                    New User
                </td>
            </tr>
            <tr>
                <td>
                    Employee ID:
                </td>
                <td>
                    <asp:TextBox ID="tbNewEEID" runat="server"></asp:TextBox><asp:RequiredFieldValidator
                        ID="rfv1" runat="server" Display="Dynamic" ForeColor="Red" Font-Size="Small"
                        ControlToValidate="tbNewEEID" ErrorMessage="Please enter the new user's employeeID (this will be their login user name)."
                        ValidationGroup="valNewUser"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td>
                    Password:
                </td>
                <td>
                    <asp:TextBox ID="tbNewPW" runat="server"></asp:TextBox><asp:RequiredFieldValidator
                        ID="rfv2" runat="server" Display="Dynamic" ForeColor="Red" Font-Size="Small"
                        ControlToValidate="tbNewPW" ErrorMessage="Please enter the new user's password."
                        ValidationGroup="valNewUser"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td>
                    Email Address:
                </td>
                <td>
                    <asp:TextBox ID="tbNewEmail" runat="server"></asp:TextBox><asp:RequiredFieldValidator
                        ID="rfv3" runat="server" Display="Dynamic" ForeColor="Red" Font-Size="Small"
                        ControlToValidate="tbNewEmail" ErrorMessage="Please enter the new user's email address."
                        ValidationGroup="valNewUser"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    <asp:Button ID="btnaddNew" runat="server" Text="Add" CssClass="cmdButton" OnClick="OnInsert"
                        ValidationGroup="valNewUser" />
                </td>
            </tr>
        </table>
    </ContentTemplate>
</telerik:RadWindow>
<telerik:RadWindow ID="rwChangePassword" runat="server" VisibleOnPageLoad="false"
    EnableShadow="true" Modal="true" OpenerElementID="lbResetPW">
    <ContentTemplate>
        <table style="width: 100%;">
            <tr>
                <td colspan="2" style="text-align: center; font-weight: bold; border-bottom: 2px solid #6666ff;">
                    Change Password
                </td>
            </tr>
            <tr>
                <td>
                    New Password:
                </td>
                <td>
                    <asp:TextBox ID="tbChPW" runat="server" Text="usb"></asp:TextBox><asp:RequiredFieldValidator
                        ID="RequiredFieldValidator1" runat="server" Display="Dynamic" ForeColor="Red"
                        Font-Size="Small" ControlToValidate="tbChPW" ErrorMessage="Please enter a password."
                        ValidationGroup="valChPw"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    <asp:Button ID="btnChPw" runat="server" Text="Change" CssClass="cmdButton" OnClick="OnChangePW"
                        ValidationGroup="valChPw" OnClientClick="return confirm('Are you sure you want to reset this user\'s password?');" />
                </td>
            </tr>
        </table>
    </ContentTemplate>
</telerik:RadWindow>
<telerik:RadWindow ID="rwRoles" runat="server" VisibleOnPageLoad="false" EnableShadow="true"
    Modal="true">
    <ContentTemplate>
        <table style="width: 100%;">
            <tr>
                <td colspan="2" style="text-align: center; font-weight: bold; border-bottom: 2px solid #6666ff;">
                    Change Roles
                </td>
            </tr>
            <tr>
                <td style="vertical-align: top;">
                    Choose Roles:
                </td>
                <td>
                    <asp:RadioButtonList ID="rblMainRoles" runat="server">
                        <asp:ListItem Value="User">User</asp:ListItem>
                    </asp:RadioButtonList>
                    <hr />
                    <asp:RadioButtonList ID="rblBankRoles" runat="server">
                        <asp:ListItem Value="BranchMgr">Branch Manager</asp:ListItem>
                        <asp:ListItem Value="DistrictMgr">District Manager</asp:ListItem>
                        <asp:ListItem Value="RegionMgr">Regional Manager</asp:ListItem>
                        <asp:ListItem Value="AdminAssistant">RM/DM Admin</asp:ListItem>
                    </asp:RadioButtonList>
                </td>
            </tr>
            <tr>
                <td>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    <asp:Button ID="btnRoles" runat="server" Text="Change" CssClass="cmdButton" OnClick="OnChangeRoles"
                        ValidationGroup="valChPw" OnClientClick="return confirm('Are you sure you want to change this user\'s roles?');" />
                </td>
            </tr>
        </table>
    </ContentTemplate>
</telerik:RadWindow></telerik:RadAjaxPanel>
<telerik:RadScriptBlock ID="RadCodeBlock2" runat="server">
    <script type="text/javascript">
        var message = "<%=m_message %>";
        if (message != "")
            alert(message);
    </script>
</telerik:RadScriptBlock>

Emir
Top achievements
Rank 1
 answered on 23 Aug 2012
5 answers
432 views

I followed the example online to download the attachment from a grid with a GridAttachmentColumn but I can't get the download working. The postback fires, ajax disables but the file is not sent. I am using Entity Framework.

<telerik:RadGrid 
    AutoGenerateColumns="False" 
    AutoGenerateDeleteColumn="True" 
    AutoGenerateEditColumn="True" 
    DataSourceID="EntityAttachmentsDataSource" 
    ID="EntityAttachmentsGrid" 
    OnDeleteCommand="EntityAttachmentsGrid_OnDeleteCommand" 
    OnInsertCommand="EntityAttachmentsGrid_OnInsertCommand" 
    OnItemCommand="EntityAttachmentsGrid_OnItemCommand"
    OnUpdateCommand="EntityAttachmentsGrid_OnUpdateCommand" 
    runat="server">
    <MasterTableView 
        DataKeyNames="Id" 
        DataSourceID="EntityAttachmentsDataSource">
        <Columns>
            <telerik:GridBoundColumn 
                DataField="Id" 
                DataType="System.Int32" 
                HeaderText="Id" 
                ReadOnly="True" 
                UniqueName="Id">
            </telerik:GridBoundColumn>
            <telerik:GridBoundColumn 
                DataField="FileName" 
                HeaderText="FileName" 
                UniqueName="FileName" 
                ReadOnly="true" 
                DataType="System.String">
            </telerik:GridBoundColumn>
            <telerik:GridAttachmentColumn 
                DataSourceID="EntityAttachmentDataSource"
                MaxFileSize="1048576" 
                EditFormHeaderTextFormat="Upload Attachment:"
                HeaderText="Attachment"
                HeaderTooltip="Download Entity Attachment"
                AttachmentDataField="Attachment" 
                AttachmentKeyFields="Id"
                FileNameTextField="FileName" 
                DataTextField="FileName"
                UniqueName="InfringmentAttachment">
            </telerik:GridAttachmentColumn>
        </Columns>
    </MasterTableView>
    <ClientSettings>
        <ClientEvents OnCommand="GridOnCommand" />
    </ClientSettings>
</telerik:RadGrid>
  
<asp:EntityDataSource 
    ConnectionString="name=MyEntities" 
    DefaultContainerName="MyEntities" 
    EnableFlattening="False" 
    EntitySetName="EntityAttachments" 
    EntityTypeFilter="EntityAttachment" 
    ID="EntityAttachmentsDataSource" 
    runat="server">
</asp:EntityDataSource>
  
<asp:EntityDataSource 
    ConnectionString="name=MyEntities" 
    DefaultContainerName="MyEntities" 
    EnableFlattening="False" 
    EntitySetName="EntityAttachments" 
    EntityTypeFilter="EntityAttachment" 
    ID="EntityAttachmentDataSource" 
    runat="server" 
    Where="it.[Id] = @Id"
    Select="it.[Attachment]">
    <SelectParameters>
        <asp:Parameter Name="Id" Type="Int32" />
    </SelectParameters>
</asp:EntityDataSource>

I disabled ajax fine (ConditionalPostback, etc.) and can upload no worries. But I can't get the attachment to download direct from the datasource. All the examples I can find are for SqlDataSource.

Richard

Richard Weeks
Top achievements
Rank 2
 answered on 23 Aug 2012
1 answer
69 views

When a parent record is expanded I want to evaluate and either show or hide the AddNewRecordButton on the multiple detail tables . I found that I can turn it off in the ItemDataBound event with this code.  Which appears to work until the grid  rebinds and then it applies to all records universally. I think I am coming at this from the wrong direction.  Is there a better way? 

GridDataItem item = (GridDataItem)e.Item;
if (_currentDate < DateTime.Today && _currentDate != null)
   {
 ((RadGrid)(item.Parent.Parent.Parent)).MasterTableView.DetailTables[0].CommandItemDisplay = Telerik.Web.UI.GridCommandItemDisplay.None;
 ((RadGrid)(item.Parent.Parent.Parent)).MasterTableView.DetailTables[1].CommandItemDisplay = Telerik.Web.UI.GridCommandItemDisplay.None;
 ((RadGrid)(item.Parent.Parent.Parent)).MasterTableView.DetailTables[2].CommandItemDisplay = Telerik.Web.UI.GridCommandItemDisplay.None;
}
Shinu
Top achievements
Rank 2
 answered on 23 Aug 2012
2 answers
68 views
Hi All,

I am using a Rad editor as my EmailBody - This one comes with all bold,italic,underline...etc (All functionality that a outlook mail will have)

<telerik:RadEditor ID="txtEmailBody" runat="server" Width="750px" StripFormattingOptions="MSWord, Css, Span, ConvertWordLists" EditModes="All" 
    StripFormattingOnPaste="MSWord, Css, Span, ConvertWordLists" ToolsFile="~/DesktopModules/Test/RadEditorTools.xml">
</telerik:RadEditor>

When I have the above code It is not letting me enter any text in the "txtemailbody"  When I add enabletextareamode="True" to the above code I am able to enter text but all the "old,italic,underline...etc (All functionality that a outlook mail will have) " functionality is not there any more.

How can I keep the functionality and enable Rad editor to accept text?? Please Advise??
Sima
Top achievements
Rank 1
 answered on 22 Aug 2012
2 answers
89 views

HI,
excuse for my english am french
i start  to build my new back office manager with your solution.
they start to develop in dotnet (transfer  to  asp 3.0)

i build an news manager with
datagrid / insert-update-delete with usercontrol ( in datagrid)
my news manager use 2 racontrols : editor (they work fine !!!) and radupload for litle image of the news  all page are in masterpage :

 

In actu.aspx they have one raddatagrid they call webusercontrol.ascx

In webusercontrolascx they have radeditor and radupload.


this code work when they run in single page (not include in master page)

 

In masterpage the radeditor work well but the radupload return nothing I thinks i can’t find this control.



    Protected Sub RadGrid1_UpdateCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.UpdateCommand

        'Get the GridEditableItem of the RadGrid

        Dim editedItem As GridEditableItem = TryCast(e.Item, GridEditableItem)

        Dim MyUserControl As UserControl = CType(e.Item.FindControl(GridEditFormItem.EditFormUserControlID), UserControl)

        'InitializeUpdateParameter(DirectCast(e.Item.FindControl("RadUpload1"), RadUpload))

        'Get the primary key value using the DataKeyValue.

        Dim actuID As String = editedItem.OwnerTableView.DataKeyValues(editedItem.ItemIndex)("ID").ToString()

        'Access the textbox from the edit form template and store the values in string variables.

 

        Dim Titre As String = CType(MyUserControl.FindControl("titre"), TextBox).Text

        Dim Description As String = CType(MyUserControl.FindControl("RadEditor1"), RadEditor).Content

        'Dim RadUpload1 As RadUpload = TryCast(e.Item.FindControl("RadUpload1"), RadUpload)

        Dim RadUpload1 As RadUpload = CType(MyUserControl.FindControl("RadUpload1"), RadUpload)

        Dim Imageup As String

        If RadUpload1.UploadedFiles.Count > 0 Then

            System.Threading.Thread.Sleep(3000)

        End If

 

        For Each f As UploadedFile In RadUpload1.UploadedFiles

            If f.FileName <> "" Then

                Imageup = f.GetName

            Else

                Imageup = "none"

                'Dim imaup As String =

                'Open the SqlConnection

            End If

        Next

        Try

            SqlConnection.Open()

            'Update Query to update the Datatable

            Dim updateQuery As String = "UPDATE Actuvdotnet set TitreNews='" & Titre & "',Description='" & Description & "',Image='" & Imageup & "' where ID='" & actuID & "'"

            SqlCommand.CommandText = updateQuery

            SqlCommand.Connection = SqlConnection

            SqlCommand.ExecuteNonQuery()

            'Close the SqlConnection

 

 

            SqlConnection.Close()

        Catch ex As Exception

 

            RadGrid1.Controls.Add(New LiteralControl("Impossible de mettre à jour la base de donnée : " + ex.Message))

            e.Canceled = True

 

        End Try

 

    End Sub

In master page the radeditor work well but the radupload return nothing I thinks i can find this control

Can you help me please.

Neri
Top achievements
Rank 1
 answered on 22 Aug 2012
13 answers
753 views
Hi,

I am new to your controls - but very impressed, keep it up.

My issue is that with a RadGrid (Q3 2008) when the text of a field is too long to fit in the column, and has no whitespace on which to break, the text simply overflows into the adjacent column. Have I missed a setting/option somewhere, in my case just forcing a break at the column width would be fine. Incidentally I get the same behaviour with the PDF export.

I have searched the support site and don't see anyone else asking, and I surely am not the only person getting the effect?
Purush
Top achievements
Rank 1
 answered on 22 Aug 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?