Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
155 views
Hello,

In some months as August 2012, 6 weeks are shown but the last row contains only days of September.
In this case, is it possible to suppress the last row?

Regards,

Erwan
Erwan
Top achievements
Rank 1
 answered on 23 Aug 2012
1 answer
56 views
Hello all,

I have an issue where I have a RadGrid nested within a repeater.  All functionality works fine, except when it comes to filtering.  When I attempt to display the filter menu for a specific column, nothing happens.  No menu displays, no javascript error, nothing.  I searched the forums expecting that at least another individual would have come across this by now, but no such luck.

(Also, I should mention that the radgrid is actually embedded within a user control, that is embedded within the repeater.)

If I place the radgrid outside of the repeater everything works fine.

Any ideas on what I can do to address this?

Thank you.
Martin
Telerik team
 answered on 23 Aug 2012
2 answers
56 views
Hello,

How can I set the css file needed to display different table layouts in table creator in RadEditor for Sharepoint 2010. In "normal" RadEditor setting value:
<telerik:RadEditor TableLayoutCssFile = "/_layouts/1045/STYLES/tableStyles.css" ... />

works well and all table layouts are properly displayed in Table Creator dialog. Doing the same in Rad Editor for Sharepoint by setting the same value in ConfigFile.xml located in: 
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\wpresources\RadEditorSharePoint\6.3.0.0__1f131a624888eeed\Resources\ConfigFile.xml like this:

<configuration>
  <property name="TableLayoutCssFile">/_layouts/1045/STYLES/tableStyles.css</property>
</configuration>

does not work. 

Should it be done in another way?

Thank you in advance.
Stanimir
Telerik team
 answered on 23 Aug 2012
2 answers
162 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
196 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
415 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
951 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
118 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
442 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
73 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?