Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
96 views
Hello,

I tried to implement batch updates. In my first try I used following article:

http://www.telerik.com/help/aspnet-ajax/grid-performing-batch-updates.html

I only used different table from Northwind database and used checkboxes for update.

Here you can see my code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
 
        <telerik:radgrid ID="RadGrid1" runat="server" AllowMultiRowEdit="True" DataSourceID="SqlDataSource1"
  OnItemCommand="RadGrid1_ItemCommand"
    OnItemDataBound="RadGrid1_ItemDataBound">
  <MasterTableView DataKeyNames="ProductID" AutoGenerateColumns="false" EditMode="InPlace"
    CommandItemDisplay="TopAndBottom">
    <Columns>
      <telerik:gridboundcolumn ReadOnly="true" DataField="ProductID" UniqueName="ProductID"
        HeaderText="ProductID">
      </telerik:gridboundcolumn>
      <telerik:gridboundcolumn ReadOnly="true" DataField="ProductName" UniqueName="ProductName"
            HeaderText="ProductName">
      </telerik:gridboundcolumn>
      <telerik:GridCheckBoxColumn DataField="Discontinued" DefaultInsertValue=""
                    HeaderText="Discontinued" UniqueName="Discontinued" DataType="System.int16">
      </telerik:GridCheckBoxColumn>
      <telerik:grideditcommandcolumn UniqueName="EditCommandColumn" />
    </Columns>
    <CommandItemTemplate>
      <asp:Button runat="server" ID="UpdateAll" Text="Update All" CommandName="UpdateAll" /></CommandItemTemplate>
  </MasterTableView>
</telerik:radgrid>
<asp:SqlDataSource ID="SqlDataSource1"
            ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
            SelectCommand="SELECT [ProductID], [ProductName], [Discontinued] FROM [Products]"
  runat="server"></asp:SqlDataSource>
    </div>
    </form>
</body>
</html>

using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
 
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
 
    protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
    {
        if (e.CommandName == "UpdateAll")
        {
            foreach (GridEditableItem editedItem in RadGrid1.EditItems)
            {
                Hashtable newValues = new Hashtable();
                //The GridTableView will fill the values from all editable columns in the hash
                e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem);
                SqlDataSource1.UpdateCommand = String.Format("Update Products SET Discontinued='{0}' WHERE ProductID='{1}'"
                    , newValues["Discontinued"], editedItem.GetDataKeyValue("ProductID").ToString());
                SqlDataSource1.Update();
                editedItem.Edit = false;
            }
        }
        RadGrid1.Rebind();
    }
 
    protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridDataItem && e.Item.IsInEditMode)
        {
            GridDataItem dataItem = e.Item as GridDataItem;
            //Hides the Update button for each edit form
            dataItem["EditCommandColumn"].Controls[0].Visible = false;
        }
    }
}

It seems that batch update does not work. When I click edit I can change checkbox value but when I click edit on second record change I did disappers. somhow it is not remembered. Can you fix this problem, please?
Angel Petrov
Telerik team
 answered on 28 Nov 2012
1 answer
47 views
By and large the RadEditor control is working very well in our project.

There is one little annoyance.  We run the control with the EditModes="Design".  In this condition, the editor displays a thick featureless grey bar at the bottom.  This is wasted space are far as we're concerned.

Is there any way to get rid of this?  
Rumen
Telerik team
 answered on 28 Nov 2012
1 answer
86 views
Hello,
I am looking for a way to do the following:
http://www.crateandbarrel.com/dining-and-entertaining/individual-bowls/1
In this example they are listing the appropriate data for the page, but they are also "inserting/placing" an image that spans multiple rows and columns that may or may not be part of the dataset.
Has anyone done this with the RadListView or another telerik control?
Thanks.
Galin
Telerik team
 answered on 28 Nov 2012
1 answer
39 views
Hi All,

On my first page of listview i have 10 items with check box in item template.
Suppose user has checked 2 checkboxes and click on 2nd page index.  Then we prompt user that "few items are selected in current page
take appropiate action" in rad window.
If user select any action by clicking on "button".  page index should not be changed because we want item value for checked items.
But if user select "cancel button" then page index should be changed.

How to achieve this functionality in C#?

Thanks,
Dipal

Andrey
Telerik team
 answered on 28 Nov 2012
