Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
202 views
Hello,

Can someone please tell me why my datasource is not updating when using the RadGrid?  I have read countless forum posts and still have been unable to solve the issue.  I wanted to use the AutomaticUpdate/Delete feature, because it appeared to be "simple".  I am using the grid to display a user's shopping cart contents.  All I want to be able to do is allow them to update the quantity of an item in the cart, or remove it....period.

Below is my code.  I have stripped it down to bare bones in hopes to find the problem, but still no luck.  This is driving me NUTS!

Any help would be greatly appreciated.

Thanks,
Jim


<%@ Control Language="VB" AutoEventWireup="false" CodeFile="shoppingcart.ascx.vb" Inherits="ctl_shoppingcart" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dxe" %>
<%@ Register assembly="DevExpress.Web.ASPxGridView.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dxwgv" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
 
<script type="text/javascript">
    function showSubDetail(URL) {
        var oWnd = radopen(URL, "windowItemDetail");
    }
</script>
 
<div class="shoppingcart">
    <div class="heading">
        Current Items in Your Cart
    </div>
 
    <telerik:RadGrid ID="RadGrid1" runat="server" AllowSorting="true" EnableAJAX="true" DataSourceID="SqlDataSource1" AllowAutomaticDeletes="true" AllowAutomaticInserts="true" AllowAutomaticUpdates="true">
        <MasterTableView AutoGenerateColumns="False" DataKeyNames="lineID" DataSourceID="SqlDataSource1" EditMode="InPlace">
            <Columns>
                <telerik:GridEditCommandColumn ButtonType="LinkButton" UniqueName="editcolumn"></telerik:GridEditCommandColumn>
                <telerik:GridBoundColumn DataField="quoteID" DataType="System.Int32" HeaderText="quoteID"
                    UniqueName="quoteID"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="lineID" HeaderText="lineID" UniqueName="lineID"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="enteredByContactID" HeaderText="enteredByContactID" UniqueName="enteredByContactID"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="containersOrdered" HeaderText="containersOrdered" UniqueName="containersOrdered"></telerik:GridBoundColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
 
    <br /><br />
 
    <telerik:RadButton ID="btnCheckout" Text="Checkout" runat="server">
    </telerik:RadButton>
 
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
        <Windows>
            <telerik:RadWindow ID="windowItemDetail" CssClass="itemDetailWindow" 
            runat="server"
            Modal="true" Behaviors="Close"
            Animation="Fade" AnimationDuration="500"
            width="500" 
            Overlay="true"
            Title="Assorted Species Tray Detail"
            VisibleTitlebar="true" VisibleStatusbar="false">
        </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>
 
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
        ConflictDetection="CompareAllValues"
        ConnectionString="<%$ ConnectionStrings:RakerDBConnectionString %>"
        SelectCommand="spSelectQuoteDetailInfoByQuoteID" SelectCommandType="StoredProcedure"
        UpdateCommand="spUpdateQuoteDetailLineByCriteria" UpdateCommandType="StoredProcedure">
        <SelectParameters>
            <asp:Parameter Name="quoteID" Type="Int32" DefaultValue="1229" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="quoteID" Type="Int32" />
            <asp:Parameter Name="lineID" Type="Int32" />
            <asp:Parameter Name="containersOrdered" Type="Int32" />
            <asp:Parameter Name="enteredByContactID" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
 
</div>

Code-behind:

Imports System.Data
Imports Telerik.Web.UI
 
Partial Class ctl_shoppingcart
    Inherits System.Web.UI.UserControl
 
End Class
Georgi
Telerik team
 answered on 18 Apr 2011
4 answers
186 views
We'd have a system custom module for the editor that would contain large save/close buttons (not toolbar sizes) we'd like to show only when the editor is in full screen.  I can detect the full screen toggling, but need a way to show/hide the module via javascript.  Basically the same functionality that the Module Manager button does without the user clicking on that button and selecting/deselecting our module.

Any way to do this?
Rumen
Telerik team
 answered on 18 Apr 2011
1 answer
213 views
I seem to be having a problem controlling the visibility of a RadMenuItem using inline code. I have an "Admins Only" dropdown I want to display only if a session variable test is true. I swear this used to work, but as of 2010Q3 it is not. The sample line is:

