Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
426 views
Hi,

I'm trying to configure the HttpHandlerUrl parameter for my RadAsyncUpload object.

I configureIt like this :
myAsyncUploader.HttpHandlerUrl  = ("~/loggedin/ImageHandler.ashx?CarId=" + CarId + "&PartnerId=" + PartnerId);

The problem I have always an exception :
 http://vab/loggedin/ImageHandler.ashx?CarId=936&PartnerId=4?type=rau"

...
Illegal characters in path
that's because of that "type=rau".

How can I pass my values from server side to that handler ?

How can I configure my RadAsyncUpload to avoid that "type=rau" ?

Thanks,


Plamen
Telerik team
 answered on 26 Oct 2012
1 answer
241 views
Hi,
   I have an Asp.net Gridview (not Telerik gridview),with checkbox in it. I have button(checkAll) on the top.
when i click the top button,it will check all the checkbox in the Gridview, and when i click on CheckBox inside Gridview
it should display Selected Item.

I have used AjaxLoading Panel, Now it is working only for Button click,
But it is not working for checkbox clicked.

Here is the Below Code :
  
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="DUMMY_Default" %>
<%@ 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">


     <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
     
         <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>


            <telerik:AjaxSetting AjaxControlID="btn1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="GridView1" />
               
                </UpdatedControls>
            </telerik:AjaxSetting>




            
            <telerik:AjaxSetting AjaxControlID="CheckBox1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="GridView1" />
               
                </UpdatedControls>
            </telerik:AjaxSetting>
            
         </AjaxSettings>
    </telerik:RadAjaxManager>

 <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
    </telerik:RadAjaxLoadingPanel>

 <div>
    <asp:Button ID="btn1" runat="server" Text="CheckAll" OnClick="btn1_Click" />
<asp:Panel ID="PanelGrid" runat="server">
    <asp:GridView ID="GridView1" runat="server" DataKeyNames="AnnouncementID"
     AutoGenerateColumns="false" OnRowDataBound="GridView1_OnRowDataBound"
      OnRowCommand="GridView1_OnRowCommand">
      <Columns>
      <asp:TemplateField>
      <ItemTemplate>
      <asp:CheckBox ID="CheckBox1" runat="server"  AutoPostBack="true" OnCheckedChanged="CheckBox1_OnCheckedChanged"/>
      </ItemTemplate>
      </asp:TemplateField>


      <asp:TemplateField>
      <ItemTemplate>
      <asp:Label ID="lblAnnouncementID" runat="server" Text='<%#Eval("AnnouncementID")%>'></asp:Label>
      <asp:LinkButton ID="lnkAnnouncementID" runat="server" Text="Edit" CommandName="Editing" CommandArgument='<%#Eval("AnnouncementID") %>'></asp:LinkButton>
      </ItemTemplate>
      </asp:TemplateField>


      <asp:TemplateField>
      <ItemTemplate>
      <asp:Label ID="lblTitle" runat="server"></asp:Label>
      </ItemTemplate>
      </asp:TemplateField>


      <asp:TemplateField>
      <ItemTemplate>
      <asp:Label id="lblMessage" runat="server"></asp:Label>
      </ItemTemplate>
      </asp:TemplateField>

 </Columns>
      </asp:GridView>
      </asp:Panel>


      <br />
     <asp:TreeView  
                ID="TreeView1"
                ExpandDepth="0" 
                PopulateNodesFromClient="true" 
                ShowLines="true" 
                ShowExpandCollapse="true" 
                runat="server"
               
                 OnSelectedNodeChanged="TreeView1_OnSelectedNodeChanged" />


                 <br />
                 <asp:Label ID="lblmsg" runat="server"></asp:Label>
    </div>
    </form>
</body>
</html>



