Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
220 views
I have a grid setup to allow users to select multiple rows clientside, I then want to loop through the selected items (server side) and take the data from each row and add it to another table.  How can I get to the data ?  Ive tried this, but it doesnt work

private void InsertLocations()
        {
            Telerik.Web.UI.GridItemCollection gic = this.RadGrid2.SelectedItems;
            foreach (Telerik.Web.UI.GridItem gi in gic)
            {
                string location = DataBinder.Eval(gi.DataItem, "Location").ToString();
            }
                 
        }
Daniel
Telerik team
 answered on 02 Dec 2010
1 answer
68 views
I am using ASP.Net 3.5 and version 2009.3.1314.35 of the Telerik tools. When I run the page, I get the attached error (look on the right hand side of the page). As you can see, the runtime js does contain that event. 

I have the following code in my html:

<code>
<telerik:RadTabStrip ID="tsCoding" runat="server" Align="Left" MultiPageID="RadMultiPage1"
                                                                                    SelectedIndex="0" OnClientTabSelected="tsCoding_OnClientTabSelected" AutoPostBack="false"
                                                                                    CausesValidation="false" ScrollButtonsPosition="Right" BackColor="Gray">
</code>

I have the following in my js:

<code>

function tsCoding_OnClientTabSelected(sender, args) {

                var tab = args.get_tab();
                if (tab.get_tabs().get_count() != 0) {
                    tab.get_tabs().getTab(0).enable();
                    tab.get_tabs().getTab(0).select();
                }
            }


</code>

When I remove the OnClientTabSelected="tsCoding_OnClientTabSelected" from the tabstrip, the page works fine. Having it in there causes the attached error.

What do I need to do to resolve the error?
Bill
Top achievements
Rank 2
 answered on 02 Dec 2010
3 answers
149 views
I've got a site which is using the RadRotator and AsyncUpload controls for a photo album.

During development and debugging it all works fine (Win 7) but once published to the server the images do not always display and I cannot upload files - no error is given though.

Using the latest build of the controls, the temp upload directory was created first time in and files are appearing in there. I've attached the screen shots from the debug/dev box site, the published site and the uploads part from the published site.


<%@ Page Language="C#" MasterPageFile="~/MasterPageDialogs.master" AutoEventWireup="true" CodeFile="Photos.aspx.cs" Inherits="Dialogs_Photos" %>
  
<%@ MasterType VirtualPath="~/MasterPageDialogs.master" %>
  
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
  
<asp:Content ID="Content1" ContentPlaceHolderID="ContentHead" Runat="Server">
    <link href="../Rotator.css" rel="stylesheet" type="text/css" />
</asp:Content>
  