<telerik:RadMenuItem runat="server" Text="Admin" Visible='<%# iif(session("UserID") = "1", "True", "False") %>'>


The page loads up fine, but no matter the content of the session variable (empty, "1", "2", nothing), the menu is always displayed.

Any suggestions?
Peter
Telerik team
 answered on 18 Apr 2011
3 answers
111 views
Is there a way to show a "Today" button in the bottom of the popup calendar in the Datepicker control? This is an important feature to our users.
Maria Ilieva
Telerik team
 answered on 18 Apr 2011
9 answers
177 views
Need to establish the relationship between the master table and detail tables. I am using "GridRelationFields" but because ajax error. When not using the "GridRelationFields" I click to expand the detail of a record and I get all the detailed tables of all records.

I mention that each detail table differ in the number of columns and their names, each table are aggregated in a programmatic way.
How I can successfully establish the relationship between the master table and detail table?

I noted the examples online and do not help me.
Annex the image of the error in AJAX when using "GridRelationFields. "

This is my code to build the tables in detail:

DataTable datTabDatosDetalle = new DataTable();
                    if (ViewState["OrdCompraProdDetallesSub" + IdOrdenCompra + Skucode] == null)
                    {
                        datTabDatosDetalle = CCSMovimientoProductos.BuscarProdDetOrdenCompra_CEDIS(IdOrdenCompra, Skucode).Tables[0];
                        ViewState.Add("OrdCompraProdDetallesSub" + IdOrdenCompra + Skucode, datTabDatosDetalle);
                    }
                    else
                        datTabDatosDetalle = (DataTable)ViewState["OrdCompraProdDetallesSub" + IdOrdenCompra + Skucode];
  
                    Telerik.Web.UI.GridTableView detailTable = new Telerik.Web.UI.GridTableView(radGriOrdComDetalles);
  
                    Telerik.Web.UI.GridRelationFields relationFields_Id = new Telerik.Web.UI.GridRelationFields();
                    relationFields_Id.MasterKeyField = "Id";
                    relationFields_Id.DetailKeyField = "Id";
                    detailTable.ParentTableRelation.Add(relationFields_Id);
  
                    Telerik.Web.UI.GridRelationFields relationFields_Skucode = new Telerik.Web.UI.GridRelationFields();
                    detailTable.ParentTableRelation.Add(relationFields_Skucode);
                    relationFields_Skucode.MasterKeyField = "prodSkucode";
                    relationFields_Skucode.DetailKeyField = "prodSkucode";
                      
                    radGriOrdComDetalles.MasterTableView.DetailTables.Add(detailTable);
  
                    detailTable.Name = "tabDetail" + IdOrdenCompra + Skucode;
                    detailTable.DataKeyNames = new string[] {"prodSkucode" };
                    detailTable.EnableViewState = true;
                    detailTable.NoDetailRecordsText = "";
                    detailTable.Caption = "Detalle del producto Sku " + Skucode;
                    detailTable.EditMode = Telerik.Web.UI.GridEditMode.InPlace;
  
                    foreach (DataColumn dc in datTabDatosDetalle.Columns)
                    {
                        Telerik.Web.UI.GridBoundColumn campo = new Telerik.Web.UI.GridBoundColumn();
                        detailTable.Columns.Add(campo);
                        campo.UniqueName = "col" + dc.ColumnName;
                        campo.HeaderText = "[ " + dc.ColumnName + " ]";
                        campo.HeaderStyle.Font.Bold = true;
                        campo.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
                        campo.DataField = dc.ColumnName;
  
                        if (dc.ColumnName == "Id")
                        {
                            campo.Visible = false;
                        }
                        if (dc.ColumnName == "prodSkucode")
                        {
                            campo.Visible = false;
                        }
                        if (dc.ColumnName == "Talla")
                        {
                            campo.ReadOnly = true;
                        }
                    }
  
                    Telerik.Web.UI.GridEditCommandColumn campoEdit = new Telerik.Web.UI.GridEditCommandColumn();
                    detailTable.Columns.Add(campoEdit);
                    campoEdit.UniqueName = "colEdit";
                    campoEdit.ButtonType = Telerik.Web.UI.GridButtonColumnType.LinkButton;
                    campoEdit.EditText = "Editar";
                    campoEdit.UpdateText = "Actualizar";
                    campoEdit.CancelText = "Cancelar";
  
                    detailTable.DataSource = datTabDatosDetalle;
                    detailTable.Rebind();
                    radGriOrdComDetalles.Rebind();
