Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
196 views
Morning,

I have a problem with the delete command on my radgrid. I was getting the error that there was null values and i needed to change "ConflictDetection" to OverwriteChanges". However this problem seems to been fixed by changing many of the Eval() bindings to Bind().

I have some binding in the grid that happens programmatically also.

Now when i hit delete, it attempts to process the command and refreshes the grid and the items remains. No error, it just does not delete the row from the SQLDataSource.

Any help would be greatly appreciated.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Globalization;
using Telerik.Web.UI;
using System.Data;
 
public partial class Admin_WriteUps : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            GridSortExpression expression = new GridSortExpression();
            expression.FieldName = "DateAdded";
            expression.SetSortOrder("Descending");
            RadGrid1.MasterTableView.SortExpressions.AddSortExpression(expression);
        }
    }
 
    #region Validator Methods
 
    protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
    {
        DateTime inputdate = new DateTime();
 
        if (args.Value.Length > 0)
        {
            if (DateTime.TryParseExact(args.Value, "M/d/yyyy", DateTimeFormatInfo.InvariantInfo, DateTimeStyles.None, out inputdate))
            {
                args.IsValid = true;
            }
            else
            {
                args.IsValid = false;
            }
        }
        else
        {
            args.IsValid = false;
        }
    }
 
    #endregion
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem item = (GridDataItem)e.Item;
            Label InsLabel = item.FindControl("InsLabel") as Label;
 
            if (InsLabel != null)
            {
                DataView Insurance_DataView = (DataView)Insurance_DataSource.Select(DataSourceSelectArguments.Empty);
 
                int indx = 0;
                if (Int32.TryParse(((System.Data.DataRowView)(item.DataItem)).Row["Ins"].ToString(), out indx))
                {
                    Insurance_DataView.Sort = "ID";
                    InsLabel.Text = Insurance_DataView[Insurance_DataView.Find(indx)]["Name"].ToString();
                }
                else
                {
                    InsLabel.Text = "";
                }
            }
 
            Label CampaignLabel = item.FindControl("CampaignLabel") as Label;
 
            if (CampaignLabel != null)
            {
                DataView Campaigns_DataView = (DataView)Campaigns_DataSource.Select(DataSourceSelectArguments.Empty);
 
                int indx = 0;
                if (Int32.TryParse(((System.Data.DataRowView)(item.DataItem)).Row["Campaign"].ToString(), out indx))
                {
                    Campaigns_DataView.Sort = "ID";
                    CampaignLabel.Text = Campaigns_DataView[Campaigns_DataView.Find(indx)]["Campaign"].ToString();
                }
                else
                {
                    CampaignLabel.Text = "";
                }
            }
 
            Label CCRepLabel = item.FindControl("CCRepLabel") as Label;
 
            if (CCRepLabel != null)
            {
                DataView CCReps_DataView = (DataView)CCReps_DataSource.Select(DataSourceSelectArguments.Empty);
 
                int indx = 0;
                if (Int32.TryParse(((System.Data.DataRowView)(item.DataItem)).Row["CCRep"].ToString(), out indx))
                {
                    CCReps_DataView.Sort = "ID";
                    CCRepLabel.Text = CCReps_DataView[CCReps_DataView.Find(indx)]["Name"].ToString();
                }
                else
                {
                    CCRepLabel.Text = "";
                }
            }
 
            Label StateLabel = item.FindControl("StateLabel") as Label;
 
            if (StateLabel != null)
            {
                DataView States_DataView = (DataView)States_DataSource.Select(DataSourceSelectArguments.Empty);
 
                int indx = 0;
                if (Int32.TryParse(((System.Data.DataRowView)(item.DataItem)).Row["State"].ToString(), out indx))
                {
                    States_DataView.Sort = "ID";
                    StateLabel.Text = States_DataView[States_DataView.Find(indx)]["StateName"].ToString();
                }
                else
                {
                    StateLabel.Text = "";
                }
            }
        }
    }
 
    protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
    {
        if (e.CommandName == "Delete")
        {
 
        }
    }
}