Code Behind
--------------------
 protected void CheckBox1_OnCheckedChanged(object sender, EventArgs e)
    {
        CheckBox chk = (CheckBox)sender;
        if (chk.Checked)
        {
            lblmsg.Text = "CheckBox chaecked";
        }
    }


    protected void btn1_Click(object sender, EventArgs e)
    {
        foreach (GridViewRow row in GridView1.Rows)
        {
           // GridViewRow gvRow = (GridViewRow)GridView1.FindControl("GridView1");
            CheckBox CheckBox1 = (CheckBox)row.FindControl("CheckBox1");
            CheckBox1.Checked = true;
        }
    }


Please help me with this,Its very urgent,Awaiting for your response.

Regards,
  Prasad 
Eyup
Telerik team
 answered on 26 Oct 2012
2 answers
177 views
Hi,

Anyone has an idea if this is a bug or need to set something?

I have a RadListView with RadDataPager.
When I click on the next icon of the pager on the bottom of my page, I want to see the top of the page, I verified the demo at below link  from telerik, the demo also shows the same,when you click on the next page icon, the page need to be loaded with data and top of the screen should appear.

http://demos.telerik.com/aspnet-ajax/listview/examples/paging/integratedpaging/defaultcs.aspx 

Right Now it loads the data and my screen will be same as before except with new data,as though nothing happened.

Thanks for checking my post, and I appreciate if someone can help me out on this.

Radoslav
Telerik team
 answered on 26 Oct 2012
3 answers
173 views
<telerik:RadFormDecorator ID="rfd1" EnableEmbeddedSkins="true" EnableAjaxSkinRendering="true" DecoratedControls="Buttons, Scrollbars, Select, Textbox, Textarea"
        Runat="server" Skin="Vista"/>

I have added RadFormDecorator that decorates all the asp:dropdownlist. However, when I tab through the page...it does not highlight/focus on any dropdownlists. Please advice how to fix this!

Thanks!


Bozhidar
Telerik team
 answered on 26 Oct 2012
2 answers
2.3K+ views
heey guys
I got this fu... error but i don't know why I checked every thing in my class and code behind still don't know why ..

Error message Type 'Telerik.Web.UI.GridBoundColumn' does not have a public property named 'Columns'.(Cod Line 41)

Code : 
<%@ Page Title="" Language="C#" MasterPageFile="~/ABBMaster.Master" AutoEventWireup="true" CodeBehind="EmployeGrid.aspx.cs" Inherits="HolidayTracker.Employe.EmployeGrid" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="MainRegionContentPlaceHolder" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadFormDecorator ID="QsfFromDecorator" runat="server" DecoratedControls="All" EnableRoundedCorners="false" />
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadGrid ID="RadGrid1" OnPreRender="RadGrid1_PreRender" ShowStatusBar="True" DataSourceID="SqlDataSource1" runat="server" AutoGenerateColumns="False" PageSize="7"
        AllowSorting="True" AllowPaging="True" GridLines="None" CellSpacing="0">
        <PagerStyle Mode="NumericPages" />
        <MasterTableView DataSourceID="SqlDataSource1" DataKeyNames="DepartmentId" AllowMultiColumnSorting="true">
            <DetailTables>
                <telerik:GridTableView DataKeyNames="UserId" DataSourceID="SqlDataSource2" Width="100%" runat="server">
                    <ParentTableRelation>
                        <telerik:GridRelationFields DetailKeyField="DepartmentId" MasterKeyField="DepartmentId" />
                    </ParentTableRelation>
                    <DetailTables>
                        <telerik:GridTableView DataKeyNames="Name" DataSourceID="SqlDataSource2" Width="100%" runat="server">
                            <ParentTableRelation>
                                <telerik:GridRelationFields DetailKeyField="Name" MasterKeyField="Name" />
                            </ParentTableRelation>
                            <Columns>
                                <telerik:GridBoundColumn SortExpression="FromData" HeaderText="From Date" HeaderButtonType="TextButton" DataField="FromDate"                                                        UniqueName="FromDate">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn SortExpression="ToDate" HeaderText="To Date" HeaderButtonType="TextButton" DataField="ToDate" UniqueName="ToDate">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn SortExpression="WorkingTime" HeaderText="Working Time" HeaderButtonType="TextButton" DataField="WorkingTime"                                                UniqueName="WorkingTime">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn SortExpression="VacationDays" HeaderText="Vacation Days" HeaderButtonType="TextButton" DataField="VacationDays"                                             UniqueName="VacationDays">  
                                </ telerik:GridBoundColumn>
                            </Columns>
                        </telerik:GridTableView>
                    </DetailTables>
                    <Columns>
                        <telerik:GridBoundColumn SortExpression="Name" HeaderText="Name" HeaderButtonType="TextButton" DataField="Name" UniqueName="Name">
                        </telerik:GridBoundColumn>
                   </Columns>
                </telerik:GridTableView>
            </DetailTables>
            <Columns>
                <telerik:GridBoundColumn SortExpression="DepartmentId" HeaderText="DepartmentId" HeaderButtonType="TextButton" DataField="DepartmentId"                                             UniqueName="DepartmentId">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn SortExpression="Name" HeaderText="Department Name" HeaderButtonType="TextButton" DataField="Name" UniqueName="Name">
                </telerik:GridBoundColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:HolidayTrackerConnectionString %>" SelectCommand="SELECT [DepartmentId], [Name] FROM [HtDepartment]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:HolidayTrackerConnectionString %>" SelectCommand="SELECT * FROM [AnnualVacationView] ORDER BY [UserId], [Name]"></asp:SqlDataSource>
