Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
145 views
I have worked according to the demo example for adding a Context menu to my tree view,
however when i add items to it the text is centered in the context menu.

I cant see that I have done anything differently from the demo and there the text is align to the left.

How can I align the text in the context menu to the left?
Yana
Telerik team
 answered on 04 Nov 2010
1 answer
103 views
Hi,
I have Rad Grid with hidden fields and some of them modified by javascript. During postback the values in the modified by the javascript code are not stored correctly, they are the original bind values. Is there a way to keep this values because I need them

Thanks,
Marin
Radoslav
Telerik team
 answered on 04 Nov 2010
1 answer
141 views

We would to follow the customizing of the pager for the RadGrid as shown in the example on this url:


http://demos.telerik.com/aspnet-ajax/grid/examples/programming/customizingpager/defaultcs.aspx

However, using this code, the MyPager class doesn't cause the PageIndexChanged event to be fired. We have some validations on the Page index changed based on which the event can be cancelled or allowed. I would like to know how to implement this functionality.

Iana Tsolova
Telerik team
 answered on 04 Nov 2010
2 answers
260 views
Hi,

I would like to use the RadDatePicker to allow the user to select a date. Is there a way to allow only the first day of the month to be selected in the calender and in the textbox?

best regards,
Chris Vrolijk
Chris Vrolijk
Top achievements
Rank 1
Iron
 answered on 04 Nov 2010
1 answer
85 views
Afternoon,

I have something weird going on here and need a second pair of eyes to maybe show me something i am missing or possible causes of this.

Basically the issues is as follows. The RadGrid works perfectly, Insert, Updates, Deletes... Then when i get to the 3rd page of the RadGrid about halfway down the rows, weird things start happening.

1) When i hit the edit button the popup window appears at the top of the rows, i have to scroll up to see it. On all other pages it popsup at the scroll position

2) Updating any field of the records from this particular record onward do not work. The popup window does disapear after clicking the update link. Attempting to update records before this point of the page work as normal. Nothing is out of the ordinary with the table data or this particulars rows data, no special characters that might cause a break in the RadGrid. The SqlDataSource is fine as it works correctly on other pages of the RadGrid.