<%@ Page Title="" Language="C#" MasterPageFile="~/App_Master/Admin.master" AutoEventWireup="true"
    CodeFile="Leads.aspx.cs" Inherits="Admin_WriteUps" Theme="Reports" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class="container_label">
        Add/Update/Delete Lead Records:</div>
    <div>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"
            Skin="Office2007">
        </telerik:RadAjaxLoadingPanel>
        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server"
            HorizontalAlign="NotSet" LoadingPanelID="RadAjaxLoadingPanel1">
            <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True" AllowPaging="True"
                AllowSorting="True" DataSourceID="WriteUps_DataSource" GridLines="None" ShowGroupPanel="True"
                Skin="Office2007" AllowAutomaticDeletes="True"
                AllowAutomaticInserts="True" AllowAutomaticUpdates="True"
                AllowCustomPaging="True" AllowMultiRowSelection="True" AutoGenerateColumns="False"
                AutoGenerateDeleteColumn="True" OnItemDataBound="RadGrid1_ItemDataBound"
                ShowFooter="True" PageSize="25" Width="1200px"
                onitemcommand="RadGrid1_ItemCommand">
                <ExportSettings ExportOnlyData="True" HideStructureColumns="True">
                    <Excel Format="ExcelML" />
                </ExportSettings>
                <PagerStyle AlwaysVisible="True" />
                <MasterTableView CommandItemDisplay="Top" DataKeyNames="ID"
                    DataSourceID="WriteUps_DataSource" EditMode="PopUp" GroupLoadMode="Client"
                    InsertItemPageIndexAction="ShowItemOnCurrentPage">
                    <CommandItemSettings ExportToPdfText="Export to Pdf"
                        ShowExportToExcelButton="True" ShowExportToPdfButton="True" />
                    <Columns>
                        <telerik:GridEditCommandColumn ButtonType="ImageButton">
                        </telerik:GridEditCommandColumn>
                        <telerik:GridTemplateColumn AllowFiltering="False" DataField="DateAdded"
                            DataType="System.DateTime" GroupByExpression="Group By DateAdded desc"
                            HeaderText="Date " SortExpression="DateAdded" UniqueName="DateAdded">
                            <EditItemTemplate>
                                <telerik:RadDatePicker ID="RadDatePicker2" runat="server"
                                    Culture="English (United States)" DbSelectedDate='<%# Bind("DateAdded") %>'
                                    SelectedDate="2010-10-15" Skin="Office2007">
                                    <Calendar Skin="Office2007" UseColumnHeadersAsSelectors="False"
                                        UseRowHeadersAsSelectors="False" ViewSelectorText="x">
                                    </Calendar>
                                    <DatePopupButton HoverImageUrl="" ImageUrl="" />
                                    <DateInput DateFormat="M/d/yyyy" DisplayDateFormat="M/d/yyyy"
                                        SelectedDate="2010-10-15">
                                    </DateInput>
                                </telerik:RadDatePicker>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
                                    ControlToValidate="RadDatePicker2" ErrorMessage="Date Required"
                                    SetFocusOnError="True"></asp:RequiredFieldValidator>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="DateAddedLabel" runat="server"
                                    Text='<%# Bind("DateAdded", "{0:MM/dd/yyyy}") %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="PtName"
                            GroupByExpression="PtName Group By PtName desc" HeaderText="Name"
                            SortExpression="PtName" UniqueName="PtName">
                            <EditItemTemplate>
                                <telerik:RadTextBox ID="RadTextBox1" runat="server" EmptyMessage="Lead Name"
                                    Skin="Office2007" Text='<%# Bind("PtName") %>' Width="125px">
                                </telerik:RadTextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
                                    ControlToValidate="RadTextBox1" ErrorMessage="Name Required"
                                    SetFocusOnError="True"></asp:RequiredFieldValidator>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="PtNameLabel" runat="server" Text='<%# Bind("PtName") %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="Ins" DataType="System.Int32"
                            HeaderText="Insurance" SortExpression="Ins" UniqueName="Ins">
                            <EditItemTemplate>
                                <telerik:RadComboBox ID="RadComboBox1" runat="server"
                                    DataSourceID="Insurance_DataSource" DataTextField="Name" DataValueField="ID"
                                    EmptyMessage="Search for Insurance" MarkFirstMatch="True" NoWrap="True"
                                    SelectedValue='<%# Bind("Ins") %>' Skin="Office2007">
                                </telerik:RadComboBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="InsLabel" runat="server"></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="State" DataType="System.Int32"
                            HeaderText="State" SortExpression="State" UniqueName="State">
                            <EditItemTemplate>
                                <telerik:RadComboBox ID="RadComboBox5" runat="server"
                                    DataSourceID="States_DataSource" DataTextField="StateName" DataValueField="ID"
                                    EmptyMessage="Search for State" MarkFirstMatch="True"
                                    SelectedValue='<%# Bind("State") %>' Skin="Office2007">
                                </telerik:RadComboBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="StateLabel" runat="server"></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn AllowFiltering="False" DataField="CCRep"
                            DataType="System.Int32" HeaderText="Call Center Rep" SortExpression="CCRep"
                            UniqueName="CCRep">
                            <EditItemTemplate>
                                <telerik:RadComboBox ID="RadComboBox3" runat="server"
                                    DataSourceID="CCReps_DataSource" DataTextField="Name" DataValueField="ID"
                                    EmptyMessage="Search for CC Rep" MarkFirstMatch="True" NoWrap="True"
                                    SelectedValue='<%# Bind("CCRep") %>' Skin="Office2007">
                                </telerik:RadComboBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="CCRepLabel" runat="server"></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="Campaign" DataType="System.Int32"
                            HeaderText="Campaign" SortExpression="Campaign" UniqueName="Campaign">
                            <EditItemTemplate>
                                <telerik:RadComboBox ID="RadComboBox2" runat="server"
                                    DataSourceID="Campaigns_DataSource" DataTextField="Campaign"
                                    DataValueField="ID" EmptyMessage="Search for Campaign" MarkFirstMatch="True"
                                    NoWrap="True" SelectedValue='<%# Bind("Campaign") %>' Skin="Office2007">
                                </telerik:RadComboBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="CampaignLabel" runat="server"></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn AllowFiltering="False" DataField="Source"
                            HeaderText="Source" SortExpression="Source" UniqueName="Source">
                            <EditItemTemplate>
                                <telerik:RadComboBox ID="RadComboBox4" runat="server"
                                    SelectedValue='<%# Bind("Source") %>' Skin="Office2007">
                                    <Items>
                                        <telerik:RadComboBoxItem runat="server" Selected="true" Text="Call"
                                            Value="CALL" />
                                        <telerik:RadComboBoxItem runat="server" Text="Chat" Value="CHAT" />
                                        <telerik:RadComboBoxItem runat="server" Text="E-mail" Value="E-MAIL" />
                                        <telerik:RadComboBoxItem runat="server" Text="Walk-In" Value="WALK-IN" />
                                        <telerik:RadComboBoxItem runat="server" Text="Unknown" Value="UNKNOWN" />
                                    </Items>
                                </telerik:RadComboBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="SourceLabel" runat="server" Text='<%# Bind("Source") %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="Outcome" Groupable="False"
                            HeaderText="Outcome" SortExpression="Outcome" UniqueName="Outcome">
                            <EditItemTemplate>
                                <telerik:RadTextBox ID="RadTextBox2" runat="server" EmptyMessage="Lead Outcome"
                                    Height="75px" Skin="Office2007" Text='<%# Bind("Outcome") %>' Width="125px">
                                </telerik:RadTextBox>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
                                    ControlToValidate="RadTextBox2" ErrorMessage="Note Required"
                                    SetFocusOnError="True"></asp:RequiredFieldValidator>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="OutcomeLabel" runat="server" Text='<%# Bind("Outcome") %>'></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                    </Columns>
                    <EditFormSettings>
                        <EditColumn UniqueName="EditCommandColumn1">
                        </EditColumn>
                    </EditFormSettings>
                    <PagerStyle AlwaysVisible="True" />
                </MasterTableView>
                <GroupingSettings ShowUnGroupButton="True" />
                <ClientSettings AllowDragToGroup="True">
                </ClientSettings>
            </telerik:RadGrid>
        </telerik:RadAjaxPanel>
        <br />
    </div>
    <asp:SqlDataSource ID="WriteUps_DataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        InsertCommand="INSERT INTO [WriteUps] ([DateAdded], [PtName], [Ins], [Campaign], [Outcome], [CCRep], [Source], [NumberCalled], [State]) VALUES (@DateAdded, @PtName, @Ins, @Campaign, @Outcome, @CCRep, @Source, @NumberCalled, @State)"
        SelectCommand="SELECT [ID], [DateAdded], [PtName], [Ins], [Campaign], [Outcome], [CCRep], [Source], [NumberCalled], [State] FROM [WriteUps]"
        DeleteCommand="DELETE FROM [WriteUps] WHERE [ID] = @original_ID AND (([DateAdded] = @original_DateAdded) OR ([DateAdded] IS NULL AND @original_DateAdded IS NULL)) AND (([PtName] = @original_PtName) OR ([PtName] IS NULL AND @original_PtName IS NULL)) AND (([Ins] = @original_Ins) OR ([Ins] IS NULL AND @original_Ins IS NULL)) AND (([Campaign] = @original_Campaign) OR ([Campaign] IS NULL AND @original_Campaign IS NULL)) AND (([Outcome] = @original_Outcome) OR ([Outcome] IS NULL AND @original_Outcome IS NULL)) AND (([CCRep] = @original_CCRep) OR ([CCRep] IS NULL AND @original_CCRep IS NULL)) AND (([Source] = @original_Source) OR ([Source] IS NULL AND @original_Source IS NULL)) AND (([NumberCalled] = @original_NumberCalled) OR ([NumberCalled] IS NULL AND @original_NumberCalled IS NULL)) AND (([State] = @original_State) OR ([State] IS NULL AND @original_State IS NULL))"
        UpdateCommand="UPDATE [WriteUps] SET [DateAdded] = @DateAdded, [PtName] = @PtName, [Ins] = @Ins, [Campaign] = @Campaign, [Outcome] = @Outcome, [CCRep] = @CCRep, [Source] = @Source, [NumberCalled] = @NumberCalled, [State] = @State WHERE [ID] = @original_ID AND (([DateAdded] = @original_DateAdded) OR ([DateAdded] IS NULL AND @original_DateAdded IS NULL)) AND (([PtName] = @original_PtName) OR ([PtName] IS NULL AND @original_PtName IS NULL)) AND (([Ins] = @original_Ins) OR ([Ins] IS NULL AND @original_Ins IS NULL)) AND (([Campaign] = @original_Campaign) OR ([Campaign] IS NULL AND @original_Campaign IS NULL)) AND (([Outcome] = @original_Outcome) OR ([Outcome] IS NULL AND @original_Outcome IS NULL)) AND (([CCRep] = @original_CCRep) OR ([CCRep] IS NULL AND @original_CCRep IS NULL)) AND (([Source] = @original_Source) OR ([Source] IS NULL AND @original_Source IS NULL)) AND (([NumberCalled] = @original_NumberCalled) OR ([NumberCalled] IS NULL AND @original_NumberCalled IS NULL)) AND (([State] = @original_State) OR ([State] IS NULL AND @original_State IS NULL))"
        OldValuesParameterFormatString="original_{0}"
        ConflictDetection="CompareAllValues">
        <DeleteParameters>
            <asp:Parameter Name="original_ID" Type="Int32" />
            <asp:Parameter DbType="Date" Name="original_DateAdded" />
            <asp:Parameter Name="original_PtName" Type="String" />
            <asp:Parameter Name="original_Ins" Type="Int32" />
            <asp:Parameter Name="original_Campaign" Type="Int32" />
            <asp:Parameter Name="original_Outcome" Type="String" />
            <asp:Parameter Name="original_CCRep" Type="Int32" />
            <asp:Parameter Name="original_Source" Type="String" />
            <asp:Parameter Name="original_NumberCalled" Type="String" />
            <asp:Parameter Name="original_State" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="DateAdded" DbType="Date" />
            <asp:Parameter Name="PtName" Type="String" />
            <asp:Parameter Name="Ins" Type="Int32" />
            <asp:Parameter Name="Campaign" Type="Int32" />
            <asp:Parameter Name="Outcome" Type="String" />
            <asp:Parameter Name="CCRep" Type="Int32" />
            <asp:Parameter Name="Source" Type="String" />
            <asp:Parameter Name="NumberCalled" Type="String" />
            <asp:Parameter Name="State" Type="Int32" />
            <asp:Parameter Name="original_ID" Type="Int32" />
            <asp:Parameter Name="original_DateAdded" DbType="Date" />
            <asp:Parameter Name="original_PtName" Type="String" />
            <asp:Parameter Name="original_Ins" Type="Int32" />
            <asp:Parameter Name="original_Campaign" Type="Int32" />
            <asp:Parameter Name="original_Outcome" Type="String" />
            <asp:Parameter Name="original_CCRep" Type="Int32" />
            <asp:Parameter Name="original_Source" Type="String" />
            <asp:Parameter Name="original_NumberCalled" Type="String" />
            <asp:Parameter Name="original_State" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="DateAdded" DbType="Date" />
            <asp:Parameter Name="PtName" Type="String" />
            <asp:Parameter Name="Ins" Type="Int32" />
            <asp:Parameter Name="Campaign" Type="Int32" />
            <asp:Parameter Name="Outcome" Type="String" />
            <asp:Parameter Name="CCRep" Type="Int32" />
            <asp:Parameter Name="Source" Type="String" />
            <asp:Parameter Name="NumberCalled" Type="String" />
            <asp:Parameter Name="State" Type="Int32" />
        </InsertParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="CCReps_DataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="SELECT [ID], [Name] FROM [CCReps]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="Insurance_DataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="SELECT [ID], [Name] FROM [Insurance]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="Referral_DataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="SELECT [ID], [Name] FROM [Referral]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="CareLevel_DataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="SELECT [ID], [CareLevel] FROM [CareLevels]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="Campaigns_DataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="SELECT [ID], [Campaign] FROM [Campaigns]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="States_DataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="SELECT [ID], [StateCode], [StateName] FROM [States]"></asp:SqlDataSource>
