Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
226 views
Hi, My grid will contain check boxes as the only editable items. Is there a way for a user to just check the check boxes and automatically update the record? (Without an edit / update button)

Thanks
Jayesh Goyani
Top achievements
Rank 2
 answered on 07 Aug 2012
2 answers
82 views
Hello,

I have a ridgrid for which i'm having paging.
Is it possible to modify data on this range of rows (the active paging range) on serverside?
For example the grid contains 270 rows, but only the first 10 are displayed with paging.
When the next range (10 to 20) is displayed, then I want to change the data for this range.

I already tried the PreRender serverside event, it gives the correct displayed rows with radGridProducts.Items.
I can loop them and change some values, but the datasource of the grid isn't refreshed. It displays the same old values.

Maybe another approach/event of the grid?

Thanks.
Bieters Bieters
Top achievements
Rank 1
 answered on 07 Aug 2012
11 answers
181 views
I am trying to implement multicolumn combobox as filter for one column in the grid.
I have done filter with combobox as below. I am taking the filter value in the item command event and grid is bind in Needdatasource event.  


<telerik:GridBoundColumn HeaderText="Company" UniqueName="ComId" DataField="ComId" >
                    <FilterTemplate>
                    <telerik:RadComboBox ID="CBCompany" runat="server" DataSourceID="SQL_Company" DataTextField="CDName" DataValueField="ComId" Height="200px"
                     AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("ComId").CurrentFilterValue %>' OnClientSelectedIndexChanged="CompanyIndexChanged"  >
                     <Items>
                     <telerik:RadComboBoxItem Text="All" />
                     </Items>
                    </telerik:RadComboBox>
                    <telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">
 
                                <script type="text/javascript">
                                    function CompanyIndexChanged(sender, args) {
                                        var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                        tableView.filter("ComId", args.get_item().get_value(), "EqualTo");
 
                                    }
                                </script>
 
                            </telerik:RadScriptBlock>
                    </FilterTemplate>
                </telerik:GridBoundColumn>


But confused how to use it for a multicolumn combobox.Please provide an example for the same.
Thanks,
Soumya
Soumya
Top achievements
Rank 1
 answered on 07 Aug 2012
2 answers
198 views

I am using Tabstrip control in my aspx page with multipage view as given below.I am moving to next tab on click of a button.But while giving the RadTabStrip1 & RadMultiPage1 in the AjaxUpdatedControl,I am getting the blow error: "Microsoft JScript runtime error: Unable to set value of the property 'control': object is null or undefined".