Has anyone seen this behavior before? What is going on here?

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 GridEditableItem && e.Item.IsInEditMode)
        {
            GridEditableItem item = (GridEditableItem)e.Item;
 
            RadDatePicker RadDatePicker2 = item.FindControl("RadDatePicker2") as RadDatePicker;
 
            if (e.Item.OwnerTableView.IsItemInserted)
            {
                //item is about to be inserted
                RadDatePicker2.Enabled = true;
                RadDatePicker2.SelectedDate = DateTime.Now;
            }
            else
            {
                RadDatePicker2.Enabled = false;
            }
        }
        else 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">
 
    <script type="text/javascript">
        function onRequestStart(sender, args) {
            if (args.get_eventTarget().indexOf("ExportToExcelButton") >= 0 ||
                    args.get_eventTarget().indexOf("ExportToWordButton") >= 0 ||
                    args.get_eventTarget().indexOf("ExportToCsvButton") >= 0) {
                args.set_enableAjax(false);
            }
        }
    </script>
 
    <br />
    <div class="container_label">
        Add/Update/Delete Lead Records:</div>
    <div>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Office2007">
        </telerik:RadAjaxLoadingPanel>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <ClientEvents OnRequestStart="onRequestStart" />
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True" AllowSorting="True"
            DataSourceID="WriteUps_DataSource" GridLines="None" ShowGroupPanel="True" Skin="Office2007"
            AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True"
            AllowMultiRowSelection="True" AutoGenerateColumns="False" AutoGenerateDeleteColumn="True"
            OnItemDataBound="RadGrid1_ItemDataBound" Width="1400px" OnItemCommand="RadGrid1_ItemCommand"
            Height="800px" AllowPaging="True" PageSize="100" ShowFooter="True">
            <ExportSettings ExportOnlyData="True" HideStructureColumns="True" FileName="Leads"
                IgnorePaging="True" OpenInNewWindow="True">
            </ExportSettings>
            <MasterTableView CommandItemDisplay="Top" DataKeyNames="ID" DataSourceID="WriteUps_DataSource"
                EditMode="PopUp" GroupLoadMode="Client" InsertItemPageIndexAction="ShowItemOnCurrentPage">
                <CommandItemSettings ExportToPdfText="Export to Pdf" ShowExportToExcelButton="True" />
                <GroupByExpressions>
                    <telerik:GridGroupByExpression>
                        <SelectFields>
                            <telerik:GridGroupByField FieldAlias="Leads" FieldName="DateAdded" FormatString="{0:D}"
                                HeaderValueSeparator=" on: "></telerik:GridGroupByField>
                        </SelectFields>
                        <GroupByFields>
                            <telerik:GridGroupByField FieldName="DateAdded" SortOrder="Descending"></telerik:GridGroupByField>
                        </GroupByFields>
                    </telerik:GridGroupByExpression>
                </GroupByExpressions>
                <Columns>
                    <telerik:GridEditCommandColumn ButtonType="ImageButton" HeaderStyle-Width="30">
                        <HeaderStyle Width="30px" />
                    </telerik:GridEditCommandColumn>
                    <telerik:GridTemplateColumn AllowFiltering="False" DataField="DateAdded" DataType="System.DateTime"
                        GroupByExpression="DateAdded Group By DateAdded desc" HeaderText="Date" SortExpression="DateAdded"
                        UniqueName="DateAdded" HeaderStyle-Width="80">
                        <EditItemTemplate>
                            <telerik:RadDatePicker ID="RadDatePicker2" runat="server" Culture="English (United States)"
                                DbSelectedDate='<%# Bind("DateAdded") %>' Skin="Office2007" ShowPopupOnFocus="True">
                                <Calendar Skin="Office2007" UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False"
                                    ViewSelectorText="x">
                                </Calendar>
                                <DatePopupButton HoverImageUrl="" ImageUrl="" />
                                <DateInput DateFormat="M/d/yyyy" DisplayDateFormat="M/d/yyyy">
                                </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>
                        <HeaderStyle Width="80px" />
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn DataField="PtName" HeaderText="Name" SortExpression="PtName"
                        UniqueName="PtName" Groupable="False">
                        <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" GroupByExpression="Ins Group By Ins desc">
                        <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"
                                Sort="Ascending" ItemStyle-Wrap="false" HeaderStyle-Width="200" AppendDataBoundItems="True">
                                <Items>
                                    <telerik:RadComboBoxItem Selected="true" />
                                </Items>
                            </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" GroupByExpression="State Group By State desc"
                        HeaderStyle-Width="120">
                        <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"
                                Sort="Ascending" AppendDataBoundItems="True">
                                <Items>
                                    <telerik:RadComboBoxItem Selected="true" />
                                </Items>
                            </telerik:RadComboBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="StateLabel" runat="server"></asp:Label>
                        </ItemTemplate>
                        <HeaderStyle Width="120px" />
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn AllowFiltering="False" DataField="CCRep" DataType="System.Int32"
                        HeaderText="Call Center Rep" SortExpression="CCRep" UniqueName="CCRep" GroupByExpression="CCRep Group By CCRep desc"
                        HeaderStyle-Width="100">
                        <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" Sort="Ascending"
                                AppendDataBoundItems="True">
                                <Items>
                                    <telerik:RadComboBoxItem Selected="true" />
                                </Items>
                            </telerik:RadComboBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="CCRepLabel" runat="server"></asp:Label>
                        </ItemTemplate>
                        <HeaderStyle Width="100px" />
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn DataField="Campaign" DataType="System.Int32" HeaderText="Campaign"
                        SortExpression="Campaign" UniqueName="Campaign" ItemStyle-Wrap="false" HeaderStyle-Width="200"
                        GroupByExpression='Campaign Group By Campaign desc'>
                        <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"
                                Sort="Ascending" AppendDataBoundItems="True">
                                <Items>
                                    <telerik:RadComboBoxItem Selected="true" />
                                </Items>
                            </telerik:RadComboBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="CampaignLabel" runat="server"></asp:Label>
                        </ItemTemplate>
                        <HeaderStyle Width="200px" />
                        <ItemStyle Wrap="False" />
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn AllowFiltering="False" DataField="Source" HeaderText="Source"
                        SortExpression="Source" UniqueName="Source" GroupByExpression="Source Group By Source desc"
                        HeaderStyle-Width="75">
                        <EditItemTemplate>
                            <telerik:RadComboBox ID="RadComboBox4" runat="server" SelectedValue='<%# Bind("Source") %>'
                                Skin="Office2007" Sort="Ascending">
                                <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>
                        <HeaderStyle Width="75px" />
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn DataField="Outcome" Groupable="False" HeaderText="Outcome"
                        SortExpression="Outcome" UniqueName="Outcome" ItemStyle-Wrap="False">
                        <EditItemTemplate>
                            <telerik:RadTextBox ID="RadTextBox2" runat="server" EmptyMessage="Enter Lead Outcome"
                                Height="75px" Skin="Office2007" Text='<%# Bind("Outcome") %>' Width="200px" TextMode="MultiLine">
                            </telerik:RadTextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="OutcomeLabel" runat="server" Text='<%# Bind("Outcome") %>'></asp:Label>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                </Columns>
                <EditFormSettings>
                    <EditColumn UniqueName="EditCommandColumn1">
                    </EditColumn>
                </EditFormSettings>
            </MasterTableView>
            <GroupingSettings ShowUnGroupButton="True" />
            <ClientSettings AllowDragToGroup="True" EnableRowHoverStyle="true">
                <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                <Selecting AllowRowSelect="false" EnableDragToSelectRows="false" />
            </ClientSettings>
        </telerik:RadGrid>
        <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" 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" />
        </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] ORDER BY [Name]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="Insurance_DataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="SELECT [ID], [Name] FROM [Insurance] ORDER BY [Name]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="Referral_DataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="SELECT [ID], [Name] FROM [Referral] ORDER BY [Name]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="CareLevel_DataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="SELECT [ID], [CareLevel] FROM [CareLevels] ORDER BY [CareLevel]">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="Campaigns_DataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="SELECT [ID], [Campaign] FROM [Campaigns] ORDER BY [Campaign]">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="States_DataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        SelectCommand="SELECT [ID], [StateCode], [StateName] FROM [States] ORDER BY [StateName]">
    </asp:SqlDataSource>