</asp:Content>
Duncan Evans
Top achievements
Rank 1
 answered on 18 Oct 2010
4 answers
139 views
I have a RadTabStrip linked in with a RadMultipage and for some reason when I bring up the page, all of the pages defined in the RadMultiPage are displayed vertically.

Anyone have any ideas as to what causes this behavior?

Thanks,
Aaron
abonfig
Top achievements
Rank 1
 answered on 18 Oct 2010
0 answers
81 views
I am populating a telerik combo thru ajax JSON....The combobox data is coming back correctly.
However when the page shows up I want
1) The combobox to be populated(which is accomplished by firing ajax call during document ready
2) The Correct element in the combobox to be selected based on the song that is selected.

How do I accomplish #2?
Sunitha
Top achievements
Rank 1
 asked on 18 Oct 2010
2 answers
456 views
Hi people.

Question - so I have a button inside a formtemplate in a radGrid. Based on selections in the formtemplate, hitting this button issues a "Generate" command which then the form posts back and goes to the database to retrieve the data for the specified selections.

It works when you are in "insert" mode but the same FindControl method is not working when the row is an existing row and you are trying to update.

Basically, the Insert/Update as well as this Generate command go off the ItemCommand event so u start off with

GridEditableItem gei = e.Item as GridEditableItem;