<asp:Content ID="Content2" ContentPlaceHolderID="ContentBody" Runat="Server">
    <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server"></telerik:RadAjaxManagerProxy>
      
    <script type="text/javascript">
        function GetRadWindow() {
            var oWindow = null;
            if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
            else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; //IE (and Moz az well)
            return oWindow;
        }
  
        function CloseOnReload() {
            GetRadWindow().VisibleOnPageLoad = false;
            GetRadWindow().close();
        }
  
        function RefreshParentPage() {
            GetRadWindow().BrowserWindow.location.href = GetRadWindow().BrowserWindow.location.href;
        }
    </script>  
  
      
    <telerik:RadAjaxManagerProxy ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="thumbRotator">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="imgPhoto" />
                    <telerik:AjaxUpdatedControl ControlID="detailsPanel" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="ibtnSavePhoto">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="ibtnSavePhoto" />
                    <telerik:AjaxUpdatedControl ControlID="thumbRotator" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="ibtnDeletePhoto">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="ibtnDeletePhoto" />
                    <telerik:AjaxUpdatedControl ControlID="thumbRotator" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManagerProxy>
  
    <asp:Label ID="lblPhotoType" runat="server" Text="" style="display:none"></asp:Label>
    <asp:Label ID="lblPhotoKey" runat="server" Text="" style="display:none"></asp:Label>
    <asp:Label ID="lblPhotoSubKey" runat="server" Text="" style="display:none"></asp:Label>
      
    <table width="743" cellpadding="0" cellspacing="0" border="0">
        <tr>
            <td style="height: 22px">
                <img src="../Images/Rotator/white.gif" height="22" width="60" alt="" style="float: left;" /></td>
            <td style="height: 22px">
                <img src="../Images/Rotator/cornerLeftTop.gif" height="22" width="50" alt="" style="float: left;" /></td>
            <td style="height: 22px">
                <img src="../Images/Rotator/topLeft.gif" height="22" width="292" alt="" style="float: left;" /></td>
            <td style="height: 22px">
                <img src="../Images/Rotator/topRight.gif" height="22" width="280" alt="" style="float: left;" /></td>
            <td style="height: 22px">
                <img src="../Images/Rotator/cornerRightTop.gif" height="22" width="62" alt="" style="float: left;" /></td>
        </tr>
        <tr>
            <td>
                <img src="../Images/Rotator/whiteMiddle.gif" height="243" width="60" alt="" style="float: left;" /></td>
            <td>
                <img src="../Images/Rotator/leftFrame.gif" height="243" width="50" alt="" style="float: left;" /></td>
            <td class="previewPane">
                <div style="margin-top: 20px">
                    <telerik:RadBinaryImage ID="imgPhoto" runat="server" Height="192" Width="192" ResizeMode="Fit"  ImageAlign="Middle" />
  
                </div>
            </td>
            <td class="infoPane">
                <div class="infoPaneBg" runat="server" id="detailsPanel">
                    <div class="imageDetailsHeader">
                        <table width="100%">
                            <tr>
                                <td width="70%">
                                    Image details:
                                </td>
                                <td width="15%" align="center">
                                    <asp:ImageButton ID="ibtnSavePhoto" runat="server" 
                                        ImageUrl="~/Images/Save.png" onclick="ibtnSavePhoto_Click" />
                                </td>
                                <td width="15%" align="center">
                                    <asp:ImageButton ID="ibtnDeletePhoto" runat="server" 
                                        ImageUrl="~/Images/Delete.png" onclick="ibtnDeletePhoto_Click" />
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div id="viewPanel">
                        <div class="details">
                            <strong>Title:</strong>
                            <asp:Label ID="lblPhotoID" runat="server" Text="" style="display:none"></asp:Label>
                            <asp:TextBox ID="txtPhotoTitle" runat="server" Text=""></asp:TextBox>
                        </div>
                        <div class="details">
                            <strong>Description:</strong>
                            <asp:TextBox ID="txtPhotoDescription" runat="server" Text=""></asp:TextBox>
                        </div>    
                        <div class="details">
                              
                        </div>    
                        <div class="details" style="margin-top: 5px; margin-left: 28px">
                                  
                        </div>
                    </div>
                </div>
            </td>
            <td>
                <img src="../Images/Rotator/rightFrame.gif" height="243" width="62" alt="" style="float: left;" /></td>
        </tr>
        <tr>
            <td>
                <img src="../Images/Rotator/whiteShadow.gif" height="117" width="60" alt="" /></td>
            <td>
                <img src="../Images/Rotator/left.gif" id="img_left" height="117" width="50" alt="" style="cursor: pointer" /></td>
            <td colspan="2" class="thumbsViewer">
                <telerik:RadRotator ID="thumbRotator" runat="server" RotatorType="ButtonsOver" Width="572"
                    Height="118px" ItemHeight="118" ItemWidth="145" FrameDuration="1" ScrollDirection="Left,Right" 
                    DataSourceID="dsThumbnails" OnItemClick="ShowImage">
                    <ItemTemplate>
                        <div class="itemTemplate">
                            <asp:Label runat="server" ID="lblPhotoID" Text='<%# Eval("PhotoID") %>' style="display:none"></asp:Label>
                            <asp:Label runat="server" ID="lblTitle" Text='<%# Eval("Title") %>' style="display:none"></asp:Label>
                            <asp:Label runat="server" ID="lblDescription" Text='<%# Eval("Description") %>' style="display:none"></asp:Label>
                            <telerik:RadBinaryImage ID="imgHiddenPhoto" runat="server" DataValue='<%# Eval("PhotoFile") %>'  style="display:none"/>
                            <telerik:RadBinaryImage ID="imgThumbnail" runat="server" 
                                DataValue='<%# Eval("Thumbnail") %>' Height="118px" Width="118px" ResizeMode="Fit" 
                                CssClass="RotatorImage" AlternateText='<%# Eval("Title") %>' ToolTip='<%# Eval("Title") %>' />
                        </div>
                    </ItemTemplate>
                    <ControlButtons LeftButtonID="img_left" RightButtonID="img_right" />
                </telerik:RadRotator>
            </td>
            <td>
                <img src="../Images/Rotator/right.gif" id="img_right" height="117" width="62" alt="" style="cursor: pointer" /></td>
        </tr>
    </table>
  
          
    <asp:SqlDataSource ID="dsThumbnails" runat="server" 
        ConnectionString="<%$ ConnectionStrings:EventMgmtCSDev %>" 
          
        SelectCommand="SELECT [PhotoID], [Thumbnail], [PhotoFile], [Title], [Description] FROM [Photos] WHERE (([PhotoKey] = @PhotoKey) AND ([PhotoType] = @PhotoType) AND ([PhotoSubKey] = @PhotoSubKey))">
        <SelectParameters>
            <asp:ControlParameter ControlID="lblPhotoKey" Name="PhotoKey" 
                PropertyName="Text" Type="Int64" />
            <asp:ControlParameter ControlID="lblPhotoType" Name="PhotoType" 
                PropertyName="Text" Type="String" />
            <asp:ControlParameter ControlID="lblPhotoSubKey" Name="PhotoSubKey" 
                PropertyName="Text" Type="Int64" />
        </SelectParameters>
    </asp:SqlDataSource>
      
    <br />
      
    <asp:Button ID="btnUploadPhotos" runat="server" Text="Upload Photos"/>
  
  
    <telerik:RadToolTip ID="ToolTipAddQuote" runat="server" Width="300px" Height="300px" 
        TargetControlID="btnUploadPhotos" Position="Center" RelativeTo="BrowserWindow"
        HideEvent="ManualClose" ShowEvent="OnClick" Animation="Slide" AnimationDuration="1000">
          
        <telerik:RadProgressManager runat="server" ID="RadProgressManager1" />
          
        <table width="90%">
            <tr>
                <td>
                    <telerik:RadAsyncUpload runat="server" ID="AsyncUpload1"
                        MultipleFileSelection="Automatic" TemporaryFileExpiration="0:15:00">
                    </telerik:RadAsyncUpload>
                </td>
                <td align="right">
                    <asp:Button ID="btnUpload" runat="server" Text="Upload Selected Files" 
                        onclick="btnUpload_Click" />
                </td>
            </tr>
        </table>
          
        <telerik:RadProgressArea runat="server" ID="RadProgressArea1">
        </telerik:RadProgressArea>
  
    </telerik:RadToolTip>
  
  
      