</asp:Content>
Iana Tsolova
Telerik team
 answered on 04 Nov 2010
4 answers
560 views
Hi there,

I use the radasyncupload control in my website, it works fine on IE. But when I try it on Firefox, a HTTP 302 error is given and the upload shows up failed. The client functions (onClientFileSelected, OnClientFileUploadFailed etc.) are not fired, so I have no idea what is going wrong. How can I debug this? Do you know why the http 302 occurs?

Also, on Chrome clicking the button has no effect.

Any idea how to fix this?
Thank you,
Niels
Niels
Top achievements
Rank 1
 answered on 04 Nov 2010
3 answers
81 views
Hi,

We are using Q3 2009, and are using the image manager and are simply assigning the UploadPaths, DeletePaths and ViewPaths to ~/Imges which exists on the server and all permissions are correct for read write. testing is taking place in Firefox 3.5.5.

The problem we are experiencing is that once the Image manager displays, and we click upload, the upload dialog displays fine, but once you click one of the Select buttons to browse for an image, A large number of javascript errors appear like this

Error: Sys.ArgumentOutOfRangeException: Value must be an integer.
Parameter name: x
Actual value was 263.5.
Source File: http://www.adtechnologies.com/ScriptResource.axd?d=kWlb-4xBCmD-1qaYQsYX1Z6QhodlouPuN90plLQ014hX3Ldj8inarvJfEAvA9DehRULcdLXA0gR8l8vEYTjvfwInrx3P328adNirYV_Ozp01&t=633615008629602500
Line: 5839

Is this a known problem? Is there something we need to register handle wise in the web.config so that the image manager works? Thanks for your help.



Rumen
Telerik team
 answered on 04 Nov 2010
2 answers
102 views
Hello!

Is it possible to force RadGrid to not rebind the datasource on basic operations, like filtering i.e. and just use the previous bound datasource? If so, how?

Regards
Aleš
Top achievements
Rank 1
 answered on 04 Nov 2010
7 answers
1.0K+ views
hey everyone,

I am using a radgrid where user inserts Order.Order are temporarily stored in radgrid using data table as data source.I want to show a total of all the values inside Amount column in the grid footer.How to achieve this?...