The FindControl method is then used for the various controls present in the FormTemplate afterwards.

Am I missing something?

Thanks.

Roland

Roland
Top achievements
Rank 1
 answered on 18 Oct 2010
1 answer
101 views
Hi,
I have a splitter containing  one  radpane (radPaneMain) with the content and another one with an sliding pan (radPanEvent)(radPanEventContro).  When the user resize the radPanEvent , an extra space is add to the Height of the panel, which cause the panel to be over the panel's button.

Here's my code:

 

 

<telerik:RadSplitter ID="radSplitter" runat="server" Skin="Sitefinity" EnableEmbeddedBaseStylesheet="false"

 

 

 

Width="985px" EnableEmbeddedSkins="false" PanesBorderSize="1" BorderSize="1" Height="600px"

 

 

 

BorderColor="#F4F4F4" Orientation="Horizontal"

 

 

 

>

 

 

 

<telerik:RadPane ID="radPaneMain" runat="server" Scrolling="Y" CssClass="ApplyPosition" >

 

 

 

<asp:ContentPlaceHolder ID="Main" runat="server" />

 

 

 


</
telerik:RadPane>

 

 

 

<telerik:RadSplitBar runat="server" />

 

 

 

<telerik:RadPane ID="radPanEvent" runat="server" Height="22" Scrolling="None" >

 

 

 