</asp:Content>
code behind 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
 
namespace HolidayTracker.Employe
{
    public partial class EmployeGrid : System.Web.UI.Page
    {
           protected void RadGrid1_PreRender(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                RadGrid1.MasterTableView.Items[0].Expanded = true;
                RadGrid1.MasterTableView.Items[0].ChildItem.NestedTableViews[0].Items[0].Expanded = true;
            }
        }
 
    }
}


as always thanks for your help and fast answers ^^ 
Nikola
Top achievements
Rank 2
 answered on 26 Oct 2012
1 answer
162 views
Hi team,
how we can reset the grid setting to the default after loading the saved settings.
we want to have a "Reset" column which return the grid to the default settings.
Regards
Ahmed Salem
Tsvetoslav
Telerik team
 answered on 26 Oct 2012
1 answer
370 views
Hi 

How I can override RadGrid to Data bind a list of ExpandoObjects.

Sample Code :

List<ExpandoObject> viewList = new List<ExpandoObject>();
for (int i = 0; i < 100; i++)
{
    dynamic view = new ExpandoObject();
    var p = view as IDictionary<String, object>;
    p["LatName"] = i * 2;
    p["Name"] = i;
    viewList.Add(view);
}
RadGrid1.DataSource = viewList;
RadGrid1.DataBind();
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" CellSpacing="0"
    GridLines="None">
    <MasterTableView>
        <Columns>
            <telerik:GridBoundColumn DataField="Name" FilterControlAltText="Filter column column"
                  HeaderText="Name" UniqueName="column">
            </telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

Tsvetoslav
Telerik team
 answered on 26 Oct 2012
2 answers
167 views
Hi,
I have a rad grid...
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateSelectColumn="True" CellSpacing="0"
                        GridLines="Horizontal" AutoGenerateColumns="False" OnNeedDataSource="RadGrid1_NeedDataSource"
                        AllowAutomaticUpdates="false" AllowPaging="false" AllowSorting="false" Width="100%">
                        <SortingSettings EnableSkinSortStyles="false" />
                        <MasterTableView DataKeyNames="Code" PageSize="20" Width="100%">
                            <Columns>
                                <telerik:GridTemplateColumn UniqueName="txtQTY" HeaderText="Quantity">
                                    <ItemTemplate>
                                        <asp:TextBox runat="server" ID="QTYtextbox" Width="40px" Enabled="true" Text='<%# Bind("QTY") %>'> </asp:TextBox>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridBoundColumn DataField="Code" HeaderText="Code" UniqueName="Code" FilterControlAltText="Filter Code column"
                                    SortExpression="Code" ItemStyle-Width="50px">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Name" HeaderText="Name" UniqueName="Name" FilterControlAltText="Filter Name column"
                                    SortExpression="Name" ItemStyle-Width="200px">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Units" HeaderText="Units" UniqueName="Units"
                                    FilterControlAltText="Filter Units column" SortExpression="Units" ItemStyle-Width="25px">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="QTY" HeaderText="QTY" UniqueName="colQTY" Visible="True"
                                    ItemStyle-Width="25px">
                                </telerik:GridBoundColumn>
                            </Columns>
                        </MasterTableView>
                    </telerik:RadGrid>