Thanks
Amit
Pavlina
Telerik team
 answered on 04 Nov 2010
7 answers
538 views
I have a radcombobox that runs some code when the user starts typing in numbers to pull relevant part numbers. Once a user selects a number I need to populate some asp labels. The problem is, these combobox and labels are in an asp repeater because the user can essentially keep adding parts. To see what it does you can go here. http://devpartsonline.intellicomweb.com/test.aspx
Basically when the users selects a number to go into the radcombobox I need the two labels (right now say test) to update from the database with the price and part name of that number. I need to run serverside code and update those labels but I can't figure out how to get the rad combo box to execute code since it is in a repeater. I really have no idea how to get started on this. Here is my aspx and vb just for a reference. Thanks,

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="bulkOrder.aspx.vb" Inherits="devOrthman.bulkOrder"
    MasterPageFile="~/MasterPage.Master" Title="Bulk Ordering" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <script language="javascript" type="text/javascript">
function OnClientItemsRequested(sender, eventArgs)
 {
   if(sender.get_items().get_count() == 0)
   {
    sender.clearSelection();
    sender.hideDropDown();
    
   }
 }
    </script>

    <div class="ContentPadding">
        <asp:UpdatePanel ID="Panel1" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <span class="H2Internal">Bulk Ordering</span>
                <p>
                    <asp:Repeater ID="Repeater1" runat="server">
                        <HeaderTemplate>
                            <table cellspacing="5">
                        </HeaderTemplate>
                        <ItemTemplate>
                            <tr valign="middle">
                                <td width="80px">
                                    
                                    <asp:Button ID="AddButton" runat="server" Text="Add" CommandName="Add" CausesValidation="True" ValidationGroup ="bulkValidation" />
                                    <asp:Button ID="RemoveBtn" runat="server" Text="Delete" CommandName="Remove" CausesValidation="false"
                                        Visible="false" />
                                </td>
                                <td width="175px">
                                    <telerik:RadComboBox ID="RadSearchComboBox" runat="server" Width="150px" Height="175px"  ValidationGroup ="bulkValidation"
                                        OnSelectedIndexChanged="itemChanged"
                                        AllowCustomText="True" ShowToggleImage="False"
                                        ShowMoreResultsBox="true" EnableLoadOnDemand="True" Skin="Telerik" MarkFirstMatch="True"
                                        OnItemsRequested="loadSearch" EnableVirtualScrolling="true" EmptyMessage="Enter Part Number"
                                        ErrorMessage="Value not Found" AutoPostBack="False" OnClientItemsRequested="OnClientItemsRequested">
                                        <CollapseAnimation Duration="100" Type="OutQuint" />
                                    </telerik:RadComboBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="*"  ValidationGroup ="bulkValidation"
                                        ControlToValidate="RadSearchComboBox" />
                                </td>
                                <td width="45px">
                                    <telerik:RadNumericTextBox ID="QtyTextBox" runat="server" MaxLength="3" MaxValue="999"  ValidationGroup ="bulkValidation"
                                        MinValue="1" NumberFormat-DecimalDigits="0" ShowSpinButtons="false" Type="Number"
                                         Width="20px" />
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*"  ValidationGroup ="bulkValidation"
                                        ControlToValidate="QtyTextBox" />
                                </td>
                                <td class="H2Internal">
                                    Part Name: <asp:Label CssClass ="MainText" id="partName" runat="server" Text="test"></asp:Label>&nbsp;&nbsp;&nbsp;
                                    Price: <asp:Label CssClass ="MainText" id="price" runat="server" Text="test"></asp:Label>
                                </td>
                            </tr>
                        </ItemTemplate>
                        <FooterTemplate>
                            </table>
                        </FooterTemplate>
                    </asp:Repeater>
                </p>
                <p>
                    <asp:Button ID="Button1" runat="server" Text="All Items to Cart" CausesValidation="True"  ValidationGroup ="bulkValidation"
                        OnClick="addToCart"></asp:Button>
                </p>
                <p>
                    <asp:Label ID="msgLabel" runat="server" Text=""></asp:Label>
                </p>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
            </Triggers>
        </asp:UpdatePanel>
    </div>