<telerik:RadSlidingZone ID="radSlidingZone" runat="server" SlideDirection="Top" ClickToOpen="true">

 

 

 

<telerik:RadSlidingPane ID="radPanEventSliding" OnClientResized="afterResize" runat="server"

 

 

 

EnableDock="false" Scrolling="None" >

 

 

 

<div id="divEventViewer">

 

 

 

<div id="silverlightEventViewerHost">

 

 

 

<object id="silverlightEventControl" width="100%" height="100%" data="data:application/x-silverlight-2,"

 

 

 

type="application/x-silverlight-2">

 

 

 

 

 

 

<a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50524.0" style="text-decoration: none">

 

 

 

<img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight"

 

 

 

style="border-style: none" />

 

 

 

</a>

 

 

 

</object>

 

 

 

</div>

 

 

 

</div>

 

 

 

</telerik:RadSlidingPane>

 

 

 

</telerik:RadSlidingZone>

 

 

 

</telerik:RadPane>

 

 

 

</telerik:RadSplitter>

 

Dobromir
Telerik team
 answered on 18 Oct 2010
3 answers
701 views
Dear All,

          Am using radgrid, using dataset fill the grid. i need more than 1 lakhs records to display. My pagesize of rad grid is 5. It is very slow when loading grid then after change the 2nd page then its take too time. every action in grid its take time.

So i want to take first  10 records on load grid and then second page  then load another 10 records from database. how to customize in the radgrid. I think rad grid load 1 lakhs record every time from database but user only need 10 or 20 records or some other thing.

If i set pagesize is 10 then radgrid load only 10 records from database, if i change 50 records then grid load 50 rows only load from DB.
please provide with right example. thanks.
Pavlina
Telerik team
 answered on 18 Oct 2010
1 answer
103 views
Captcha autoplays audio when the page loads.  Is there anyway to stop this? We'd like the audio to only play when they click the link.. 

You can see/hear the behavior here:
http://demos.telerik.com/aspnet-ajax/captcha/examples/captchaaudiocode/defaultcs.aspx

Thanks,
Paul
Pero
Telerik team
 answered on 18 Oct 2010
2 answers
213 views
Dear Forum User,
I am getting pretty frustrated on this issues with Page Indexing and Page Sizing in the Detail Tables. When I clicked the Page index or Page Size, then the grid just keep collapsing. Please see image. I'm not using NeedDataSource. I have tried detailtabledatabind, itemcommand, itemdatabound etc but still not working.
Please help me, it is urgent. (Trying to use the support ticket but I guess they are down since it keeps leading me to Error Page cannot be found).
This is my complete code:
<%@ Page Title="" Language="VB" MasterPageFile="~/Main.master" AutoEventWireup="false" CodeFile="AddFunding.aspx.vb" Inherits="AddFunding" %>
  
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
         
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" 
        Height="75px" Width="75px" InitialDelayTime="500" MinDisplayTime="250">
    </telerik:RadAjaxLoadingPanel>
      
    <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGridFunding">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGridFunding" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
</telerik:RadAjaxManagerProxy
  
    <h3>Line Item Details for PO #<span id="ponum" runat="server" ></span></h3>