It is populated using data binding and all the columns show data...
Protected Sub RadGrid1_NeedDataSource(sender As Object, e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource
    'Loads Data into the table
    Dim ordlist As New dbrcOrdEst(Session("ConnectionString"))
    Dim dt As DataTable = ordlist.ListOrderEstimates(498)
    RadGrid1.DataSource = dt
End Sub

However what I want to do is take my textbox column, and return the values back into the database, however I can't get data out of the Textboxes, I know how to manipulate the data once I've got it, but I can't get it. This code does what I want on standard columns but not on textbox columns what am I missing 
Protected Sub btnImport_Click(sender As Object, e As System.EventArgs) Handles btnImport.Click
    For Each item As GridDataItem In RadGrid1.Items
        Dim value As String
        value = item.Cells(2).Text
'DB Functionality
    Next
End Sub

Thanks in advance for your help, Ryan 
Tsvetoslav
Telerik team
 answered on 26 Oct 2012
1 answer
430 views
Hi,

I am trying to use the following code to create a hierarchical grid.  It works all the way until the grid is expanded to the UserLocationVendorModel GridView (bolded code below).  This gridview (table) needs two keys (LocationID and VendorName) passed from the selection on the third level.  Could you tell me if I am missing something?  I have attached a screenshot of how the grid is not working on the last level.
 
VB.NET Code:

DefineGridStructure is called in the Page_Load event of the ASP.Net page.

 Private Sub DefineGridStructure()

        Dim RadGrid4 As RadGrid = New RadGrid

        RadGrid4.DataSourceID = "SqlDataSource1"
        RadGrid4.MasterTableView.DataKeyNames = New String() {"LocationID"}
        RadGrid4.Width = Unit.Percentage(100)
        RadGrid4.PageSize = 15
        RadGrid4.AllowPaging = True
        RadGrid4.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric
        RadGrid4.AutoGenerateColumns = False
        RadGrid4.Skin = "Outlook"


        'Add Location table
        RadGrid4.MasterTableView.Width = Unit.Percentage(100)


        Dim boundColumn As GridBoundColumn
        boundColumn = New GridBoundColumn()
        RadGrid4.MasterTableView.Columns.Add(boundColumn)
        boundColumn.DataField = "LocationID"
        boundColumn.HeaderText = "LocationID"
        boundColumn = New GridBoundColumn()
        RadGrid4.MasterTableView.Columns.Add(boundColumn)
        boundColumn.DataField = "Description"
        boundColumn.HeaderText = "Description"
        boundColumn = New GridBoundColumn()
        RadGrid4.MasterTableView.Columns.Add(boundColumn)
        boundColumn.DataField = "ParentId"
        boundColumn.HeaderText = "ParentId"
        boundColumn = New GridBoundColumn()
        RadGrid4.MasterTableView.Columns.Add(boundColumn)
        boundColumn.DataField = "EditStatus"
        boundColumn.HeaderText = "EditStatus"
        boundColumn = New GridBoundColumn()
        RadGrid4.MasterTableView.Columns.Add(boundColumn)
        boundColumn.DataField = "ModificationSeq"
        boundColumn.HeaderText = "ModificationSeq"
        RadGrid4.AllowFilteringByColumn = True


        'Add UserLocation table
        Dim tableUserLocation As New GridTableView(RadGrid4)
        tableUserLocation.DataSourceID = "SqlDataSource2"
        tableUserLocation.DataKeyNames = New String() {"LocationID"}
        tableUserLocation.Width = Unit.Percentage(100)
        Dim relationFields As GridRelationFields = New GridRelationFields()
        relationFields.MasterKeyField = "LocationID"
        relationFields.DetailKeyField = "LocationID"
        tableUserLocation.ParentTableRelation.Add(relationFields)


        RadGrid4.MasterTableView.DetailTables.Add(tableUserLocation)


        'Add Columns
        boundColumn = New GridBoundColumn()
        tableUserLocation.Columns.Add(boundColumn)
        boundColumn.DataField = "LocationID"
        boundColumn.HeaderText = "LocationID"
        boundColumn = New GridBoundColumn()
        tableUserLocation.Columns.Add(boundColumn)
        boundColumn.DataField = "Member"
        boundColumn.HeaderText = "Member"
        boundColumn = New GridBoundColumn()
        tableUserLocation.Columns.Add(boundColumn)
        boundColumn.DataField = "HasChild"
        boundColumn.HeaderText = "HasChild"
        boundColumn = New GridBoundColumn()
        tableUserLocation.Columns.Add(boundColumn)
        boundColumn.DataField = "Kount"
        boundColumn.HeaderText = "Kount"
        boundColumn = New GridBoundColumn()
        tableUserLocation.Columns.Add(boundColumn)
        boundColumn.DataField = "Pct"
        boundColumn.HeaderText = "Pct"
        boundColumn = New GridBoundColumn()
        tableUserLocation.Columns.Add(boundColumn)
        boundColumn.DataField = "TotalCounter"
        boundColumn.HeaderText = "TotalCounter"
        boundColumn = New GridBoundColumn()
        tableUserLocation.Columns.Add(boundColumn)
        boundColumn.DataField = "PrinterCounter"
        boundColumn.HeaderText = "PrinterCounter"
        boundColumn = New GridBoundColumn()
        tableUserLocation.Columns.Add(boundColumn)
        boundColumn.DataField = "CopyCounter"
        boundColumn.HeaderText = "CopyCounter"
        boundColumn = New GridBoundColumn()
        tableUserLocation.Columns.Add(boundColumn)
        boundColumn.DataField = "FaxCounter"
        boundColumn.HeaderText = "FaxCounter"
        boundColumn = New GridBoundColumn()
        tableUserLocation.Columns.Add(boundColumn)
        boundColumn.DataField = "ScanCounter"
        boundColumn.HeaderText = "ScanCounter"


        'Add UserLocationVendor table
        Dim tableUserLocationVendor As New GridTableView(RadGrid4)
        tableUserLocationVendor.DataSourceID = "SqlDataSource3"
        tableUserLocationVendor.DataKeyNames = New String() {"LocationID"}
        tableUserLocationVendor.Width = Unit.Percentage(100)
        Dim relationFields2 As GridRelationFields = New GridRelationFields()


        relationFields2.MasterKeyField = "LocationID"
        relationFields2.DetailKeyField = "LocationID"
        tableUserLocationVendor.ParentTableRelation.Add(relationFields2)
        tableUserLocation.DetailTables.Add(tableUserLocationVendor)


        'Add columns
        boundColumn = New GridBoundColumn()
        tableUserLocationVendor.Columns.Add(boundColumn)
        boundColumn.DataField = "LocationID"
        boundColumn.HeaderText = "LocationID"
        boundColumn = New GridBoundColumn()
        tableUserLocationVendor.Columns.Add(boundColumn)
        boundColumn.DataField = "VendorName"
        boundColumn.HeaderText = "VendorName"
        boundColumn = New GridBoundColumn()
        tableUserLocationVendor.Columns.Add(boundColumn)
        boundColumn.DataField = "Kount"
        boundColumn.HeaderText = "Kount"
        boundColumn = New GridBoundColumn()
        tableUserLocationVendor.Columns.Add(boundColumn)
        boundColumn.DataField = "Pct"
        boundColumn.HeaderText = "Pct"
        boundColumn = New GridBoundColumn()
        tableUserLocationVendor.Columns.Add(boundColumn)
        boundColumn.DataField = "TotalCounter"
        boundColumn.HeaderText = "TotalCounter"
        boundColumn = New GridBoundColumn()
        tableUserLocationVendor.Columns.Add(boundColumn)
        boundColumn.DataField = "PrinterCounter"
        boundColumn.HeaderText = "PrinterCounter"
        boundColumn = New GridBoundColumn()
        tableUserLocationVendor.Columns.Add(boundColumn)
        boundColumn.DataField = "CopyCounter"
        boundColumn.HeaderText = "CopyCounter"
        boundColumn = New GridBoundColumn()
        tableUserLocationVendor.Columns.Add(boundColumn)
        boundColumn.DataField = "FaxCounter"
        boundColumn.HeaderText = "FaxCounter"
        boundColumn = New GridBoundColumn()
        tableUserLocationVendor.Columns.Add(boundColumn)
        boundColumn.DataField = "ScanCounter"
        boundColumn.HeaderText = "ScanCounter"


        'Add UserLocationVendorModel table
        Dim tableUserLocationVendorModel As New GridTableView(RadGrid4)
        tableUserLocationVendorModel.DataSourceID = "SqlDataSource4"
        tableUserLocationVendorModel.DataKeyNames = New String() {"LocationID", "VendorName"}
        tableUserLocationVendorModel.Width = Unit.Percentage(100)
        Dim relationFields3 As GridRelationFields = New GridRelationFields
        relationFields3.MasterKeyField = "LocationID,VendorName"
        relationFields3.DetailKeyField = "LocationID,VendorName"
        tableUserLocationVendorModel.ParentTableRelation.Add(relationFields3)
        tableUserLocationVendor.DetailTables.Add(tableUserLocationVendorModel)



        'Add columns
        boundColumn = New GridBoundColumn()
        tableUserLocationVendorModel.Columns.Add(boundColumn)
        boundColumn.DataField = "LocationID"
        boundColumn.HeaderText = "LocationID"
        boundColumn = New GridBoundColumn()
        tableUserLocationVendorModel.Columns.Add(boundColumn)
        boundColumn.DataField = "VendorName"
        boundColumn.HeaderText = "VendorName"
        boundColumn = New GridBoundColumn()
        tableUserLocationVendorModel.Columns.Add(boundColumn)
        boundColumn.DataField = "ModelName"
        boundColumn.HeaderText = "ModelName"
        boundColumn = New GridBoundColumn()
        tableUserLocationVendorModel.Columns.Add(boundColumn)
        boundColumn.DataField = "Kount"
        boundColumn.HeaderText = "Kount"
        boundColumn = New GridBoundColumn()
        tableUserLocationVendorModel.Columns.Add(boundColumn)
        boundColumn.DataField = "Pct"
        boundColumn.HeaderText = "Pct"
        boundColumn = New GridBoundColumn()
        tableUserLocationVendorModel.Columns.Add(boundColumn)
        boundColumn.DataField = "TotalCounter"
        boundColumn.HeaderText = "TotalCounter"
        boundColumn = New GridBoundColumn()
        tableUserLocationVendorModel.Columns.Add(boundColumn)
        boundColumn.DataField = "PrinterCounter"
        boundColumn.HeaderText = "PrinterCounter"
        boundColumn = New GridBoundColumn()
        tableUserLocationVendorModel.Columns.Add(boundColumn)
        boundColumn.DataField = "CopyCounter"
        boundColumn.HeaderText = "CopyCounter"
        boundColumn = New GridBoundColumn()
        tableUserLocationVendorModel.Columns.Add(boundColumn)
        boundColumn.DataField = "FaxCounter"
        boundColumn.HeaderText = "FaxCounter"
        boundColumn = New GridBoundColumn()
        tableUserLocationVendorModel.Columns.Add(boundColumn)
        boundColumn.DataField = "ScanCounter"
        boundColumn.HeaderText = "ScanCounter"


        Me.PlaceHolder1.Controls.Add(RadGrid4)


End Sub

Aspx Code:


        <telerik:RadGrid ID="RadGrid4" runat="server" gridLines="Both">
             </telerik:RadGrid>
                         
             
                    <div style="width:730px;">
                    <asp:SqlDataSource ID="SqlDataSource1" 
                          ConnectionString="<%$ ConnectionStrings:DSN %>"
                          ProviderName="<%$ ConnectionStrings:DSN.ProviderName %>"
                          SelectCommand="GetLocationsByParentLocationId" runat="server" 
                                    SelectCommandType="StoredProcedure">
                                    <SelectParameters>
                                        <asp:SessionParameter Name="CompanyID" SessionField="CompanyID" />
                                        <asp:SessionParameter Name="LocationID" SessionField="InitialLocationID" />
                                   </SelectParameters>
                    </asp:SqlDataSource>
                    <asp:SqlDataSource ID="SqlDataSource2" 
                          ConnectionString="<%$ ConnectionStrings:DSN %>"
                          ProviderName="<%$ ConnectionStrings:DSN.ProviderName %>"
                          SelectCommand="Report_PopulationByUserLocation_New_Test" runat="server"
                                    SelectCommandType="StoredProcedure">
                                    <SelectParameters>
                                        <asp:SessionParameter Name="aiUserUniqueID" SessionField="UserID" />                                       
                                        <asp:Parameter Name="LocationID" Type="int32" />
                                        <asp:SessionParameter Name="asCompanyID" SessionField="CompanyID" />
                                    </SelectParameters>
                    </asp:SqlDataSource>
                                        <asp:SqlDataSource ID="SqlDataSource3" 
                          ConnectionString="<%$ ConnectionStrings:DSN %>"
                          ProviderName="<%$ ConnectionStrings:DSN.ProviderName %>"
                          SelectCommand="Report_PopulationByUserLocationVendor_New_Test" runat="server"
                                    SelectCommandType="StoredProcedure">
                                    <SelectParameters>
                                        <asp:SessionParameter Name="aiUserUniqueID" SessionField="UserID" />
                                        <asp:Parameter Name="LocationID" Type="int32" />
                                    </SelectParameters>
                    </asp:SqlDataSource>
                                        <asp:SqlDataSource ID="SqlDataSource4" 
                          ConnectionString="<%$ ConnectionStrings:DSN %>"
                          ProviderName="<%$ ConnectionStrings:DSN.ProviderName %>"
                          SelectCommand="Report_PopulationByUserLocationVendorModel_New_Test" runat="server"
                                    SelectCommandType="StoredProcedure">
                                    <SelectParameters>
                                        <asp:SessionParameter Name="aiUserUniqueID" SessionField="UserID" />
                                        <asp:Parameter Name="LocationID" Type="int32" />
                                        <asp:Parameter Name="VendorName" Type="string" />
                                        <asp:SessionParameter Name="asURL" SessionField="URL" />
                                    </SelectParameters>
                    </asp:SqlDataSource>
                    <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
                    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                    </telerik:RadAjaxManager>

Tsvetoslav
Telerik team
 answered on 26 Oct 2012
4 answers
303 views
I'm running into a number of issues trying to do validation of controls in a popup form template of a radGrid:

1) None of my client-side validation funtions are firing
2) I cannot get the NEW value of the radEditor in my server-side custom validation function
3) When the insert form is redisplayed with errors, the content of the radEditor displays the original value, not the new value (changes are lost)