aspx:Included only the relevant parts of my markup as it is lengthy.

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
        <AjaxSettings>
              
            <telerik:AjaxSetting AjaxControlID="RadTabStrip1"
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadTabStrip1" />
                        <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
             <telerik:AjaxSetting AjaxControlID="RadMultiPage1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadTabStrip1" />
                <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
 
          <telerik:AjaxSetting AjaxControlID="RbNextP">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RbNextP" />
                    <telerik:AjaxUpdatedControl ControlID="lbltitle" />
                    <telerik:AjaxUpdatedControl ControlID="lblname" />
                    <telerik:AjaxUpdatedControl ControlID="lbldob" />
                    <telerik:AjaxUpdatedControl ControlID="lblAge" />
                    <telerik:AjaxUpdatedControl ControlID="lblfile" />
                    <telerik:AjaxUpdatedControl ControlID="lblnation" />
                     <telerik:AjaxUpdatedControl ControlID="RadTabStrip1" />
                     <telerik:AjaxUpdatedControl ControlID="RadMultiPage1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
     
       <telerik:AjaxSetting AjaxControlID="RadAjaxManager1"
                <UpdatedControls
                    <telerik:AjaxUpdatedControl ControlID="RCNationality" /> 
               
                </UpdatedControls
            </telerik:AjaxSetting
            <telerik:AjaxSetting AjaxControlID="BirthDate">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="lbldob" />
                    <telerik:AjaxUpdatedControl ControlID="RTYear" />
                    <telerik:AjaxUpdatedControl ControlID="RTMonths" />
                    <telerik:AjaxUpdatedControl ControlID="RTDays" />
                    <telerik:AjaxUpdatedControl ControlID="lblAge" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RTYear">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="BirthDate" />
                    <telerik:AjaxUpdatedControl ControlID="lbldob" />
                    <telerik:AjaxUpdatedControl ControlID="RTYear" />
                    <telerik:AjaxUpdatedControl ControlID="lblAge" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="rbSave">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rbSave" />
                    <telerik:AjaxUpdatedControl ControlID="Message" />
                    <telerik:AjaxUpdatedControl ControlID="lblRegnumber" />
                    <telerik:AjaxUpdatedControl ControlID="LblRegnNo" />
                    <telerik:AjaxUpdatedControl ControlID="lbltitle" />
                    <telerik:AjaxUpdatedControl ControlID="lblname" />
                    <telerik:AjaxUpdatedControl ControlID="lbldob" />
                    <telerik:AjaxUpdatedControl ControlID="lblAge" />
                    <telerik:AjaxUpdatedControl ControlID="lblfile" />
                    <telerik:AjaxUpdatedControl ControlID="lblnation" />
                    <telerik:AjaxUpdatedControl ControlID="lblmobile" />
                    <%--<telerik:AjaxUpdatedControl ControlID="lblAFTime" />--%>
                    <telerik:AjaxUpdatedControl ControlID="lblATTime" />
                    <telerik:AjaxUpdatedControl ControlID="lblTimeComp" />
                </UpdatedControls>
            </telerik:AjaxSetting>                  
            </AjaxSettings>
</telerik:RadAjaxManager>
 
<telerik:RadTabStrip ID="RadTabStrip1" runat="server" Skin="Black" MultiPageID="RadMultiPage1" Align="Center" Width="800px"
                SelectedIndex="0" AutoPostBack="true"  >
                <Tabs>
                    <telerik:RadTab Text="Personal Details" runat="server" PageViewID="PageView1" Selected="true">
                    </telerik:RadTab>
                    <telerik:RadTab Text="Contact Details" runat="server" PageViewID="PageView2" >
                    </telerik:RadTab>
                    <telerik:RadTab Text="Doctor Details" runat="server" PageViewID="PageView3" >
                    </telerik:RadTab>
                    <telerik:RadTab Text="Health Info" runat="server" PageViewID="PageView4" >
                    </telerik:RadTab>
                    <telerik:RadTab Text="Kin Details" runat="server" PageViewID="PageView5" >
                    </telerik:RadTab>
                    <telerik:RadTab Text="Insurance Details" runat="server" PageViewID="PageView6" >
                    </telerik:RadTab>
                </Tabs>
            </telerik:RadTabStrip>
            <telerik:RadMultiPage id="RadMultiPage1" runat="server" SelectedIndex="0" Width="800px" BackColor="BurlyWood" BorderStyle="Ridge" RenderSelectedPageOnly="true"  >
                  <telerik:RadPageView id="PageView1" runat="server">
                  //rest of the code
 
<telerik:RadButton ID="RbNextP" runat="server" Text="Next" Skin="WebBlue" OnClick="P_nextButton_Click" >
                            <Icon SecondaryIconCssClass="rbNext" SecondaryIconRight="4" SecondaryIconTop="6" />
                        </telerik:RadButton>
 
             
           
Code behind:
protected void P_nextButton_Click(object sender, EventArgs e)
       {
RadTabStrip1.SelectedIndex = 1;
           RadMultiPage1.SelectedIndex = 1; 
 
       }

Found same issues discussed in the forum earlier.but couldnt get an answer from it.
Please help me on it.
Thanks,
Soumya






Soumya
Top achievements
Rank 1
 answered on 07 Aug 2012
10 answers
182 views
I have a master table with detail tables below.

In the <DetailTables>
        <Columns>