<div>
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Width="100%" >   
<table>
    <tr>
        <td align="right">
        </td>
    </tr>
    <tr>
        <td>
            <telerik:RadGrid ID="RadGridFunding" runat="server" DataSourceID="SqlDsLineItem" 
                GridLines="None" AutoGenerateColumns="False" AllowPaging="True" PageSize="3" AllowMultiRowSelection="False" 
                AllowSorting="True" >
                <MasterTableView HierarchyDefaultExpanded="false" 
                    InsertItemPageIndexAction="ShowItemOnFirstPage" HierarchyLoadMode="Client" 
                    Name="Main" Width="100%" DataKeyNames="LineItemNumber" 
                    DataSourceID="SqlDsLineItem">
                    <DetailTables>
                        <telerik:GridTableView runat="server" HierarchyDefaultExpanded="false" CommandItemDisplay="Top" Name="Detail" AllowPaging="true" 
                            DataKeyNames="FundingID" DataSourceID="SqlDsFunding" AllowAutomaticUpdates="true" AllowAutomaticInserts="true" >
                            <ParentTableRelation>
                                <telerik:GridRelationFields DetailKeyField="LineItemNumber" MasterKeyField="LineItemNumber" />
                            </ParentTableRelation>
                            <RowIndicatorColumn>
                            <HeaderStyle Width="20px"></HeaderStyle>
                            </RowIndicatorColumn>
                            <ExpandCollapseColumn Visible="True">
                            <HeaderStyle Width="20px"></HeaderStyle>
                            </ExpandCollapseColumn>
                            <CommandItemSettings ExportToPdfText="Export to Pdf" />
                            <Columns>
                                <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                                    <HeaderStyle Width="20px" />
                                </telerik:GridEditCommandColumn>
                                <telerik:GridTemplateColumn HeaderText="Funding Id" SortExpression="FundingId" UniqueName="FundingId" >
                                    <ItemTemplate>
                                        <asp:Label runat="server" ID="lblFundingId" Text='<%# Eval("FundingId") %>' ></asp:Label>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn HeaderText="Line Item Number" SortExpression="LineItemNumber" UniqueName="LineItemNumber" >
                                    <ItemTemplate>
                                        <asp:Label runat="server" ID="lblLineItemNumber" Text='<%# Eval("LineItemNumber") %>' ></asp:Label>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <span><telerik:RadTextBox runat="server" ID="txtRadLineItemNumber" Text='<%# Bind("LineItemNumber") %>' Width="100px" Skin="Default" ReadOnly="true" ></telerik:RadTextBox></span>
                                    </EditItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridDropDownColumn DataField="OperatingUnit" DataSourceID="SqlDsOpUnit"
                                    HeaderText="Operating Unit" ListTextField="operatingUnitId" ListValueField="operatingUnitId"
                                    UniqueName="OperatingUnit" >
                                </telerik:GridDropDownColumn>
                                <telerik:GridTemplateColumn HeaderText="Account Number" SortExpression="AccountNumber" UniqueName="AccountNumber" >
                                    <ItemTemplate>
                                        <asp:Label runat="server" ID="lblAccountNumber" Text='<%# Eval("AccountNumber") %>' ></asp:Label>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <span><telerik:RadTextBox runat="server" ID="txtRadAccountNumber" Text='<%# Bind("AccountNumber") %>' Width="100px" Skin="Default" ></telerik:RadTextBox></span>
                                    </EditItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridDropDownColumn DataField="Department" DataSourceID="SqlDsDept"
                                    HeaderText="Department" ListTextField="DepartmentId" ListValueField="DepartmentId"
                                    UniqueName="Department" >
                                </telerik:GridDropDownColumn>
                                <telerik:GridTemplateColumn HeaderText="Budget Reference" SortExpression="BudgetReference" UniqueName="BudgetReference" >
                                    <ItemTemplate>
                                        <asp:Label runat="server" ID="lblBudgetReference" Text='<%# Eval("BudgetReference") %>' ></asp:Label>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <span><telerik:RadTextBox runat="server" ID="txtRadBudgetReference" Text='<%# Bind("BudgetReference") %>' Width="100px" Skin="Default" ></telerik:RadTextBox></span>
                                    </EditItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn HeaderText="Allocated Amount" SortExpression="AllocatedAmount" UniqueName="AllocatedAmount">
                                    <ItemTemplate>
                                        <asp:Label runat="server" ID="lblAllocatedAmount" Text='<%# Eval("AllocatedAmount", "{0:C}") %>'></asp:Label>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <span><telerik:RadNumericTextBox runat="server" ID="txtRadAllocatedAmount" DbValue='<%# Bind("AllocatedAmount") %>' Width="100px" Skin="Default" ></telerik:RadNumericTextBox>
                                        <span style="color: Red">
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="txtRadAllocatedAmount"
                                                ErrorMessage="*" runat="server">
                                                </asp:RequiredFieldValidator></span>
                                    </EditItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn HeaderText="" SortExpression="UpdatedDate" UniqueName="UpdatedDate" Visible="false" ReadOnly="true">
                                    <ItemTemplate>
                                        <asp:Label runat="server" ID="lblUpdatedDate" Text='<%# Eval("UpdatedDate", "{0:d}") %>' Visible="false" ></asp:Label>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <span><telerik:RadTextBox runat="server" ID="txtRadUpdatedDate" Text='<%# Bind("UpdatedDate") %>' Width="100px" Skin="Default" Visible="false" ReadOnly="true"></telerik:RadTextBox></span>
                                    </EditItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn HeaderText="" SortExpression="UpdatedBy" UniqueName="UpdatedBy" Visible="false" ReadOnly="true">
                                    <ItemTemplate>
                                        <asp:Label runat="server" ID="lblUpdatedBy" Text='<%# Eval("UpdatedBy") %>' Visible="false" ></asp:Label>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <span><telerik:RadTextBox runat="server" ID="txtRadUpdatedBy" Text='<%# Bind("UpdatedBy") %>' Visible="false" ReadOnly="true"></telerik:RadTextBox></span>
                                    </EditItemTemplate>
                                </telerik:GridTemplateColumn>
                            </Columns>
                        <EditFormSettings>
                            <EditColumn ButtonType="ImageButton"/>
                        </EditFormSettings>
                        </telerik:GridTableView>
                    </DetailTables>
                    <RowIndicatorColumn>
                    <HeaderStyle Width="20px"></HeaderStyle>
                    </RowIndicatorColumn>
                    <CommandItemSettings ExportToPdfText="Export to Pdf" />
                    <ExpandCollapseColumn Visible="True">
                    <HeaderStyle Width="20px"></HeaderStyle>
                    </ExpandCollapseColumn>
                    <Columns>
                        <telerik:GridBoundColumn DataField="LineItemNumber" DataType="System.Int64" 
                            HeaderText="Line Item Number" SortExpression="LineItemNumber" 
                            UniqueName="LineItemNumber">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="PartName" HeaderText="Part Name" 
                            SortExpression="PartName" UniqueName="PartName">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="PartNumber" HeaderText="Part#" 
                            SortExpression="PartNumber" UniqueName="PartNumber">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="UnitPrice" DataType="System.Double" DataFormatString="{0:c}" 
                            HeaderText="Unit Price" SortExpression="UnitPrice" UniqueName="UnitPrice">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="QUANTITYORDERED" DataType="System.Int64" 
                            HeaderText="Qty Ordered" SortExpression="QUANTITYORDERED" 
                            UniqueName="QUANTITYORDERED">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="TotalCost" DataType="System.Double" DataFormatString="{0:c}" 
                            HeaderText="Total Cost" ReadOnly="True" SortExpression="TotalCost" 
                            UniqueName="TotalCost">
                        </telerik:GridBoundColumn>
                    </Columns>
                </MasterTableView>
                <ClientSettings AllowExpandCollapse="true" EnableRowHoverStyle="true">
                    <Selecting AllowRowSelect="True" />
                </ClientSettings>
            </telerik:RadGrid>
        </td>
    </tr>
