Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
539 views
I have several separate forms that I want to add a "reset" or "clear" button to. What I'd like is a way to blanket reset all controls to their initial state.

The forms are built entirely from Telerik controls.

What is the best to do this? I'd like the ability to use a single piece of code (javascript) to be included in all pages.
Shinu
Top achievements
Rank 2
 answered on 27 Nov 2013
5 answers
149 views
Hi,
I am facing Combobox Bind issue in grid while using custom template in editmode,
table data comes to datatable but while providing datasource it gives error.
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
   {
       if (e.Item is GridEditableItem)
       {
           GridEditableItem edit = (GridEditableItem)e.Item;
           RadComboBox cmbUserType = (RadComboBox)edit.FindControl("cmbusertype");
           DataTable dt1 = ObjGlobas.UserType();
           cmbUserType.DataSource = dt1;
           cmbUserType.DataTextField = "UserType";
           cmbUserType.DataValueField = "UserTypeId";
           cmbUserType.DataBind();
       }
   }
Thanks
Swapnil
Top achievements
Rank 1
 answered on 27 Nov 2013
13 answers
513 views
I have a grid whose table view's EditMode is set to batch.
One of the columns of the grid is a GridDropDownColumn, and the inner input is a select element (DropDownControlType="DropDownList").

The values are displayed properly in the read mode. When I open a row for editing, the drop down appears with the first item selected, not the value of the cell.
When I call
$find("gv").get_batchEditingManager().getCellValue(document.querySelectorAll(".rgBatchCurrent")[5])
on the grid I get the text value displayed while on read only mode, not the underlying value (5 is the index of the drop down column).
For example, the previous call returns "Employee (non-sales)" but it should return "EM".

If I use the rad combo box editor instead, it works well, but I don't want it for this simple form. I want to use the plain drop down list.
أشرف
Top achievements
Rank 1
 answered on 27 Nov 2013
5 answers
522 views
Hi,

I am using asyncupload for storing files into database.

I have 2 grids and a upload control and a save to database button. The selection of a row from 1st grid selects rows from 2nd grid. After this, a file is uploaded using asyncupload. Now by clicking the submit button I want to save the grid selections and the file to database.
I have attached a PostbackTriggers property to asyncupload  control because when i upload a file and change the selection in first grid the file is gone because of postback. If i remove PostbackTriggers property UploadedFiles count is not zero.

The UploadedFiles of asyncupload is always returning 0 files when i use PostbackTriggers.
I have attached an image to describe the controls.
Shinu
Top achievements
Rank 2
 answered on 27 Nov 2013
3 answers
244 views
I want to execute some code on the server when the dropdowntree is cleared using the Clear button. How do I go about doing that? Thanks in advance.
Shinu
Top achievements
Rank 2
 answered on 27 Nov 2013
1 answer
253 views

I have a RadTreeView with so many nodes that it requires scroll bars. When the 
user selects a node the screen is refreshed and the selected node is no 
longer visible, I have to scroll down to go selected node. The TreeView is opened to the selected node but the screen 
is not scrolled to it. How can I get the TreeView to show the selected node 
after it has been refreshed?
Plamen
Telerik team
 answered on 27 Nov 2013
1 answer
208 views
Hello,

I have a web page with several comboboxes , trying to set the enabled property to false on page load with the following code:

  foreach (Telerik.Web.UI.RadComboBox p in this.Controls.OfType<Telerik.Web.UI.RadComboBox>())
            p.Enabled = false;

doesnt seem to work, can someone suggest the rightway??

Thanks
Shinu
Top achievements
Rank 2
 answered on 27 Nov 2013
3 answers
114 views
hi

I faced an error that it cannot Cannot find a cell bound to column name 'CustTextBox'  How should I solve this? Thanks a lot

here is my code:

 <telerik:GridTemplateColumn DataField="CustName"
            FilterControlAltText="Filter CustName column" HeaderText="Customer Name"
            SortExpression="CustName" UniqueName="CustName">
            <EditItemTemplate>
                <asp:TextBox ID="CustNameTextBox" runat="server"
                    Text='<%# Bind("CustName") %>'></asp:TextBox>
            </EditItemTemplate>
            <ItemTemplate>
                <asp:Label ID="SCustNameLabel" runat="server" Text='<%# Eval("CustName") %>'></asp:Label>
            </ItemTemplate>