</asp:Content>

Code Behind:
using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
  
public partial class Dialogs_Photos : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            lblPhotoType.Text = HttpContext.Current.Request.QueryString["PhotoType"];
            lblPhotoKey.Text = HttpContext.Current.Request.QueryString["PhotoKey"];
            lblPhotoSubKey.Text = HttpContext.Current.Request.QueryString["PhotoSubKey"];
        }
    }
  
    protected void ShowImage(object sender, RadRotatorEventArgs e)
    {
        if (e.Item is RadRotatorItem)
        {
            RadRotatorItem rotatorItem = (RadRotatorItem)e.Item;
            string PhotoID = (rotatorItem.FindControl("lblPhotoID") as Label).Text;
            string strTitle = (rotatorItem.FindControl("lblTitle") as Label).Text;
            string strDescription = (rotatorItem.FindControl("lblDescription") as Label).Text;
            RadBinaryImage thumbNail = (rotatorItem.FindControl("imgHiddenPhoto") as RadBinaryImage);
            imgPhoto.ImageUrl = thumbNail.ImageUrl;
            lblPhotoID.Text = PhotoID;
            txtPhotoTitle.Text = strTitle;
            txtPhotoDescription.Text = strDescription;
        }
    }
  
    protected void btnUpload_Click(object sender, EventArgs e)
    {
        foreach (UploadedFile f in AsyncUpload1.UploadedFiles)
        {
            byte[] photo = EM_Functions.GetFileBytes(f.InputStream);
            photo = EM_Functions.ResizeImage(photo, 400);
            byte[] thumbnail = EM_Functions.ResizeImage(photo, 115);
            string fileType = EM_Functions.GetFileType(f.FileName);
            EM_Data.UploadPhoto(lblPhotoType.Text, int.Parse(lblPhotoKey.Text), 
                                int.Parse(lblPhotoSubKey.Text), photo, thumbnail, f.FileName, fileType, 
                                photo.Length, f.FileName, User.Identity.Name);
        }
  
        AsyncUpload1.Dispose();
        thumbRotator.DataBind();
    }
  
    protected void ibtnDeletePhoto_Click(object sender, ImageClickEventArgs e)
    {
        EM_Data.DeletePhoto(int.Parse(lblPhotoID.Text));
        thumbRotator.DataBind();
    }
  
    protected void ibtnSavePhoto_Click(object sender, ImageClickEventArgs e)
    {
        EM_Data.SavePhoto(int.Parse(lblPhotoID.Text), txtPhotoTitle.Text, txtPhotoDescription.Text);
        thumbRotator.DataBind();
    }
}