</table>         
 
      
      
    <asp:SqlDataSource ID="SqlDsLineItem" runat="server" ConnectionString="<%$ ConnectionStrings:ServiceDeskConnectionString %>" 
        SelectCommand="SELECT [LineItemNumber], [PartName], [PartNumber], [UnitPrice], [QUANTITYORDERED], [TotalCost] FROM [vw_Funding] WHERE ([PONumber] = @PONumber) ORDER BY [LineItemNumber]">
        <SelectParameters>
            <asp:QueryStringParameter Name="PONumber" QueryStringField="id" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
      
    <asp:SqlDataSource ID="SqlDsFunding" runat="server" ConnectionString="<%$ ConnectionStrings:ServiceDeskConnectionString %>" 
        SelectCommand="SELECT FundingId, LineItemNumber, OperatingUnit, AccountNumber, Department, BudgetReference, AllocatedAmount, InsertedDate, InsertedBy, UpdatedDate, UpdatedBy FROM PurchaseOrderFunding WHERE (LineItemNumber = @LineItemNumber) ORDER BY LineItemNumber" 
        DeleteCommand="DELETE FROM [PurchaseOrderFunding] WHERE [FundingId] = @FundingId" 
        InsertCommand="INSERT INTO PurchaseOrderFunding(LineItemNumber, OperatingUnit, AccountNumber, Department, BudgetReference, AllocatedAmount, InsertedDate, InsertedBy, UpdatedDate, UpdatedBy) VALUES (@LineItemNumber, @OperatingUnit, @AccountNumber, @Department, @BudgetReference, @AllocatedAmount, GETDATE(), @InsertedBy, GETDATE(), @UpdatedBy)" 
        UpdateCommand="UPDATE PurchaseOrderFunding SET LineItemNumber = @LineItemNumber, OperatingUnit = @OperatingUnit, AccountNumber = @AccountNumber, Department = @Department, BudgetReference = @BudgetReference, AllocatedAmount = @AllocatedAmount, UpdatedDate = GETDATE(), UpdatedBy = @UpdatedBy WHERE (FundingId = @FundingId)" >
        <SelectParameters>
            <asp:SessionParameter Name="LineItemNumber" SessionField="LineItemNumber" Type="Int32" />
        </SelectParameters>
        <DeleteParameters>
            <asp:Parameter Name="FundingId" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="LineItemNumber" Type="Int32" />
            <asp:Parameter Name="OperatingUnit" Type="String" />
            <asp:Parameter Name="AccountNumber" Type="String" />
            <asp:Parameter Name="Department" Type="String" />
            <asp:Parameter Name="BudgetReference" Type="String" />
            <asp:Parameter Name="AllocatedAmount" Type="Decimal" />
            <asp:SessionParameter Name="UpdatedBy" Type="String" SessionField="UserName" />
            <asp:Parameter Name="FundingId" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="LineItemNumber" Type="Int32" />
            <asp:Parameter Name="OperatingUnit" Type="String" />
            <asp:Parameter Name="AccountNumber" Type="String" />
            <asp:Parameter Name="Department" Type="String" />
            <asp:Parameter Name="BudgetReference" Type="String" />
            <asp:Parameter Name="AllocatedAmount" Type="Decimal" />
            <asp:SessionParameter Name="InsertedBy" Type="String" SessionField="UserName" />
            <asp:SessionParameter Name="UpdatedBy" Type="String" SessionField="UserName" />
        </InsertParameters>
        </asp:SqlDataSource>        
    <br />
    <asp:SqlDataSource ID="SqlDsOpUnit" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ServiceDeskConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:ServiceDeskConnectionString.ProviderName %>" 
        SelectCommand="SELECT DISTINCT operatingUnitId FROM PurchaseOrderOperatingUnit ORDER BY operatingUnitId">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDsDept" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ServiceDeskConnectionString %>" 
        SelectCommand="SELECT DISTINCT departmentId FROM PurchaseOrderDepartment ORDER BY departmentId">
    </asp:SqlDataSource>
</telerik:RadAjaxPanel>
</div>
  