Pavlina
Telerik team
 answered on 18 Apr 2011
1 answer
114 views
I have needed to change the standard menu sprite to have a few different thing one of which if the dividor image that is used by the rmLeftImage class. This i have done ok.

However when i hover over the top bar the image covers the area of the menu option and the new divide image.

What must i do to have only the menu option change background colour on the hover?
Kate
Telerik team
 answered on 18 Apr 2011
3 answers
101 views
Hi,

I want to create context menus on client side dynamically, does telerik context menu support this?

As I know, we can use
var _menu = $find('<%=Menu.ClientID%>');
to retrieve a context menu, this means we have to add a context menu at design time in html or create one at server side runtime, but how we can create a context menu in client side? 

I need to create context menus on client side, how I can reach this?

Thanks.
Helen
Telerik team
 answered on 18 Apr 2011
1 answer
65 views
Hello,

I have a line chart where both the series are starting from the middle of main gridlines. I want to start those from gridlines. Plz see attached image.

Also the axis labels need to appear from at the start of main grid lines and not in the middle
Tsvetie
Telerik team
 answered on 18 Apr 2011
1 answer
120 views

Hello,

I've places a Target-Source listbox on my User Registration form. Transferring items between de listboxes is no problem but when I commit the data with the Create User button I receive a 'Index was out of range' error.
Any idea?

See attached code.