Simon
Telerik team
 answered on 02 Dec 2010
2 answers
197 views
Hello, I have a Master page with a ScriptManager for my RadPanel and in my content page I need a ScriptManager for my RadToolTipManager. But when I do that I have a error telling that I can only have one ScriptManager. So if I remove my ScriptManager in my content page, it's telling me that the RadToolTipManager need a ScriptManager to work. Is there a solution to my problem.

Thanks

Keven
Keven
Top achievements
Rank 1
 answered on 02 Dec 2010
2 answers
102 views
Hello,

I have a shared user control.  This UC is in one page and everything works fine.  In the second page, the RadTextBox client-API get_value() method reports "", when it has a legitimate value.  There is very little javascript on that page, and it's not targeting textboxes; it's in a page with 6 tabs.  The controls work fine; I have RadCombo's and the drop downs work as you would expect.  But no text, no selected value, nothing is being reported (I have a script to check if the page is an empty form).  How do I even debug this to figure out what is going on, and why the value isn't being reported?

Thanks.
Brian Mains
Top achievements
Rank 1
 answered on 02 Dec 2010
1 answer
100 views
Hello,
in my web application I have a problem using GridSettingsPersister. In the applcation I have different RadGrid and I want let the user modify them (move columns, change column order/visibility/size). So i followed the instruction at http://demos.telerik.com/aspnet-ajax/grid/examples/programming/savinggridsettingsonperuserbasis/defaultcs.aspx.

I want the user to access a single page where he can choose which RadGrid to modify. After he choses the RadGrid, the application loads the chosen view grid into a panel and let the user modify it. After that we can save the configuration string in database.

I've used the GridSettingsPersister class of the example.

My problem is this:
- I choose the radgrid and load the radgrid to modify into the panel
- I modify some column visibility  (show only 3 columns for example)
- I correctly save the settings into db
- I load the configuration from database string (here all works fine)
- I add visibility to another column and retry to save
- Now I load the settings from the database string instead of havinf 4 columns I see all columns of grid (it seems a wrong configuration string has been saved into database)

I use the following code to:
-load configuration
public static void LoadGridConfiguration(RadGrid pRdg, long pIdGruppoUtente, bool loadDefaultString = false)
   {
       GridSettingsPersister gsp = new GridSettingsPersister(pRdg);
 
       using (DMWEntities context = new DMWEntities())
       {
           long idControlloAspx = (from ctrl in context.ControlliAspx
                                   where (ctrl.NomeControllo == pRdg.ID)
                                   select ctrl.IdControlloAspx).SingleOrDefault();
 
           if (idControlloAspx == 0)
           {
               throw new Exception("Grid Control not defined in database [ControlliAspx]");
           }
 
           var stringaConfigurazioneGruppoUtente = (from pg in context.ProprietaGriglie
                                                    where (pg.IdControlloAspx == idControlloAspx) && (pg.IdGruppoUtente == pIdGruppoUtente)
                                                    select new { pg.StringaConfigurazione, pg.StringaConfigurazioneDefault }).FirstOrDefault();
 
           if (loadDefaultString)
           {
               gsp.LoadSettings(stringaConfigurazioneGruppoUtente.StringaConfigurazioneDefault);  
           }
           else
           {
               gsp.LoadSettings(stringaConfigurazioneGruppoUtente.StringaConfigurazione);
           }
       }
   }