</asp:Content>
  
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        ponum.InnerHtml = Request.QueryString("id")
  
        If Not IsPostBack Then
            'Setting Selected index prior to binding RadGrid:
            'If the index is in detail table, parent items will be expanded
            'automatically 
            'RadGridFunding.SelectedIndexes.Add(1, 0, 1, 0, 1)
            'Index of 1, 0, 1, 0, 0 means:
            '1 - item with index 1 in MasterTableView
            '0 - detail table with index 0
            '1 - second (index 1) item in the detail table
            '0 - 0 sub-detail
            '1 - sub detail item with index 1
        End If
    End Sub
  
    Protected Sub RadGridFunding_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGridFunding.PreRender
        If Not Page.IsPostBack Then
            RadGridFunding.MasterTableView.Items(0).Expanded = False
            'RadGridFunding.MasterTableView.Items(0).ChildItem.NestedTableViews(0).Items(0).Expanded = False
  
        End If
    End Sub
  
    Protected Sub RadGridFunding_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGridFunding.ItemDataBound
        If "Detail".Equals(e.Item.OwnerTableView.Name) Then
            If (TypeOf e.Item Is GridEditFormInsertItem) Then
                ' hide the control in insert mode
                If TypeOf e.Item Is GridEditFormInsertItem AndAlso e.Item.IsInEditMode Then
                    If e.Item.OwnerTableView.IsItemInserted Then
                        Dim edititem As GridEditFormInsertItem = DirectCast(e.Item, GridEditFormInsertItem)
                        edititem("LineItemNumber").Parent.Visible = False
                    End If
                End If
            End If
        End If
    End Sub
  
    Private Sub RadGridFunding_PageIndexChanged(ByVal source As Object, ByVal e As Telerik.Web.UI.GridPageChangedEventArgs) Handles RadGridFunding.PageIndexChanged
        RadGridFunding.Rebind()
        RadGridFunding.Visible = True
    End Sub
  
    Protected Sub RadGridFunding_PageSizeChanged(ByVal source As Object, ByVal e As Telerik.Web.UI.GridPageSizeChangedEventArgs) Handles RadGridFunding.PageSizeChanged
        RadGridFunding.Rebind()
        RadGridFunding.Visible = True
    End Sub
  
    Protected Sub RadGridFunding_ItemUpdated(ByVal source As Object, ByVal e As Telerik.Web.UI.GridUpdatedEventArgs) Handles RadGridFunding.ItemUpdated
        Dim item As String = getItemName(e.Item.OwnerTableView.Name)
        Dim field As String = getFieldName(e.Item.OwnerTableView.Name)
        If Not e.Exception Is Nothing Then
            e.KeepInEditMode = True
            e.ExceptionHandled = True
            DisplayMessage(" " + item + " " + e.Item(field).Text + " Data cannot be updated. Reason: " + e.Exception.Message)
        Else
            DisplayMessage(" " + item + " " + e.Item(field).Text + " Data has been successfully updated.")
        End If
    End Sub
  
    Protected Sub RadGridFunding_ItemInserted(ByVal source As Object, ByVal e As GridInsertedEventArgs) Handles RadGridFunding.ItemInserted
        Dim item As String = getItemName(e.Item.OwnerTableView.Name)
        Dim field As String = getFieldName(e.Item.OwnerTableView.Name)
        If Not e.Exception Is Nothing Then
            e.KeepInInsertMode = True
            e.ExceptionHandled = True
            DisplayMessage(" " + item + " " + e.Item(field).Text + " Data cannot be inserted. Reason: " + e.Exception.Message)
        Else
            DisplayMessage(" " + item + " " + e.Item(field).Text + " Data has been successfully inserted.")
        End If
    End Sub
  
    Protected Sub RadGridFunding_InsertCommand(ByVal source As Object, ByVal e As GridCommandEventArgs) Handles RadGridFunding.InsertCommand
       If "Detail".Equals(e.Item.OwnerTableView.Name) Then
            Dim parentItem As GridDataItem = DirectCast(e.Item.OwnerTableView.ParentItem, GridDataItem)
            SqlDsFunding.InsertParameters("LineItemNumber").DefaultValue = parentItem.OwnerTableView.DataKeyValues(parentItem.ItemIndex)("LineItemNumber").ToString()
        End If
    End Sub
  
    Private Function getItemName(ByVal tableName As String) As String
       Select Case tableName
            Case ("Main")
                Return "LineItemNumber"
            Case ("Detail")
                Return "LineItemNumber"
            Case Else
                Return ""
        End Select
    End Function
  
    Private Function getFieldName(ByVal tableName As String) As String
        Select Case tableName
            Case ("Main")
                Return "LineItemNumber"
            Case ("Detail")
                Return "LineItemNumber"
            Case Else
                Return ""
        End Select
    End Function
  
    Private Sub DisplayMessage(ByVal text As String)
        RadGridFunding.Controls.Add(New LiteralControl(String.Format("<span style='color:red'>{0}</span>", text)))
    End Sub
Thank you very much.
illumination
Top achievements
Rank 2
 answered on 18 Oct 2010
2 answers
100 views
Hi,

If I add some text into the HTML editor of the Editor web part like this:

<p>some text</p>

Then switch to the design view and back again, the <p> tags get stripped from the content.

Is this by design?

Thanks
David Stretch
Top achievements
Rank 1
 answered on 18 Oct 2010
0 answers
69 views
have a combox with multiple columns and it acts as filter for radgrid.My issue is how do i insert the selected combobox contents  to another table in database.
sindhu1
Top achievements
Rank 1
 asked on 18 Oct 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?