</asp:Content>
----------------------------------------------------------------------------------------------------------------
VB Code
----------------------------------------------------------------------------------------------------------------
Imports Telerik.Web.UI
Imports System.Data.SqlClient
Imports System.Net.Mail
Partial Public Class bulkOrder
    Inherits System.Web.UI.Page
    Shared allItems As ArrayList

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            allItems = New ArrayList
            Me.bulkItems = allItems
            Me.bulkItems.Add(New bulkOrderItem())
            Me.Repeater1.DataSource = bulkItems
            Me.Repeater1.DataBind()
        Else
            storeList()
        End If
    End Sub
    Protected Sub loadSearch(ByVal sender As Object, ByVal e As RadComboBoxItemsRequestedEventArgs)
        Dim connection As New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("orthmanConnectionString").ToString)
        Dim selectCommand As New SqlCommand("searchByPartNumber", connection)

        selectCommand.Parameters.AddWithValue("partNumber", e.Text)
        selectCommand.CommandType = CommandType.StoredProcedure
        Dim adapter As New SqlDataAdapter(selectCommand)
        Dim data As New DataTable()
        adapter.Fill(data)
        Try

            Dim itemsPerRequest As Integer = 10
            Dim itemOffset As Integer = e.NumberOfItems
            Dim endOffset As Integer = itemOffset + itemsPerRequest
            If endOffset > data.Rows.Count Then
                endOffset = data.Rows.Count
            End If

            If endOffset = data.Rows.Count Then
                e.EndOfItems = True
            End If
            Dim i As Integer = itemOffset
            While i < endOffset
                CType(sender, RadComboBox).Items.Add(New RadComboBoxItem(data.Rows(i)("PartNumber").ToString(), data.Rows(i)("PartId").ToString()))
                i = i + 1
            End While

            If data.Rows.Count > 0 Then
                e.Message = [String].Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset.ToString(), data.Rows.Count.ToString())
            Else
                e.Message = "No Matches"
            End If
        Catch
            e.Message = "No Matches"
        Finally
            adapter.Dispose()
        End Try
    End Sub
    'Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnAdd.Click
    '    Me.bulkItems.Add(New bulkOrderItem())
    '    Me.Repeater1.DataSource = bulkItems
    '    Me.Repeater1.DataBind()

    'End Sub
    Protected Sub rptrDatabound(ByVal sender As Object, ByVal e As RepeaterItemEventArgs) Handles Repeater1.ItemDataBound
        Dim index As Integer = e.Item.ItemIndex
        If index < bulkItems.Count And index > -1 Then
            Dim bulkItem As bulkOrderItem
            Dim txtPart As RadComboBox
            Dim qtyPart As Telerik.Web.UI.RadNumericTextBox
            txtPart = CType(e.Item.FindControl("RadSearchComboBox"), RadComboBox)
            qtyPart = CType(e.Item.FindControl("QtyTextBox"), Telerik.Web.UI.RadNumericTextBox)
            bulkItem = CType(bulkItems.Item(index), bulkOrderItem)
            txtPart.Text = bulkItem.itemNumber
            qtyPart.Value = bulkItem.itemQty
            e.Item.FindControl("AddButton").Visible = Not bulkItem.canDelete
            e.Item.FindControl("RemoveBtn").Visible = bulkItem.canDelete
        End If
    End Sub
    Protected Sub storeList()
        Dim index As Integer = 0
        Dim bulkItem As bulkOrderItem
        For Each rptrItem As RepeaterItem In Repeater1.Items
            Dim txtPart As RadComboBox
            Dim qtyPart As Telerik.Web.UI.RadNumericTextBox
            txtPart = CType(rptrItem.FindControl("RadSearchComboBox"), RadComboBox)
            qtyPart = CType(rptrItem.FindControl("QtyTextBox"), RadNumericTextBox)
            bulkItem = CType(bulkItems.Item(index), bulkOrderItem)
            bulkItem.itemNumber = txtPart.Text
            bulkItem.itemQty = qtyPart.Value
            bulkItem.canDelete = Not (rptrItem.FindControl("AddButton").Visible)
            index = index + 1
        Next

    End Sub
    'Protected Sub emailAdministrator(ByVal OrderId As String)
    '    Dim msgBody As String
    '    msgBody = "A new order has been placed." & vbCrLf
    '    msgBody &= " Order ID: " & OrderId & vbCrLf
    '    msgBody &= "Please click on the following link to view the details of the order:" & vbCrLf
    '    msgBody &= "http://orthman.intellicomweb.com/admin/orders/orderDetails.aspx?ID=" & OrderId

    '    Dim msgTo As String = System.Configuration.ConfigurationManager.AppSettings("sentToAdmin")
    '    Dim msgFrom As String = System.Configuration.ConfigurationManager.AppSettings("sendfrom")
    '    Dim msgSubject As String = "Orthman Online Catalog - New Order Placed"
    '    Try
    '        Dim checkoutMail As New MailMessage(msgFrom, msgTo, msgSubject, msgBody)
    '        Dim mailClient As New SmtpClient()
    '        mailClient.Host = "inteexchange01"
    '        checkoutMail.IsBodyHtml = False
    '        mailClient.Send(checkoutMail)
    '    Catch err As Exception
    '        msgLabel.Text = "An error ocurred, please try again later. <BR/>" & err.ToString
    '    End Try
    'End Sub

    Protected Sub itemChanged(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs)
        Response.Write("test")
    End Sub
    Protected Sub rptrCommand(ByVal sender As Object, ByVal e As RepeaterCommandEventArgs) Handles Repeater1.ItemCommand
        Dim index As Integer
        index = e.Item.ItemIndex
        If e.CommandName = "Remove" Then
            bulkItems.RemoveAt(index)
            Me.Repeater1.DataSource = bulkItems
            Me.Repeater1.DataBind()

        ElseIf e.CommandName = "Add" Then
            Page.Validate()
            If Page.IsValid() Then
                Me.bulkItems.Add(New bulkOrderItem())
                Me.Repeater1.DataSource = bulkItems
                Me.Repeater1.DataBind()
                Me.Repeater1.Items(index).FindControl("AddButton").Visible = False
                Me.Repeater1.Items(index).FindControl("RemoveBtn").Visible = True

            End If
            Panel1.Update()
        End If
    End Sub
    Protected Sub addToCart(ByVal sender As Object, ByVal e As System.EventArgs)

        Page.Validate()
        If Page.IsValid() Then
            Dim bulkItem As bulkOrderItem
            storeList()
            Dim i As Integer = 0
            While i < bulkItems.Count
                bulkItem = CType(bulkItems.Item(i), bulkOrderItem)
                storeInDB(bulkItem.Number, bulkItem.Qty)
                i = i + 1
            End While
            Response.Redirect("~/cart/viewcart.aspx")
        End If
    End Sub
    Private Property bulkItems() As IList
        Get
            Return CType(ViewState("allItems"), ArrayList)
        End Get
        Set(ByVal value As IList)
            ViewState("allItems") = value
        End Set
    End Property
    Protected Sub storeInDB(ByVal partNumber As String, ByVal qty As Integer)
        Dim connString As String = System.Configuration.ConfigurationManager.ConnectionStrings("orthmanConnectionString").ToString
        Dim myConnection As New Data.SqlClient.SqlConnection(connString)
        Dim strSQL = "addPartToCartByNumber"
        Dim insertCommand As New Data.SqlClient.SqlCommand(strSQL, myConnection)
        Dim PartIdParameter As New SqlClient.SqlParameter("@PartNumber", SqlDbType.NVarChar)
        Dim qtyParameter As New SqlClient.SqlParameter("@Quantity", SqlDbType.Int)
        Dim userNameParameter As New SqlClient.SqlParameter("@UserName", SqlDbType.NVarChar)

        insertCommand.CommandType = CommandType.StoredProcedure

        PartIdParameter.Value = partNumber
        qtyParameter.Value = qty
        userNameParameter.Value = User.Identity.Name

        insertCommand.Parameters.Add(PartIdParameter)
        insertCommand.Parameters.Add(qtyParameter)
        insertCommand.Parameters.Add(userNameParameter)
        Try
            myConnection.Open()
            insertCommand.ExecuteNonQuery()
        Catch ex As Exception
            'msgLabel.Text = ex.ToString()
        Finally
            myConnection.Close()
        End Try
    End Sub

End Class
vivek
Top achievements
Rank 1
 answered on 04 Nov 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?