</telerik:GridTemplateColumn>

    Protected Sub RadGrid1_InsertCommand(sender As Object, e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.InsertCommand
        Dim insertedItem As GridEditFormInsertItem = DirectCast(e.Item, GridEditFormInsertItem)
        Dim CustName As String = (TryCast(insertedItem("CustNameTextBox").Controls(0), TextBox)).Text
        Customer_Insert(CustName)
        RadGrid1.Rebind()
    End Sub

Protected Sub RadGrid1_UpdateCommand(sender As Object, e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.UpdateCommand
        Dim editedItem As GridEditableItem = TryCast(e.Item, GridEditableItem)
        Dim CustID As String = editedItem.OwnerTableView.DataKeyValues(editedItem.ItemIndex)("CustID").ToString()
        Dim CustName As String = (TryCast(editedItem("CustNameTextBox").Controls(0), TextBox)).Text
        Customer_Update(New Guid(CustID), CustName)
        RadGrid1.Rebind()
    End Sub

Princy
Top achievements
Rank 2
 answered on 27 Nov 2013
3 answers
195 views
Hi,
i want to Use Of both EditFormType="Template"(for Insert Because of all field)  AND EditFormType="EditForm"(because of some field which are shown in grid)
My code is:
<%@ Page Title="" Language="C#" MasterPageFile="~/MPLayout.master" AutoEventWireup="true"
    CodeFile="UserDetailsGrid.aspx.cs" Inherits="EntityDetailsGrid" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    
    <telerik:RadAjaxManager ID="RadAjaxManager1" DefaultLoadingPanelID="RadAjaxLoadingPanel1"
        ClientEvents-OnRequestStart="onRequestStart" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Animation="Slide"
        KeepInScreenBounds="true" Skin="Outlook" MaxHeight="130px" MaxWidth="360px">
    </telerik:RadWindowManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Transparency="5"
        Skin="Outlook" />
    <script type="text/javascript">
        function onRequestStart(sender, args) {
            if (args.get_eventTarget().indexOf("ExportTo") >= 0) {
                args.set_enableAjax(false);
            }
        }
    </script>
    <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="true" AllowSorting="true"
        Skin="Outlook" HeaderStyle-Font-Bold="true" HeaderStyle-Font-Size="13px" HeaderStyle-Font-Names="Verdana"
        ItemStyle-Font-Names="Verdana" AlternatingItemStyle-Font-Names="Verdana" ShowGroupPanel="true"
        OnPreRender="RadGrid1_PreRender"
        OnNeedDataSource="RadGrid1_NeedDataSource1"
        onitemcommand="RadGrid1_ItemCommand1" onitemdeleted="RadGrid1_ItemDeleted"
        oniteminserted="RadGrid1_ItemInserted" onitemupdated="RadGrid1_ItemUpdated">
        <PagerStyle AlwaysVisible="true" Font-Bold="true" Mode="NextPrevNumericAndAdvanced" />
        <ClientSettings AllowDragToGroup="true" AllowColumnsReorder="true" Resizing-AllowResizeToFit="true">
            <Selecting AllowRowSelect="True" UseClientSelectColumnOnly="True"></Selecting>
        </ClientSettings>
        <ExportSettings ExportOnlyData="true" OpenInNewWindow="true" IgnorePaging="true"
            FileName="Entity Details">
            <Pdf AllowAdd="true" AllowCopy="true" AllowModify="true" AllowPrinting="true" BorderColor="Black"
                BorderStyle="Medium" BorderType="AllBorders" PageBottomMargin="20px" PageFooter-LeftCell-TextAlign="Center"
                PageFooterMargin="20px" PageHeader-LeftCell-TextAlign="Center" PageHeaderMargin="20px"
                PageLeftMargin="35px" PageRightMargin="35px" PageTitle="List Of Entities and Details"
                PageTopMargin="35px" PaperSize="A4" UserPassword="ss">
            </Pdf>
        </ExportSettings>
        <MasterTableView CommandItemDisplay="Top" CommandItemSettings-ShowAddNewRecordButton="true"
            EditMode="EditForms" DataKeyNames="UserId" CommandItemSettings-ShowRefreshButton="false">
            <CommandItemSettings ShowExportToCsvButton="true" ShowExportToExcelButton="true"
                ShowExportToPdfButton="true" ShowExportToWordButton="true" />
            <EditFormSettings FormMainTableStyle-HorizontalAlign="Center" EditColumn-ButtonType="PushButton"
                FormTableStyle-Width="100%" FormTableButtonRowStyle-HorizontalAlign="Center"
                FormTableStyle-CellPadding="3" FormMainTableStyle-Font-Bold="true" FormMainTableStyle-ForeColor="Purple"
                FormStyle-CssClass="" FormTableStyle-CellSpacing="5" InsertCaption="Add New User Details"
                FormCaptionStyle-Font-Bold="true" FormCaptionStyle-Font-Underline="true" FormCaptionStyle-ForeColor="Black"
                FormCaptionStyle-Font-Size="Large" FormCaptionStyle-HorizontalAlign="Center"
                FormCaptionStyle-Width="100%">
                <FormStyle Width="100%" BackColor="LightCyan"></FormStyle>
            </EditFormSettings>
            <EditFormSettings EditFormType="Template">
                <FormTemplate>
                    <center>
                        <u>
                            <h4>
                                Add New User Details</h4>
                        </u>
                        <table style="font-family: Verdana; padding: 10px" cellspacing="5" cellpadding="3">
                            <tr>
                                <td>
                                    User Name
                                </td>
                                <td>
                                    <asp:TextBox ID="tempUserName" runat="server" Width="200px" Font-Names="Verdana">
                                    </asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="tempUserName"
                                        Font-Bold="true" ErrorMessage="*" ValidationGroup="Save"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    First Name
                                </td>
                                <td>
                                    <asp:TextBox ID="tempFirstName" runat="server" Width="200px" Font-Names="Verdana">
                                    </asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="tempFirstName"
                                        Font-Bold="true" ErrorMessage="*" ValidationGroup="Save"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Last Name
                                </td>
                                <td>
                                    <asp:TextBox ID="tempLastName" runat="server" Width="200px" Font-Names="Verdana">
                                    </asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="tempLastName"
                                        Font-Bold="true" ErrorMessage="*" ValidationGroup="Save"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    User Email
                                </td>
                                <td>
                                    <asp:TextBox ID="tempUserEmail" runat="server" Width="200px" Font-Names="Verdana">
                                    </asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="tempUserEmail"
                                        ErrorMessage="*" ValidationGroup="Save"></asp:RequiredFieldValidator>
                                    <asp:RegularExpressionValidator ID="Rev1" runat="server" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                                        ErrorMessage="* Invalid Email" ValidationGroup="Save" ForeColor="Red" ControlToValidate="tempUserEmail"></asp:RegularExpressionValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Phone No
                                </td>
                                <td>
                                    <asp:TextBox ID="tempPhoneNo" runat="server" Width="200px">
                                    </asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="tempPhoneNo"
                                        ErrorMessage="*" ValidationGroup="Save"></asp:RequiredFieldValidator>
                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ValidationExpression="^\d+$"
                                        ErrorMessage="* Invalid PhoneNo" ValidationGroup="Save" ForeColor="Red" ControlToValidate="tempPhoneNo"></asp:RegularExpressionValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    User Type
                                </td>
                                <td>
                                    <telerik:RadComboBox ID="cmbusertype" runat="server" Width="207px" Height="200px"
                                        Font-Names="Verdana" Skin="Hay" EnableLoadOnDemand="true" MarkFirstMatch="true"
                                        EmptyMessage="Please Select User Type" />
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="cmbusertype"
                                        Font-Bold="true" ErrorMessage="*" ValidationGroup="Save"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Comapny Name
                                </td>
                                <td>
                                    <telerik:RadComboBox ID="cmbcompanyname" runat="server" Width="207px" Height="200px"
                                        Font-Names="Verdana" Skin="Hay" EnableLoadOnDemand="true" MarkFirstMatch="true"
                                        EmptyMessage="Please Select Company Name" />
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="cmbcompanyname"
                                        Font-Bold="true" ErrorMessage="*" ValidationGroup="Save"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Password
                                </td>
                                <td>
                                    <asp:TextBox ID="tempPassword" runat="server" Width="200px" TextMode="Password">
                                    </asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ControlToValidate="tempPassword"
                                        Font-Bold="true" ErrorMessage="*" ValidationGroup="Save"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Confirm Password
                                </td>
                                <td>
                                    <asp:TextBox ID="tempConfirmPassword" runat="server" Width="200px" TextMode="Password">
                                    </asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" ControlToValidate="tempConfirmPassword"
                                        Font-Bold="true" ErrorMessage="*" ValidationGroup="Save"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td align="right" colspan="2">
                                    <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                        runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
                                    </asp:Button> 
                                    <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                        CommandName="Cancel"></asp:Button>
                                </td>
                            </tr>
                        </table>
                      
                    </center>
                    <br />
                </FormTemplate>
            </EditFormSettings>
            <Columns>
                <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditColumn">
                </telerik:GridEditCommandColumn>
                <telerik:GridButtonColumn CommandName="Delete" ButtonType="ImageButton" UniqueName="DeleteColumn"
                    ConfirmText="Are you sure to Delete this Entity?" ConfirmDialogType="RadWindow"
                    ConfirmTitle="<b>Manifest-BI</b>">
                </telerik:GridButtonColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
</asp:Content>
AND
using System;
using System.Web;
using System.Linq;
using System.Data;
using System.Web.UI;
using Telerik.Web.UI;
using System.Collections;
using System.Web.UI.WebControls;
using System.Collections.Generic;
 
 
public partial class EntityDetailsGrid : System.Web.UI.Page
{
    Globas ObjGlobas = new Globas();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Convert.ToInt32(Session["RoleId"].ToString()) == 3)
        {
            Response.Redirect("ErrorPage.aspx");
        }
        BindGrid();
    }
 
 
    #region[-------Find Entity Id Column To Hide Before Page Load-------]
    protected void RadGrid1_PreRender(object sender, EventArgs e)
    {
        RadGrid1.MasterTableView.GetColumn("UserId").Visible = false;
    }
    #endregion
 
 
 
 
    #region[--------RadGrid Advanced Data Binding-------]
    protected void RadGrid1_NeedDataSource1(object sender, GridNeedDataSourceEventArgs e)
    {
        DataTable DtUserDetails = ObjGlobas.UserDetails();
        DtUserDetails.Columns.Remove("CompId");
        DtUserDetails.Columns.Remove("Password");
        DtUserDetails.Columns.Remove("UserAccessCode");
        DtUserDetails.Columns.Remove("Status");
        DtUserDetails.Columns.Remove("StartDate");
        DtUserDetails.Columns.Remove("EndDate");
        DtUserDetails.Columns.Remove("UserTypeId");
        RadGrid1.DataSource = DtUserDetails;
    }
    #endregion
 
    #region[-------PAGELOAD GRID BIND-------]
    public void BindGrid()
    {
 
        DataTable DtUserDetails = ObjGlobas.UserDetails();
        DtUserDetails.Columns.Remove("CompId");
        DtUserDetails.Columns.Remove("Password");
        DtUserDetails.Columns.Remove("UserAccessCode");
        DtUserDetails.Columns.Remove("Status");
        DtUserDetails.Columns.Remove("StartDate");
        DtUserDetails.Columns.Remove("EndDate");
        DtUserDetails.Columns.Remove("UserTypeId");
        RadGrid1.DataSource = DtUserDetails;
    }
    #endregion
 
 
 
   
    protected void RadGrid1_ItemCommand1(object sender, GridCommandEventArgs e)
    {
        if (e.CommandName == RadGrid.EditCommandName)
        {
            RadGrid1.MasterTableView.IsItemInserted = false;    //Close Insert Form When EditMode Is Open
        }
        if (e.CommandName == RadGrid.InitInsertCommandName)
        {
            RadGrid1.MasterTableView.ClearEditItems();         //Close EditMode Form When Insert Mode Is Open
        }
 
        //To Find Delete & Edit Columns And Hide Their Text While Exporting Grid To PDF & Excel & Word
        if (e.CommandName == RadGrid.ExportToPdfCommandName || e.CommandName == RadGrid.ExportToExcelCommandName || e.CommandName == RadGrid.ExportToCsvCommandName || e.CommandName == RadGrid.ExportToWordCommandName)
        {
            RadGrid1.MasterTableView.GetColumn("EditColumn").Visible = false;
            RadGrid1.MasterTableView.GetColumn("DeleteColumn").Visible = false;
        }
    }
}