-save configuration
protected void btnPersistConfiguration_Clicked(object sender, EventArgs e)
    {
        MachinaWeb.ServerControls.RadPageView paginaConComboIdGruppoUtente = (MachinaWeb.ServerControls.RadPageView)((System.Web.UI.Control)MachinaWeb.ServerControls.Utility.FindControlType((Control)sender, typeof(MachinaWeb.ServerControls.RadPageView)));
        MachinaWeb.ServerControls.RadGrid gridUC = (MachinaWeb.ServerControls.RadGrid)((System.Web.UI.Control)MachinaWeb.ServerControls.Utility.FindControlType((Control)sender, typeof(MachinaWeb.ServerControls.RadGrid)));
 
        long selectedGU = long.Parse( ((RadComboBox)paginaConComboIdGruppoUtente.FindControl("blccmbGruppoUtente")).SelectedValue );
 
        //MessageBox.ShowTelerik(Page, this, "Configurazione salvata (Id Gruppo " + blccmbGruppoUtente.SelectedValue + ")");
 
        string gridName = gridUC.ID;
 
        using (DMWEntities context = new DMWEntities())
        {
            long idControlloAspx = (from ctrl in context.ControlliAspx
                                    where (ctrl.NomeControllo == gridName)
                                    select ctrl.IdControlloAspx).SingleOrDefault();
 
            if (idControlloAspx == 0)
            {
                throw new Exception("Grid Control not defined in database [ControlliAspx]");
            }
 
 
            var propGriglia = (from pg in context.ProprietaGriglie
                               where (pg.IdControlloAspx == idControlloAspx) && (pg.IdGruppoUtente == selectedGU)
                               select pg).FirstOrDefault();
 
 
            GridSettingsPersister gsp = new GridSettingsPersister(gridUC);
            string stringaConfigurazioneVista = gsp.SaveSettings();
 
            if (propGriglia == null)
            {
                //Creates row in database [Proprieta griglie]
                ProprietaGriglie pgNew = new ProprietaGriglie() { IdGruppoUtente = selectedGU, NomeGriglia = gridName, StringaConfigurazione = stringaConfigurazioneVista, IdControlloAspx = idControlloAspx, DataCreazione = DateTime.Now, DataAggiornamento = DateTime.Now, IdUtente = ((SessionInformation)Session["sessionData"]).IdUtente };
                context.ProprietaGriglie.AddObject(pgNew);
                context.SaveChanges();
            }
            else
            {
                //Updates row [Proprieta griglie]
                var pg = (from pgUpd in context.ProprietaGriglie
                          where (pgUpd.IdControlloAspx == idControlloAspx) && (pgUpd.IdGruppoUtente == selectedGU)
                          select pgUpd).Single();
 
                pg.StringaConfigurazione = stringaConfigurazioneVista;
                context.SaveChanges();
            }
 
        }
    }

-this is the code behind of my page
public partial class Configurazione_VisteTabellari : System.Web.UI.Page
{
    private RadGrid rdg = new RadGrid();
 
    protected void Page_Init(object sender, EventArgs e)
    {
        hfdIdCultura.Value = ((SessionInformation)Session["sessionData"]).IdCultura.ToString();
    }
 
    protected override void InitializeCulture()
    {
        System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(((SessionInformation)Session["sessionData"]).Cultura);
        System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(((SessionInformation)Session["sessionData"]).Cultura);
        base.InitializeCulture();
    }
 
 
    protected void Page_Load(object sender, EventArgs e)
    {
        //string resource_ModificareLayoutTabella = (string)GetGlobalResourceObject("Resource", "MessaggioModificaLayoutTabella");
 
        using (DMWEntities context = new DMWEntities())
        {
            if (!String.IsNullOrEmpty(hdfIdMascheraSelezionata.Value))
            {
                long idMascheraSelezionata = long.Parse(hdfIdMascheraSelezionata.Value);
 
                string urlVisioneTabellare = (from masc in context.Maschere
                                              where masc.IdMaschera == idMascheraSelezionata
                                              select masc.UrlControlloVistaTabellare).Single<string>();
 
 
                try
                {
                    RadGridStabilimenti uc = ((RadGridStabilimenti)LoadControl(urlVisioneTabellare));
                    uc.Type = CommonParameters.RadGridType.Configurazione;
                    pnlVistaTabellare.Controls.Clear();
                    pnlVistaTabellare.Controls.Add(uc);
                }
                catch (Exception)
                { }
 
                //Loads stringa configurazione di default per la grid
                //RadGrid gridUC = ((IUserControlGrid)pnlVistaTabellare.Controls[0]).GetGrid();
 
                //if (!Page.IsPostBack)
                //{
                //    try
                //    {
                //        Utility.LoadGridConfiguration(gridUC, ((SessionInformation)Session["sessionData"]).IdGruppoUtente, true);
                //    }
                //    catch (ArgumentNullException)
                //    {
                //    }
                //}
 
                string selectedGU = (((SessionInformation)Session["sessionData"]).IdGruppoUtente).ToString();
                blccmbGruppoUtente.SelectedValue = selectedGU;
                blccmbGruppoUtente.DataBind();
                //gridUC.DataBind();
            }
        }
    }
 
    protected void rtsPagina_TabClick(object sender, RadTabStripEventArgs e)
    {
        rts_Pagina.SelectedIndex = e.Tab.Index;
        rmp_Pagina.SelectedIndex = e.Tab.Index;
    }
 