<%@ Page Title="Register" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Register.aspx.cs" Inherits="YBS.Account.Register" %>
  
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
  
  
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <asp:CreateUserWizard ID="RegisterUser" runat="server" EnableViewState="False" 
        OnCreatedUser="RegisterUser_CreatedUser">
        <LayoutTemplate>
            <asp:PlaceHolder ID="wizardStepPlaceholder" runat="server"></asp:PlaceHolder>
            <asp:PlaceHolder ID="navigationPlaceholder" runat="server"></asp:PlaceHolder>
        </LayoutTemplate>
        <WizardSteps>
            <asp:CreateUserWizardStep ID="RegisterUserWizardStep" runat="server">
                <ContentTemplate>
                    <span class="failureNotification">
                        <asp:Literal ID="ErrorMessage" runat="server"></asp:Literal>
                    </span>
                    <asp:ValidationSummary ID="RegisterUserValidationSummary" runat="server" CssClass="failureNotification" 
                         ValidationGroup="RegisterUserValidationGroup"/>
                    <div class="accountInfo">
                        <fieldset class="register">
                            <legend><h2>Create a New Account</h2></legend>
                            <table runat="server" id="tblRegister" style="width:100%" border="0">
                              <tr>
                                <td align="right" style="width:125px"
                                  <asp:Label ID="NameLabel" runat="server" AssociatedControlID="tbName">Name:</asp:Label>
                                </td>
                                <td align="left">
                                  <asp:TextBox ID="tbName" runat="server" CssClass="textEntry"></asp:TextBox>
                                  <asp:RequiredFieldValidator ID="NameRequired" runat="server" ControlToValidate="tbName" 
                                       CssClass="failureNotification" ErrorMessage="Name is required." ToolTip="Name is required." 
                                       ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
                                </td>
                              </tr>
                              <tr>
                                <td align="right" style="width:125px">
                                  <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User Name:</asp:Label
                                </td>
                                <td align="left">
                                  <asp:TextBox ID="UserName" runat="server" CssClass="textEntry"></asp:TextBox>
                                  <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName" 
                                       CssClass="failureNotification" ErrorMessage="User Name is required." ToolTip="User Name is required." 
                                       ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
                                </td>
                              </tr>
                              <tr>
                                <td align="right" style="width:125px"
                                  <asp:Label ID="EmailLabel" runat="server" AssociatedControlID="Email">E-mail:</asp:Label>
                                </td>
                                <td align="left">
                                  <asp:TextBox ID="Email" runat="server" CssClass="textEntry"></asp:TextBox>
                                  <asp:RequiredFieldValidator ID="EmailRequired" runat="server" ControlToValidate="Email" 
                                       CssClass="failureNotification" ErrorMessage="E-mail is required." ToolTip="E-mail is required." 
                                       ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
                                </td>
                              </tr>
                              <tr>
                                <td align="right" style="width:125px">
                                  <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label
                                </td>
                                <td align="left">
                                  <asp:TextBox ID="Password" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
                                  <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password" 
                                       CssClass="failureNotification" ErrorMessage="Password is required." ToolTip="Password is required." 
                                       ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
                                  <i>(Minimum of <%= Membership.MinRequiredPasswordLength %> characters required!)</i>
                                </td>
                              </tr>
                              <tr>
                                <td align="right" style="width:125px"
                                  <asp:Label ID="ConfirmPasswordLabel" runat="server" AssociatedControlID="ConfirmPassword">Confirm Password:</asp:Label>
                                </td>
                                <td align="left">
                                  <asp:TextBox ID="ConfirmPassword" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
                                  <asp:RequiredFieldValidator ControlToValidate="ConfirmPassword" CssClass="failureNotification" Display="Dynamic" 
                                       ErrorMessage="Confirm Password is required." ID="ConfirmPasswordRequired" runat="server" 
                                       ToolTip="Confirm Password is required." ValidationGroup="RegisterUserValidationGroup">*</asp:RequiredFieldValidator>
                                  <asp:CompareValidator ID="PasswordCompare" runat="server" ControlToCompare="Password" ControlToValidate="ConfirmPassword" 
                                       CssClass="failureNotification" Display="Dynamic" ErrorMessage="The Password and Confirmation Password must match."
                                       ValidationGroup="RegisterUserValidationGroup">*</asp:CompareValidator>
                                </td>
                              </tr>
                              <tr>
                                <td align="right" style="width:125px">
                                </td>
                                <td align="left">
                                  <table id="tblCompany" runat="server">
                                    <tr>
                                      <td valign="top">
                                        <telerik:RadListBox ID="rlbSourceCompany" runat="server" Skin="Windows7" 
                                              AllowTransfer="True" TransferToID="rlbTargetCompany" Width="275px" Height="200px"
                                              DataKeyField="CompanyID" DataSourceID="SqlDSCompany" 
                                              DataTextField="Company">
                                          <HeaderTemplate>
                                            <center><asp:Label ID="lblSourceCompany" runat="server" Text="All companies" Font-Bold="true" /></center>
                                          </HeaderTemplate>
                                        </telerik:RadListBox>
                                      </td>
                                      <td valign="top">
                                        <telerik:RadListBox ID="rlbTargetCompany" runat="server" Skin="Windows7" Width="250px" Height="200px">
                                          <HeaderTemplate>
                                            <center><asp:Label ID="lblTargetCompany" runat="server" Text="Selected companies" Font-Bold="true" /></center>
                                          </HeaderTemplate>
                                        </telerik:RadListBox>
                                      </td>
                                    </tr>
                                  </table>
                                </td>
                              </tr>
                            </table>
                        </fieldset>
                        <p class="submitButton">
                            <asp:Button ID="CreateUserButton" runat="server" CommandName="MoveNext" Text="Create User" 
                                 ValidationGroup="RegisterUserValidationGroup"/>
                        </p>
                    </div>
                </ContentTemplate>
                <CustomNavigationTemplate>
                </CustomNavigationTemplate>
            </asp:CreateUserWizardStep>
<asp:CompleteWizardStep runat="server"></asp:CompleteWizardStep>
        </WizardSteps>
    </asp:CreateUserWizard>
                        <asp:SqlDataSource ID="SqlDSCompany" runat="server" 
        ConnectionString="<%$ ConnectionStrings:Yosi %>" SelectCommand="SELECT C.CompanyID, (C.Description + ' (' + D.Description + ')') AS Company
FROM SYS_Domain D
INNER JOIN SYS_Company AS C ON D.DomainID = C.DomainID 
ORDER BY D.Code, C.Code
"></asp:SqlDataSource>
</asp:Content>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections.Specialized;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using System.Configuration;
  
using YBS.Membership;
using YBS.Manager;
using YBS.SQLDAL;
using YBS.SQLDAL.Entities;
  
using Telerik.Web;
using Telerik.Web.UI;
  