I have a gridbound column which is also the key to the relation beween parent and child.
The problem is that I I set it to readonly="true" so that it does not appear when inserting a record when I press insert
I get an error telling me that the program cannot insert a null value into the database.
Any ideas?
Thank you!

Shinu
Top achievements
Rank 2
 answered on 07 Aug 2012
0 answers
87 views
I've got a radgrid that has several levels of calculations - as the user drills down through groupings, calculations become more specific.  Inside the toplevel radgrid, I've got another radgrid inside of a nestedviewtemplate such as this:

<telerik:RadGrid>
<MasterTableView DataKeyNames="id" HierarchyLoadMode="ServerOnDemand" HierarchyDefaultExpanded="false">
<Columns>
</Columns>
<NestedViewTemplate>
<telerik:RadGrid>
</telerik:RadGrid>
</NestedViewTemplate>
</MasterTableView>
</telerik:RadGrid>

For every ExpandCollapse column or grid level, there is a padding that is introduced somehow (so that the nestedtemplate ui-wise appears as a child).  Is there anyway to override that in the css?  I can see that rgExpandCol is the class used to display the image, but I can see that my nested row contains a table cell with class rgExpandCol but no image is actually visible.  Basically, I need my nested templates to expand to 100% of the width if at all possible.  Any suggestions?
debbie f
Top achievements
Rank 1
 asked on 07 Aug 2012
0 answers
82 views
I have an Update button in template editForm. My problem is that I cannot implement the button. I have seen this demo (http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/usercontroleditform/defaultcs.aspx) and tried to implement the RadGrid1_UpdateCommand event handler, but I got compilation errors for this line:

DataRow[] changedRows = this.UserDataSource.Select("user_id = " + editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["Users"]);

The errors are:
1. "The best overloaded method match for 'System.Web.UI.WebControls.SqlDataSource.Select(System.Web.UI.DataSourceSelectArguments)' has some invalid arguments"
2. "Argument 1: cannot convert from 'string' to 'System.Web.UI.DataSourceSelectArguments'"

Can anyone help me on this?

Here's the code for the UpdateCommand event handler:
protected void RadGrid1_UpdateCommand(object sender, GridCommandEventArgs e)
{
   GridEditableItem editedItem = e.Item as GridEditableItem;
   UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
 
   //Prepare new row to add it in the DataSource
   DataRow[] changedRows = this.UserDataSource.Select("user_id = " + 
        editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["Users"]);
 
// in progress. to be implemented here
}
Iris
Top achievements
Rank 1
 asked on 07 Aug 2012
0 answers
97 views
Line: 9
Error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near '

When I click on add record it gives me the above error.



<%@ Page Title="" Language="C#" MasterPageFile="~/App_MasterPages/OneColumnMasterPage.Master"
    AutoEventWireup="true" CodeBehind="AddModifyType.aspx.cs" Inherits="Schedule.Administration.AddModifyType" %>
  