I'm using IE 9.0, and radControls Q3 2012.

This is the code for two of my editor controls that are having an issue (and the update button):
<telerik:RadTextBox ID="rtbTItle" runat="server" Width="400" TextMode="SingleLine" Text='<%# DataBinder.Eval(Container, "DataItem.Title") %>' Skin="WebBlue">
</telerik:RadTextBox>
<asp:RequiredFieldValidator ID="rfvTitle" runat="server" ControlToValidate="rtbTitle"
    ErrorMessage="You must enter a Title" ValidationGroup="vgEditor" ForeColor="Red" Font-Bold="true">*</asp:RequiredFieldValidator>
<asp:CustomValidator ID="cvTitle" runat="server" ControlToValidate="rtbTitle"
    ClientValidationFunction="cvTitle_Validator" OnServerValidate="cvTitle_ServerValidate" EnableClientScript="true"
    ErrorMessage="Title cannot contain 'x'" ValidationGroup="vgEditor" ForeColor="Red" Font-Bold="true">x</asp:CustomValidator>
 
 
<telerik:RadEditor ID="reItemText" runat="server" BorderStyle="None"
    OnClientLoad="reItemText_OnClientLoad" OnClientModeChange="reItemText_OnClientModeChange"
    Width="800" Height="300" AutoResizeHeight="false" EnableResize="false" ToolsWidth="800"
    ContentAreaMode="Div" Skin="WebBlue" Content='<%# DataBinder.Eval(Container, "DataItem.ItemText") %>'>