    protected void RadGridVisioniTabellari_ItemCreated(object sender, GridItemEventArgs e)
    {
        ////Sets filter's textbox width
        //if (e.Item is GridFilteringItem)
        //{
        //    //30px di differenza rispetto alla larghezza della colonna
        //    GridFilteringItem gridFilteringItem = (GridFilteringItem)e.Item;
        //    ((TextBox)(gridFilteringItem["NomeMaschera"]).Controls[0]).Width = Unit.Pixel((int)(900 - CommonParameters.GridFilterWidthDistances));
        //}
    }
    protected void btnLoadConfiguration_Click(object sender, EventArgs e)
    {
        RadGrid gridUC = ((IUserControlGrid)pnlVistaTabellare.Controls[0]).GetGrid();
        string gridName = gridUC.ID;
        GridSettingsPersister gsp = new GridSettingsPersister(gridUC);
 
        Utility.LoadGridConfiguration(gridUC, long.Parse(blccmbGruppoUtente.SelectedValue));
    }
 
}



Veli
Telerik team
 answered on 02 Dec 2010
1 answer
108 views
My problem is that when i move from radgrid page1 to page 2 DataBound event is not calling,where i have written my necessary code.

        protected void gdTools_DataBound(object sender, EventArgs e)
        {
           
            clsVehicleToolMaping vhcleToolMapping = new clsVehicleToolMaping();
            //get all tools from inventory
            DataSet ds = vhcleToolMapping.get_ToolsforMapping(int.Parse(cmbbxOffice.SelectedItem.Value));
           
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                //get all tools from ToolMapping
                DataSet ds2 = vhcleToolMapping.get_DetailsfromToolsMapping(int.Parse(ds.Tables[0].Rows[i]["SPECPARTNOID"].ToString()));
                for (int j = 0; j < ds2.Tables[0].Rows.Count; j++)
                {
                    int vrno = int.Parse(cmbbxVrnno.SelectedItem.Value);
                    if (vrno == int.Parse(ds2.Tables[0].Rows[j]["INTERNALVRNNO"].ToString()))
                    {
                        for (int k = 0; k < gdTools.Items.Count; k++)
                        {
                            if ((gdTools.Items[k][gdTools.Columns[0]].Text) == (ds.Tables[0].Rows[i]["SPECPARTNOID"].ToString()))
                            {
                                CheckBox cb = (CheckBox)gdTools.Items[k][gdTools.Columns[2]].FindControl("chkbxStatus");

                                cb.Enabled = false;
                                cb.Checked = true;
                            }
                        }
                    }
                }
            }
      }
private void fill_grid()
        {

            clsVehicleToolMaping vhcleToolMapping = new clsVehicleToolMaping();
            ds = vhcleToolMapping.get_ToolsforMapping(int.Parse(cmbbxOffice.SelectedItem.Value));
            if (ds.Tables[0].Rows.Count > 0)
            {
                gdTools.DataSource = ds;
               
            }
           

            
        }

        
        protected void gdTools_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {

            if (cmbbxVrnno.SelectedIndex > 0)
            {
                fill_grid();
                this.gdTools.DataSource = this.ds;

            }
        }
--------------------------------------
This is my Radgrid designer
----------------------------------------
<telerik:RadGrid ID="gdTools" runat="server" AllowMultiRowSelection="true" Skin="Vista"
                AllowPaging="true" PageSize="1" AutoGenerateColumns="false"
                onneeddatasource="gdTools_NeedDataSource"
                    onitemdatabound="gdTools_ItemDataBound" ondatabound="gdTools_DataBound">
                    <MasterTableView >
                        <Columns>
                            <telerik:GridBoundColumn UniqueName="SPECPARTNOID" SortExpression="SPECPARTNOID"
                              HeaderText="SPECPARTNOID" DataField="SPECPARTNOID" ReadOnly="true" >
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn UniqueName="COMMODITY" SortExpression="COMMODITY"
                              HeaderText="COMMODITY" DataField="COMMODITY" ReadOnly="true" >
                            </telerik:GridBoundColumn>
                            <telerik:GridTemplateColumn HeaderText="Status" UniqueName="MyTemplateColumn">
                                <ItemTemplate>
                                    <asp:CheckBox id="chkbxStatus" runat="server" >
                                    </asp:CheckBox>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                        </Columns>
                    </MasterTableView>
                </telerik:RadGrid>

           i have tried  the databound event code in item_databound event but the problem is that