<asp:Content ID="Content1" ContentPlaceHolderID="HeadPlaceHolder" runat="server">
    <style type="text/css">
        .EditFormHeader td
        {
            font-size: 14px;
            padding: 4px !important;
            font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif;
            color: #646882;
            text-decoration: none;
            font-weight: bold;
            height: 22px;
            border: 1 px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <br />
    <table cellpadding="3" cellspacing="0" border="0" style="width: 100%;">
        <tr>
            <td id="header">
                <SCHEDULE:uxPageTitle ID="uxPageTitle" Title="Add/Modify Type" runat="server"></SCHEDULE:uxPageTitle>
                <table border="0" cellpadding="0" cellspacing="0" width="100%" class="box">
                    <tr class="boxTop">
                        <td>
                            <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
                            </telerik:RadCodeBlock>
                            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                                <AjaxSettings>
                                    <telerik:AjaxSetting AjaxControlID="RadGrid1">
                                        <UpdatedControls>
                                            <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                                            <telerik:AjaxUpdatedControl ControlID="divMsgs" />
                                        </UpdatedControls>
                                    </telerik:AjaxSetting>
                                </AjaxSettings>
                            </telerik:RadAjaxManager>
                            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
                            </telerik:RadAjaxLoadingPanel>
                            <input type="hidden" id="radGridClickedRowIndex" name="radGridClickedRowIndex" />
                            <telerik:RadGrid ID="RadGrid1" runat="server" AllowSorting="True" AutoGenerateColumns="False"
                                Skin="Windows7" AllowPaging="True" ShowStatusBar="True" OnPreRender="RadGrid1_PreRender"
                                OnNeedDataSource="RadGrid1_NeedDataSource" OnUpdateCommand="RadGrid1_UpdateCommand"
                                OnInsertCommand="RadGrid1_InsertCommand" OnDeleteCommand="RadGrid1_DeleteCommand"
                                CellSpacing="0" GridLines="None" OnItemCreated="RadGrid1_ItemCreated" 
                                OnItemDataBound="RadGrid1_ItemDataBound" onitemcommand="RadGrid1_ItemCommand">
                                <HeaderStyle Font-Bold="True" Font-Size="9pt"></HeaderStyle>
                                <ItemStyle Font-Size="8.5pt" />
                                <AlternatingItemStyle Font-Size="8.5pt" />
                                <PagerStyle Mode="NextPrevAndNumeric" />
                                <ClientSettings>
                                    <Selecting AllowRowSelect="True"></Selecting>
                                </ClientSettings>
                                <ClientSettings>
                                    <Selecting CellSelectionMode="None" AllowRowSelect="True"></Selecting>
                                </ClientSettings>
                                <MasterTableView Width="100%" TableLayout="Auto" CommandItemDisplay="Top" DataKeyNames="Type">
                                    <Columns>
                                        <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" ButtonType="ImageButton"
                                            HeaderStyle-Width="24" EditImageUrl="../Skins/Outlook/Grid/Edit.gif">
                                        </telerik:GridEditCommandColumn>
                                        <telerik:GridBoundColumn DataField="Type" DataType="System.Int32" ItemStyle-Width="7px"
                                            HeaderText="Type" SortExpression="Type" UniqueName="Type">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="TypeDescription" ItemStyle-Width="220px" HeaderText="Description"
                                            SortExpression="TypeDescription" UniqueName="TypeDescription">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="MinLbsGVW" ItemStyle-Width="15px" HeaderText="Min Lbs GVW"
                                            SortExpression="MinLbsGVW" UniqueName="MinLbsGVW">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="MaxLbsGVW" ItemStyle-Width="15px" HeaderText="Max Lbs GVW"
                                            SortExpression="MaxLbsGVW" UniqueName="MaxLbsGVW">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="ReportClassification" ItemStyle-Width="95px"
                                            HeaderText="Report Class" SortExpression="ReportClassification" UniqueName="ReportClassification">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="L_H_S" ItemStyle-Width="10px" HeaderText="L/H/S"
                                            SortExpression="L_H_S" UniqueName="L_H_S">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="RepModel" ItemStyle-Width="40px" HeaderText="Replacement Model"
                                            SortExpression="RepModel" UniqueName="RepModel">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="AmortizationClassification" HeaderText="Amortization Class"
                                            SortExpression="AmortizationClassification" ItemStyle-Width="60px" UniqueName="AmortizationClassification">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="CountClass" ItemStyle-Width="10px" HeaderText="Count Class"
                                            SortExpression="CountClass" UniqueName="CountClass">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="RepCost" DataType="System.Decimal" ItemStyle-Width="60px"
                                            DataFormatString="{0:C}" HeaderText="Replacement Cost" SortExpression="RepCost"
                                            UniqueName="RepCost">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="LeadTimeRequired" HeaderText="Lead Time" SortExpression="LeadTimeRequired"
                                            Visible="false" UniqueName="LeadTimeRequired">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridCheckBoxColumn DataField="HasTires" DataType="System.Boolean" ItemStyle-Width="10px"
                                            HeaderText="Tires" SortExpression="HasTires" UniqueName="HasTires">
                                        </telerik:GridCheckBoxColumn>
                                        <telerik:GridCheckBoxColumn DataField="FirstAidKitRequired" DataType="System.Boolean"
                                            ItemStyle-Width="10px" HeaderText="First Aid" SortExpression="FirstAidKitRequired"
                                            UniqueName="FirstAidKitRequired">
                                        </telerik:GridCheckBoxColumn>
                                        <telerik:GridBoundColumn DataField="FireExtinguisherSize" Visible="false" HeaderText="Fire Exting. Size"
                                            SortExpression="FireExtinguisherSize" UniqueName="FireExtinguisherSize">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="CAMFM" ItemStyle-Width="17px" HeaderText="CAMFM"
                                            SortExpression="CAMFM" UniqueName="CAMFM">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="EffectiveDate" DataType="System.DateTime" DataFormatString="{0:yyyy/MM/dd}"
                                            ItemStyle-Width="20px" HeaderText="Effective Date" SortExpression="EffectiveDate"
                                            Visible="false" UniqueName="EffectiveDate">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="CreatorID" Visible="false" ReadOnly="true" HeaderText="CreatorID"
                                            SortExpression="CreatorID" UniqueName="CreatorID">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="LastModifyID" Visible="false" ReadOnly="true"
                                            HeaderText="Modify By" SortExpression="LastModifyID" UniqueName="LastModifyID">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="LastModifyTime" Visible="false" ReadOnly="true"
                                            DataType="System.DateTime" HeaderText="Modify Time" SortExpression="LastModifyTime"
                                            UniqueName="LastModifyTime">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridButtonColumn ConfirmText="Are you sure you want to delete this record?"
                                            ButtonType="ImageButton" ImageUrl="../Skins/Outlook/Grid/Delete.gif" CommandName="Delete"
                                            Text="Delete" UniqueName="DeleteColumn">
                                            <HeaderStyle Width="20px" />
                                        </telerik:GridButtonColumn>
                                    </Columns>
                                    <EditFormSettings UserControlName="~/Controls/Type/uxAddModifyType.ascx" EditFormType="WebUserControl">
                                        <EditColumn UniqueName="EditCommandColumn1">
                                        </EditColumn>
                                    </EditFormSettings>
                                </MasterTableView>
                                <FilterMenu EnableImageSprites="False">
                                </FilterMenu>
                            </telerik:RadGrid>
                            <br />
                            <br />
                            <p id="divMsgs" runat="server">
                                  <asp:Label ID="Label1" runat="server" EnableViewState="False" Font-Bold="True"
                                    ForeColor="#FF8080"></asp:Label>
                                  <asp:Label ID="Label2" runat="server" EnableViewState="False" Font-Bold="True"
                                    ForeColor="#00C000"></asp:Label>
                            </p>
                            <br />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ModalPlaceHolder" runat="server">
</asp:Content>
  
using System;
using System.Linq;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using System.Data;
using System.Collections;
using System.Configuration;
using System.Data.SqlClient;
using System.Globalization;
using System.Security.Principal;
using Schedule.Helpers;
  
namespace Schedule.Administration
{
    public partial class AddModifyType : ScheduleBasePage
    {
          #region Data members
  
  
        #endregion
  
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
  
  
            }
  
        }
  
        private static DataTable GetDataTable(string queryString)
        {
            String ConnString = ConfigurationManager.ConnectionStrings["MinotaurConnectionString"].ConnectionString;
            SqlConnection MySqlConnection = new SqlConnection(ConnString);
            SqlDataAdapter MySqlDataAdapter = new SqlDataAdapter();
            MySqlDataAdapter.SelectCommand = new SqlCommand(queryString, MySqlConnection);
  
            DataTable myDataTable = new DataTable();
            MySqlConnection.Open();
            try
            {
                MySqlDataAdapter.Fill(myDataTable);
            }
            finally
            {
                MySqlConnection.Close();
            }
  
            return myDataTable;
        }
  
        protected void RadGrid1_DeleteCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            string ID = (e.Item as GridDataItem).OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Type"].ToString();
            DataTable typeTable = this.SqlDataSourceTypesDataTable;
            try
            {
                if (typeTable.Rows.Find(ID) != null)
                {
                    typeTable.Rows.Find(ID).Delete();
                    typeTable.AcceptChanges();
                    DisplayMessage(false, "Your Type has been deleted successfully!");
                }
            }
            catch (Exception ex)
            {
  
                DisplayMessage(true, "Your Type could not be deleted. Reason: " + ex.Message);
                e.Canceled = true;
            }
  
  
        }
  
        private DataTable SqlDataSourceTypesDataTable
        {
            get
            {
                object obj = this.Session["ModifyTypes"];
                if ((!(obj == null)))
                {
                    return ((DataTable)(obj));
                }
                DataTable myDataTable = new DataTable();
                myDataTable = GetDataTable("SELECT Type, TypeDescription, MinLbsGVW, MaxLbsGVW, ReportClassification, [L/H/S], RepModel, AmortizationClassification, CountClass,RepCost, LeadTimeRequired, HasTires, FirstAidKitRequired, CAMFM, EffectiveDate, CreatorID, LastModifyID, LastModifyTime from Types");
                this.Session["ModifyTypes"] = myDataTable;
                return myDataTable;
            }
        }
  
  
        protected void RadGrid1_UpdateCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            GridEditableItem editedItem = e.Item as GridEditableItem;
            UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
            int rowindex = editedItem.ItemIndex;  //Row index to identify the row edited
  
  
            String selectQuery = String.Format("Type='{0}'",
            editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["Type"]);
  
  
            DataRow[] changedRows = this.SqlDataSourceTypesDataTable.Select(selectQuery);
  
            if (changedRows.Length != 1)
            {
                RadGrid1.Controls.Add(new LiteralControl("Unable to locate the row for updating."));
                e.Canceled = true;
                return;
            }
  
            string domainUser = null;
            WindowsIdentity userName = WindowsIdentity.GetCurrent();
  
  
            if (userName != null)
            {
                domainUser = StringManipulation.ExtractUserName(userName.Name.ToString());
            }
  
            //Update new values
            Hashtable newValues = new Hashtable();
            newValues["Type"] = (userControl.FindControl("txtTypeNumber") as TextBox).Text;
            newValues["TypeDescription"] = (userControl.FindControl("txtTypeDescription") as TextBox).Text;
            newValues["MinLbsGVW"] = (userControl.FindControl("txtMinLbsGVW") as TextBox).Text;
            newValues["MaxLbsGVW"] = (userControl.FindControl("txtMaxLbsGVW") as TextBox).Text;
            newValues["ReportClassification"] = (userControl.FindControl("txtReportClassification") as TextBox).Text;
            newValues["L/H/S"] = (userControl.FindControl("txtLHS") as TextBox).Text;
            newValues["RepModel"] = (userControl.FindControl("txtReplacementModel") as TextBox).Text;
            newValues["AmortizationClassification"] = (userControl.FindControl("txtAmortization") as TextBox).Text;
            newValues["CountClass"] = (userControl.FindControl("txtCountClass") as TextBox).Text;
            newValues["RepCost"] = double.Parse(((userControl.FindControl("txtReplacementCost") as TextBox).Text), NumberStyles.Currency); 
            newValues["LeadTimeRequired"] = 0;
            newValues["HasTires"] = (userControl.FindControl("chkHasTires") as CheckBox).Checked;
            newValues["FirstAidKitRequired"] = (userControl.FindControl("chkFirstAid") as CheckBox).Checked;
            newValues["CAMFM"] = (userControl.FindControl("txtCAMFM") as TextBox).Text;
            newValues["EffectiveDate"] = (userControl.FindControl("lblEffectiveDate") as Label).Text;
            newValues["CreatorID"] = (userControl.FindControl("lblEffectiveDate") as Label).Text;
            newValues["LastModifyID"] = domainUser;// (userControl.FindControl("lblModifiedBy") as Label).Text;
            newValues["LastModifyTime"] = DateTime.Now;
  
            changedRows[0].BeginEdit();
            try
            {
                foreach (DictionaryEntry entry in newValues)
                {
                    changedRows[0][(string)entry.Key] = entry.Value;
                }
                changedRows[0].EndEdit();
                this.SqlDataSourceTypesDataTable.AcceptChanges();
  
                DisplayMessage(false, "Your Type has been updated successfully!");
  
            }
            catch (Exception ex)
            {
  
                changedRows[0].CancelEdit();
                DisplayMessage(true, "Your Type could not be updated. Reason: " + ex.Message);
                e.Canceled = true;
            }
  
  
        }
  
        private void DisplayMessage(bool isError, string text)
        {
            Label label = (isError) ? this.Label1 : this.Label2;
            label.Text = text;
        }
  
  
        protected void RadGrid1_InsertCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            if (e.CommandName == RadGrid.PerformInsertCommandName)
            {
  
                GridEditableItem editedItem = e.Item as GridEditableItem;
                UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
  
                //Create new row in the DataSource
                DataRow newRow = this.SqlDataSourceTypesDataTable.NewRow();
  
  
                string domainUser = null;
                WindowsIdentity userName = WindowsIdentity.GetCurrent();
  
  
                if (userName != null)
                {
                    domainUser = StringManipulation.ExtractUserName(userName.Name.ToString());
                }
  
                //Insert new values
                Hashtable newValues = new Hashtable();
                newValues["Type"] = (userControl.FindControl("txtTypeNumber") as TextBox).Text;
                newValues["TypeDescription"] = (userControl.FindControl("txtTypeDescription") as TextBox).Text;
                newValues["MinLbsGVW"] = (userControl.FindControl("txtMinLbsGVW") as TextBox).Text;
                newValues["MaxLbsGVW"] = (userControl.FindControl("txtMaxLbsGVW") as TextBox).Text;
                newValues["ReportClassification"] = (userControl.FindControl("txtReportClassification") as TextBox).Text;
                newValues["L/H/S"] = (userControl.FindControl("txtLHS") as TextBox).Text;
                newValues["RepModel"] = (userControl.FindControl("txtReplacementModel") as TextBox).Text;
                newValues["AmortizationClassification"] = (userControl.FindControl("txtAmortization") as TextBox).Text;
                newValues["CountClass"] = (userControl.FindControl("txtCountClass") as TextBox).Text;
                newValues["RepCost"] = double.Parse(((userControl.FindControl("txtReplacementCost") as TextBox).Text), NumberStyles.Currency);
                newValues["LeadTimeRequired"] = 0;
                newValues["HasTires"] = (userControl.FindControl("chkHasTires") as CheckBox).Checked;
                newValues["FirstAidKitRequired"] = (userControl.FindControl("chkFirstAid") as CheckBox).Checked;
                newValues["CAMFM"] = (userControl.FindControl("txtCAMFM") as TextBox).Text;
                newValues["EffectiveDate"] = (userControl.FindControl("lblEffectiveDate") as Label).Text;
                newValues["CreatorID"] = domainUser; // (userControl.FindControl("lblEffectiveDate") as Label).Text;
                newValues["LastModifyID"] = domainUser; // (userControl.FindControl("lblModifiedBy") as Label).Text;
                newValues["LastModifyTime"] = DateTime.Now;
  
  
                ////make sure that unique primary key value is generated for the inserted row 
                // newValues["Type"] = (int)this.SqlDataSourceTypeDataTable.Rows[this.SqlDataSourceTypeDataTable.Rows.Count - 1]["Type"] + 1;
  
  
  
                try
                {
                    foreach (DictionaryEntry entry in newValues)
                    {
                        newRow[(string)entry.Key] = entry.Value;
                    }
                    this.SqlDataSourceTypesDataTable.Rows.Add(newRow);
                    this.SqlDataSourceTypesDataTable.AcceptChanges();
  
                    DisplayMessage(false, "Your Type has been inserted successfully!");
  
                }
                catch (Exception ex)
                {
  
                    DisplayMessage(true, "Your Type could not be inserted. Reason: " + ex.Message);
                    e.Canceled = true;
                }
            }
        }
  
        protected void RadGrid1_PreRender(object sender, System.EventArgs e)
        {
            if (!this.IsPostBack)
            {
                this.RadGrid1.MasterTableView.Items[1].Edit = true;
                this.RadGrid1.MasterTableView.Rebind();
            }
        }
  
  
        protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
        {
            if (e.Column.IsBoundToFieldName("Date"))
            {
                (e.Column as GridDateTimeColumn).DataFormatString = "{0:D}";
            }
            else if (e.Column.IsBoundToFieldName("UnitPrice"))
            {
                (e.Column as GridNumericColumn).DataFormatString = "{0:C}";
            }
            if (e.Column is GridBoundColumn)
            {
                (e.Column as GridBoundColumn).FilterControlWidth = System.Web.UI.WebControls.Unit.Pixel(100);
            }
        }
  
        protected void RadGrid1_EditCommand(object sender, GridCommandEventArgs e)
        {
  
        }
  
        protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            this.RadGrid1.DataSource = this.SqlDataSourceTypesDataTable;
            this.SqlDataSourceTypesDataTable.PrimaryKey = new DataColumn[] 
                {
                  this.SqlDataSourceTypesDataTable.Columns["Type"]
                };
  
        }
  
        protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
        {
            //if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
            //{
            //    UserControl MyUserControl = e.Item.FindControl(GridEditFormItem.EditFormUserControlID) as UserControl;
            //    string script = String.Format("$get('{0}').focus(); $get('{0}').select();", MyUserControl.FindControl("TextBox7").ClientID);
            //    ScriptManager.RegisterStartupScript(Page, typeof(Page), "myscript", script, true);
            //}
  
             
  
        }
  
        protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridEditableItem && e.Item.IsInEditMode)
            {
                GridEditableItem editedItem = e.Item as GridEditableItem;
                UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
                TextBox dataField = (userControl.FindControl("txtTypeDescription") as TextBox); 
                dataField.Focus();
            }
        }
  
        protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == RadGrid.InitInsertCommandName)
            {
                //Add new" button clicked
                e.Canceled = true;
                //Prepare an IDictionary with the predefined values
                System.Collections.Specialized.ListDictionary newValues = new
                System.Collections.Specialized.ListDictionary();
                newValues["Type"] = "0";
                //Insert the item and rebind
                e.Item.OwnerTableView.InsertItem(newValues);
            }
  
        }
  
  
  
    }
  
     
}
mathieu cupryk
Top achievements
Rank 1
 asked on 07 Aug 2012
0 answers
70 views
I need do this
http://www.telerik.com/help/aspnet-ajax/grid-commanditemtemplate.html 

Delete Selected ...
But I use resources for popus....

I need load a Popup from server side, then if user click on "OK", delete selected rows!

How  can  I do this?
July
Top achievements
Rank 2
 asked on 06 Aug 2012
2 answers
119 views
I've recently upgraded our application to .net 4.0 and since then the popup calendar has basically stopped working.

See: http://freeport.ss.syntaxcom.com/calendar/calendarview.aspx?group=&RequestedDate=8/1/2012&RequestedCalendar=monthgrid

The popup displays, but the header is behind the monthview day headers and you cannot select the mini-calendar dates as it's technically displaying behind the monthview's day entries.

I've tried various css options with no success.  I've seen this issue has popped up before in the forums, but I've not found a solution that works.  Any ideas?

Note: The current version of Telerik in the project is: 2012.2.724.40
Janean Angeles
Top achievements
Rank 1
 answered on 06 Aug 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?