</telerik:RadEditor>
<asp:CustomValidator ID="cvItemText" runat="server" ControlToValidate="reItemText"
    ClientValidationFunction="cvItemText_Validator" OnServerValidate="cvItemText_ServerValidate" EnableClientScript="true"
    ErrorMessage="Item Text is required" ValidateEmptyText="true" ValidationGroup="vgEditor" ForeColor="Red" Font-Bold="true">*</asp:CustomValidator>
 
 
<asp:Button ID="btnUpdate" runat="server" ValidationGroup="vgEditor" CausesValidation="true" Text='<%# IIf(TypeOf Container is GridEditFormInsertItem, "Insert", "Update") %>' CommandName='<%# IIf(TypeOf Container is GridEditFormInsertItem, "PerformInsert", "Update") %>' />

These are my client-side validation functions (neither of which gets fired):
function cvItemText_Validator( sender, args ) {
  console.log( "cvItemText_Validator" );
}
 
function cvTitle_ServerValidate( sender, args ) {
  console.log( "cvTitle_ServerValidate" );
}

And these are my server-side validation functions:
Protected Sub cvItemText_ServerValidate(source As Object, args As System.Web.UI.WebControls.ServerValidateEventArgs)
    System.Diagnostics.Debug.WriteLine("Admin_ManageNews:cvItemText_ServerValidate")
    System.Diagnostics.Debug.WriteLine(String.Format("  ItemText: {0}", args.Value))
    Dim oItem As GridEditableItem = DirectCast(DirectCast(source, CustomValidator).NamingContainer, GridEditableItem)
    Dim oEditor As RadEditor = DirectCast(oItem.FindControl("reItemText"), RadEditor)
    System.Diagnostics.Debug.WriteLine(String.Format("  ItemText: {0}", oEditor.Content))
 
End Sub
 
Protected Sub cvTitle_ServerValidate(source As Object, args As System.Web.UI.WebControls.ServerValidateEventArgs)
    System.Diagnostics.Debug.WriteLine("Admin_ManageNews:cvTitle_ServerValidate")
    System.Diagnostics.Debug.WriteLine(String.Format("  Title: {0}", args.Value))
    Dim oItem As GridEditableItem = DirectCast(DirectCast(source, CustomValidator).NamingContainer, GridEditableItem)
    Dim oRTB As RadTextBox = DirectCast(oItem.FindControl("rtbTitle"), RadTextBox)
    System.Diagnostics.Debug.WriteLine(String.Format("  Title: {0}", oRTB.Text))
End Sub

Both of the debug statements for the cvTitle validator display the correct value for the Title field, but neither debug statement for the cvItemText validator displays the new values, they display the old value.
Tsvetoslav
Telerik team
 answered on 26 Oct 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?