4 answers
1.4K+ views
I have the following grid:
<telerik:RadGrid ID="RadGridAziendeForUser" runat="server" DataSourceID="ObjectDataSourceAziendeUtente" 
                EnableEmbeddedSkins="False" GridLines="None" Skin="MachinaWeb" AllowAutomaticUpdates="True" 
                AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowMultiRowSelection="True" 
                AutoGenerateEditColumn="True"  
                OnItemCommand="RadGridAziendeForUser_ItemCommand"
                <ClientSettings EnablePostBackOnRowClick="True"
                    <Selecting AllowRowSelect="True" /> 
                    <Scrolling EnableVirtualScrollPaging="True" ScrollHeight="200px" /> 
                </ClientSettings> 
                <MasterTableView AutoGenerateColumns="False" DataSourceID="ObjectDataSourceAziendeUtente" 
                    EditMode="InPlace" CommandItemDisplay="Top" DataKeyNames="IdUtente,IdAzienda"
                    <CommandItemTemplate> 
                        <div style="float: left;"
                            <asp:LinkButton Text="Nuova Azienda" ID="Insert" runat="server" CommandName="InitInsert" /> 
                        </div> 
                    </CommandItemTemplate> 
                    <RowIndicatorColumn> 
                        <HeaderStyle Width="20px" /> 
                    </RowIndicatorColumn> 
                    <ExpandCollapseColumn> 
                        <HeaderStyle Width="20px" /> 
                    </ExpandCollapseColumn> 
                    <Columns> 
                        <telerik:GridBoundColumn DataField="IdUtente" DataType="System.Int64" HeaderText="IdUtente" 
                            ReadOnly="True" SortExpression="IdUtente" UniqueName="IdUtente" Visible="false"
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="IdUtenteAsp" HeaderText="IdUtenteAsp" SortExpression="IdUtenteAsp" 
                            UniqueName="IdUtenteAsp" DataType="System.Guid" Visible="false"
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="UserName" HeaderText="UserName" ReadOnly="True" 
                            SortExpression="UserName" UniqueName="UserName" Visible="false"
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="IdCultura" DataType="System.Int64" HeaderText="IdCultura" 
                            ReadOnly="True" SortExpression="IdCultura" UniqueName="IdCultura" Visible="false"
                        </telerik:GridBoundColumn> 
                        <telerik:GridTemplateColumn> 
                            <HeaderTemplate> 
                                <asp:Label ID="Label46" runat="server" Text="Azienda"></asp:Label> 
                            </HeaderTemplate> 
                            <EditItemTemplate> 
                                <telerik:RadComboBox ID="AziendaRadComboBox" runat="server" DataSourceID="ObjectDataSourceAzienda" 
                                    DataTextField="NomeAzienda" DataValueField="IdAzienda" SelectedValue='<%# Bind("IdAzienda") %>' 
                                    Width="120px" /> 
                            </EditItemTemplate> 
                            <ItemTemplate> 
                                <asp:Label ID="Label47" runat="server" Width="120px" Text='<%# Bind("Azienda") %>'></asp:Label> 
                            </ItemTemplate> 
                        </telerik:GridTemplateColumn> 
                        <telerik:GridTemplateColumn> 
                            <HeaderTemplate> 
                                <asp:Label ID="Label48" runat="server" Text="Cultura"></asp:Label> 
                            </HeaderTemplate> 
                            <EditItemTemplate> 
                                <telerik:RadComboBox ID="CulturaRadComboBox" runat="server" DataSourceID="ObjectDataSourceCultura" 
                                    DataTextField="Cultura" DataValueField="IdCultura" SelectedValue='<%# Bind("IdCultura") %>' 
                                    Width="70px" /> 
                            </EditItemTemplate> 
                            <ItemTemplate> 
                                <asp:Label ID="Label50" runat="server" Width="70px" Text='<%# Bind("Cultura") %>'></asp:Label> 
                            </ItemTemplate> 
                        </telerik:GridTemplateColumn> 
                        <telerik:GridTemplateColumn> 
                            <HeaderTemplate> 
                                <asp:Label ID="Label49" runat="server" Text="Gruppo"></asp:Label> 
                            </HeaderTemplate> 
                            <EditItemTemplate> 
                                <telerik:RadComboBox ID="GruppoRadComboBox" runat="server" DataSourceID="ObjectDataSourceGruppoUtente" 
                                    DataTextField="Nome" DataValueField="IdGruppoUtente" SelectedValue='<%# Bind("IdGruppo") %>' 
                                    Width="120px" /> 
                            </EditItemTemplate> 
                            <ItemTemplate> 
                                <asp:Label ID="Label51" runat="server" Text='<%# Bind("Gruppo") %>'></asp:Label> 
                            </ItemTemplate> 
                        </telerik:GridTemplateColumn> 
                        <telerik:GridTemplateColumn> 
                            <HeaderTemplate> 
                                <asp:Label ID="Label52" runat="server" Text="Stabilimento"></asp:Label> 
                            </HeaderTemplate> 
                            <EditItemTemplate> 
                                <telerik:RadComboBox ID="StabilimentoRadComboBox" runat="server" DataSourceID="ObjectDataSourceStabilimento" 
                                    DataTextField="Denominazione" DataValueField="IdStabilimento" SelectedValue='<%# Bind("IdStabilimento") %>' 
                                    Width="120px" /> 
                            </EditItemTemplate> 
                            <ItemTemplate> 
                                <asp:Label ID="Label53" runat="server" Text='<%# Bind("Stabilimento") %>'></asp:Label> 
                            </ItemTemplate> 
                        </telerik:GridTemplateColumn> 
                        <telerik:GridTemplateColumn> 
                            <HeaderTemplate> 
                                <asp:Label ID="Label54" runat="server" Text="Reparto"></asp:Label> 
                            </HeaderTemplate> 
                            <EditItemTemplate> 
                                <telerik:RadComboBox ID="RepartoRadComboBox" runat="server" DataSourceID="ObjectDataSourceReparto" 
                                    DataTextField="Reparto" DataValueField="IdReparto" SelectedValue='<%# Bind("IdReparto") %>' 
                                    Width="120px" /> 
                            </EditItemTemplate> 
                            <ItemTemplate> 
                                <asp:Label ID="Label55" runat="server" Text='<%# Bind("Settore") %>'></asp:Label> 
                            </ItemTemplate> 
                        </telerik:GridTemplateColumn> 
                        <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="DeleteColumn" 
                            ConfirmText="Do you really want to delete the selected row?" /> 
                    </Columns> 
                    <EditFormSettings> 
                        <EditColumn> 
                        </EditColumn> 
                    </EditFormSettings> 
                </MasterTableView><FilterMenu EnableEmbeddedSkins="False"
                </FilterMenu> 
                <HeaderContextMenu EnableEmbeddedSkins="False"
                </HeaderContextMenu> 
            </telerik:RadGrid> 