Please Want some help,
Thanks
Shinu
Top achievements
Rank 2
 answered on 27 Nov 2013
1 answer
116 views
I have a lightbox with an iframe in the item template that loads pdfs from an httphandler.  In chrome this works fine however it completely crashes IE 8 no matter how I attempt to load the pdf up (direct src, another .aspx with iframe content etc...).  An iframe loading the pdf content alone seems to work just fine however.

Here is my lightbox as declared:

Any suggestions?
<telerik:RadLightBox ID="helpFrame" runat="server" Width="1000px"
        Height="730px" Modal="True" ShowNextButton="False" ShowPrevButton="False"
        PreserveCurrentItemTemplates="true" RenderMode="Lightweight" ClientSettings-ClientEvents-OnLoad="helpLoad">
        <ClientSettings>
            <AnimationSettings HideAnimation="Resize" ShowAnimation="Resize" />
        </ClientSettings>
        <Items>
            <telerik:RadLightBoxItem>
                <ItemTemplate>
                    <iframe clientidmode="Static" id="helpIFrame" height="100%" width="100%"></iframe>
                </ItemTemplate>
            </telerik:RadLightBoxItem>
        </Items>
    </telerik:RadLightBox>
Jon
Top achievements
Rank 1
 answered on 26 Nov 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?