namespace YBS.Account
{
    public partial class Register : System.Web.UI.Page
    {
        private YBS.Manager.YBSBaseFunctions hdlBaseFunctions = new Manager.YBSBaseFunctions();
        public static String ConnString = ConfigurationManager.ConnectionStrings["Yosi"].ConnectionString;
  
        protected void Page_Load(object sender, EventArgs e)
        {
            RegisterUser.ContinueDestinationPageUrl = Request.QueryString["ReturnUrl"];
  
            SetObjectProperties();
        }
  
        protected void RegisterUser_CreatedUser(object sender, EventArgs e)
        {
            TextBox tbName = (TextBox)RegisterUserWizardStep.ContentTemplateContainer.FindControl("tbName");
  
            FormsAuthentication.SetAuthCookie(RegisterUser.UserName, false /* createPersistentCookie */);
  
            int _userID = new SYS_UserDAL().GetUserID(RegisterUser.UserName);
            hdlBaseFunctions.SetCurrentUserID(this.Context, _userID);
              
            if (tbName != null)
            {
                new YBSMembershipProvider().ChangeName(RegisterUser.UserName, tbName.Text);
            }
  
            SaveUserCompany(_userID);
  
            string continueUrl = RegisterUser.ContinueDestinationPageUrl;
            if (String.IsNullOrEmpty(continueUrl))
            {
                continueUrl = "~/";
            }
            Response.Redirect(continueUrl);
  
  
        }
  
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
  
            if (!Page.IsPostBack)
            {
                string sSQLCompany = "";
                sSQLCompany += "SELECT C.CompanyID, (C.Description + ' (' + D.Description + ')') AS Company ";
                sSQLCompany += "FROM SYS_Domain D ";
                sSQLCompany += "INNER JOIN SYS_Company AS C ON D.DomainID = C.DomainID ";
                sSQLCompany += "ORDER BY D.Code, C.Code";
  
                SqlDSCompany.SelectCommandType = SqlDataSourceCommandType.Text;
                SqlDSCompany.SelectCommand = sSQLCompany;
            }
        }
  
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
  
        }
  
        protected void SetObjectProperties()
        {
            RadListBox rlbSourceCompany = (RadListBox)RegisterUserWizardStep.ContentTemplateContainer.FindControl("rlbSourceCompany");
            RadListBox rlbTargetCompany = (RadListBox)RegisterUserWizardStep.ContentTemplateContainer.FindControl("rlbTargetCompany");
  
            if (rlbSourceCompany != null)
            {
                rlbSourceCompany.Skin = "Windows7";
                rlbSourceCompany.SelectionMode = ListBoxSelectionMode.Multiple;
                rlbSourceCompany.AllowTransferOnDoubleClick = true;
                rlbSourceCompany.Header.Visible = true;
                rlbSourceCompany.AllowTransferDuplicates = false;
                rlbSourceCompany.AllowReorder = false;
            }
  
            if (rlbTargetCompany != null)
            {
                rlbTargetCompany.Skin = "Windows7";
                rlbTargetCompany.AllowReorder = false;
                rlbTargetCompany.AllowDelete = false;
            }
        }
  
        protected void SaveUserCompany(int iUserID)
        {
/*
            RadListBox rlbTargetCompany = (RadListBox)RegisterUserWizardStep.ContentTemplateContainer.FindControl("rlbTargetCompany");
  
            if (rlbTargetCompany.Items.Count > 0)
            {
                foreach (RadListBoxItem rlbItem in rlbTargetCompany.Items)
                {
                    SYS_UserCompanyDAL.SYS_UserCompany _objUserCompany = new SYS_UserCompanyDAL.SYS_UserCompany();
  
                    _objUserCompany.UserID = iUserID;
                    _objUserCompany.CompanyID = Convert.ToInt32(rlbItem.DataKey);
                }
            }
 */
        }
    }
}
Peter Filipov
Telerik team
 answered on 18 Apr 2011
1 answer
67 views
Hi,

I have a web application in which I am currently using Microsoft's standard upload control.  However, users are having problems with uploads not completing when they try it from locations with poor connectivity.

Questions:

1. Could your upload control improve the situation?

2. Can your upload be restarted, i.e., if a timeout occurs does it save what was already received so that it can pick up from where it left off?

3. Are there IIS changes that you recommend to better handle upload processing?

Thank you

Genady Sergeev
Telerik team
 answered on 18 Apr 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?