I want to access by code the GridTemplateColumn's HeaderTemplate Labels (for example "Label46") to change the Text property. How can I do this in C#?

Thanks.
Carlos
Top achievements
Rank 2
 answered on 28 Nov 2012
1 answer
135 views
How can i disable autocomplete option in raddatepicker? 
Shinu
Top achievements
Rank 2
 answered on 28 Nov 2012
1 answer
81 views
How can i access the input box of the raddatepicker in the client side? 
Princy
Top achievements
Rank 2
 answered on 28 Nov 2012
1 answer
69 views
hi,
i've a problem with upload file with radupload. When i do upload i've thsi message:

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and the configured application pool identity on IIS 7.5) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

I dont know as configure the access. Please help me for exaple is possible

bye
Plamen
Telerik team
 answered on 28 Nov 2012
2 answers
61 views
hi team

can i use the classic jquery (jquery ui) dialog box instead of Advanced Form for insert/edit data ?


thanks
Plamen
Telerik team
 answered on 28 Nov 2012
1 answer
70 views
I want to attachment mail so i use AsyncUpload :


 <telerik:RadAsyncUpload runat="server" ID="rad_upload" Skin="Default" OnClientFileUploadFailed="onUploadFailed"<br>                                            OnClientFileSelected="onFileSelected" OnClientFileUploaded="onFileUploaded" Culture="Arabic" TemporaryFileExpiration="00:07:00" > <Localization Select="اختر" /> </telerik:RadAsyncUpload>
 List<Attachment> attach = new List<Attachment>(); if (rad_upload.UploadedFiles != null && rad_upload.UploadedFiles.Count > 0){; foreach (UploadedFile file in rad_upload.UploadedFiles){; Attachment f = new Attachment(Server.MapPath("~/App_Data/RadUploadTemp/") + file.GetName(), file.ContentType); attach.Add(f); }

I get an exception File not found !! how attach the file with this method
Plamen
Telerik team
 answered on 28 Nov 2012
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?