for (int k = 0; k < gdTools.Items.Count; k++)

when the control goes to the above code count is always shown as zero.so events are not happening that are inside the for loop

        
Tsvetoslav
Telerik team
 answered on 02 Dec 2010
1 answer
75 views
Hai


I need to bind lacs of record to a radgrid. Instead of binding all records in need data source at i am binding only 10 records to the first page. When the user clicks on pagination link, i fetch the next set of rows from db and bind it to the radgrid. I pass the row start and ending position as argument to the database. It will work fine if the record count is less.When i increase the data the performance is slow. How can i increase the speed.

In SP i create a temp table to select the top rows And from the temptable i get the last 10 rows that i required for the particular page. 

Is there any way to select the row between the particular row number?


Thanks

Tsvetoslav
Telerik team
 answered on 02 Dec 2010
0 answers
83 views
RESOLVED: See notes blow.

Dynamically adding a RadEditor to the page and then calling set_mode() in the OnClientLoad event causes RadEditor to render abnormally.

I've attached a screenshot of this behavior. Here is the code to reproduce the issue:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
 
<%@ Register Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" TagPrefix="telerik" %>
 
<script runat="server" language="vbscript">
    Protected Sub btn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn.Click
        Dim div As New HtmlGenericControl("div")
        div.Style("height") = "300px"
        div.Style("border") = "1px solid #f00"
 
        Dim edt As New RadEditor()
        edt.Height = Unit.Pixel(300)
        edt.OnClientLoad = "function(editor,args){ editor.set_mode(1); }"
        div.Controls.Add(edt)
        pnl.Controls.Add(div)
    End Sub
</script>
 
<!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">
    <asp:ScriptManager runat="server" />
    <asp:Panel runat="server" ID="pnl">
        <asp:Button runat="server" ID="btn" Text="Load Controls" />
    </asp:Panel>
    <telerik:RadAjaxManager runat="server" DefaultLoadingPanelID="loading">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="pnl">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="pnl" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel runat="server" ID="loading">
        Loading...
    </telerik:RadAjaxLoadingPanel>
    </form>
</body>
</html>

Steps:
1. Click "Load Controls" button

Expected result:
RadEditor added to page with 300px height

Actual result:
RadEditor added to page with very large height

Notes:
Issue only occurs the first time "Load Controls" button is pressed. Subsequently pressing "Load Controls" will produce the expected results.

Browser: Firefox 3.6.12
Telerik version 2009.3.1314.35

------------------------------------------------------------------

Solution

I was able to resolve this issue by adding a slight delay...

setTimeout(function() { editor.set_mode(1); }, 100);
Kevin
Top achievements
Rank 1
 asked on 02 Dec 2010
1 answer
163 views
Hi together,

I have a little problem, i created a Grid with a SQL Data Source. In my Grid I display two Columns, the first is "ClassName from Table tblClass" and the second is "City" from tblCity. The selects are ok. Now if i update a row with this line

UpdateCommand="UPDATE [tblClass] SET [ClassName] = @ClassName, [FK_CityID] = 2 %> WHERE [PK_ClassID] = @original_PK_ClassID"

the Name will update with the text that i put in the textbox. But i don't know how i can tell to FK_CityID = "selected dropdown value"

In my Dropdown i have the Property ListValueField="PK_City_ID", so that means i have only to replace the fix ID that i have now with the selected dropdown value. But I have no idea how I can do it.

Can someone help me please? thanks a lot

Here is my Code

<telerik:RadGrid ID="RadGrid1" GridLines="None" runat="server" AllowAutomaticDeletes="True" Skin="Windows7" 
            AllowAutomaticInserts="True" PageSize="10" AllowAutomaticUpdates="True" AllowPaging="True"
            AutoGenerateColumns="False" DataSourceID="SessionDataSource1" OnItemUpdated="RadGrid1_ItemUpdated"
            OnItemDeleted="RadGrid1_ItemDeleted" OnItemInserted="RadGrid1_ItemInserted" OnDataBound="RadGrid1_DataBound">
            <PagerStyle Mode="NextPrevAndNumeric" />
              
            <MasterTableView Width="100%" CommandItemDisplay="TopAndBottom" DataKeyNames="PK_ClassID"
                DataSourceID="SessionDataSource1" HorizontalAlign="NotSet" AutoGenerateColumns="False">
                  
                  
                <Columns>
                    <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                        <ItemStyle CssClass="MyImageButton" />
                    </telerik:GridEditCommandColumn>
                      
<%--                    <telerik:GridBoundColumn DataField="PK_ClassID" HeaderText="ID" SortExpression="PK_ClassID"
                        UniqueName="PK_ClassID" ColumnEditorID="GridTextBoxColumnEditor1">
                    </telerik:GridBoundColumn>--%>
                      
                    <telerik:GridBoundColumn DataField="ClassName" HeaderText="Class Name" SortExpression="ClassName"
                        UniqueName="ClassName" ColumnEditorID="GridTextBoxColumnEditor2">
                    </telerik:GridBoundColumn>
                      
  
                    <telerik:GridDropDownColumn DataField="FK_CityID" DataSourceID="SqlDataSource1"
                        HeaderText="City" ListTextField="City" ListValueField="PK_CityID"
                        UniqueName="PK_CityID" ColumnEditorID="GridDropDownColumnEditor1">
                    </telerik:GridDropDownColumn>
  
  
                    <telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                        UniqueName="DeleteColumn">
                        <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
                    </telerik:GridButtonColumn>
                </Columns>
                  
                  
                  
                <EditFormSettings ColumnNumber="2" CaptionDataField="FK_CityID" CaptionFormatString="Bearbeiten der Klasse {0}" InsertCaption="Neue Klasse">
                   <FormTableItemStyle Wrap="False"></FormTableItemStyle>
                    <FormCaptionStyle CssClass="EditFormHeader"></FormCaptionStyle>
                    <FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="3" BackColor="White"
                        Width="100%" />
                    <FormTableStyle CellSpacing="0" CellPadding="2" Height="110px" BackColor="White" />
                    <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle>
                    <EditColumn ButtonType="ImageButton" InsertText="Insert Order" UpdateText="Update record"
                        UniqueName="EditCommandColumn1" CancelText="Cancel edit">
                    </EditColumn>
                    <FormTableButtonRowStyle HorizontalAlign="Right" CssClass="EditFormButtonRow"></FormTableButtonRowStyle>
                </EditFormSettings>
            </MasterTableView>
            <ClientSettings>
                <ClientEvents OnRowDblClick="RowDblClick" />
            </ClientSettings>
        </telerik:RadGrid>
  
        <telerik:GridTextBoxColumnEditor ID="GridTextBoxColumnEditor1" runat="server" TextBoxStyle-Width="200px" />
        <telerik:GridTextBoxColumnEditor ID="GridTextBoxColumnEditor2" runat="server" TextBoxStyle-Width="150px" />
        <telerik:GridDropDownListColumnEditor ID="GridDropDownColumnEditor1" runat="server" DropDownStyle-Width="110px" />
        <telerik:GridNumericColumnEditor ID="GridNumericColumnEditor1" runat="server" NumericTextBox-Width="40px" />
       
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server"></telerik:RadWindowManager>
        <br />
  
        <asp:SqlDataSource ID="SessionDataSource1" runat="server" ConnectionString="Server=.\SQLExpress ;Database=IntraIBZ;Trusted_Connection=True;"
            ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM [tblClass]"
            DeleteCommand="DELETE FROM [tblClass] WHERE [PK_ClassID] = @original_PK_ClassID" 
            InsertCommand="INSERT INTO tblClass(ClassName, FK_CityID) VALUES (@ClassName, @FK_CityID)"
            UpdateCommand="UPDATE [tblClass] SET [ClassName] = @ClassName, [FK_CityID] = 2 %> WHERE [PK_ClassID] = @original_PK_ClassID"
            OldValuesParameterFormatString="original_{0}" ConflictDetection="CompareAllValues">
            <DeleteParameters>
                <asp:Parameter Name="original_PK_ClassID" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="ClassName" Type="String" />
                <asp:Parameter Name="FK_CityID" Type="Int32" />
                <asp:Parameter Name="original_PK_ClassID" Type="Int32" />
                <asp:Parameter Name="PK_CityID" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
            </InsertParameters>
</asp:SqlDataSource>
  
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Server=.\SQLExpress ;Database=IntraIBZ;Trusted_Connection=True;"
            ProviderName="System.Data.SqlClient" SelectCommand="SELECT [PK_CityID], [City] FROM [tblCity]">
        </asp:SqlDataSource>
  
  
                <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
  
            <script type="text/javascript">
                function RowDblClick(sender, eventArgs) {
                    sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
                }
            </script>
  
        </telerik:RadCodeBlock>
Tsvetoslav
Telerik team
 answered on 02 Dec 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?