Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
130 views
Hi all,

I've got a grid more or less with the same functionality as the one that you've got in the demo "Usercontrol edit form", this page is under a Master page that has got some buttons like a search button that raises the event search and a Reload is launched with all the needed params that fills a DataSet and binds to the datagrid.
My problem is that this search is not working, the event is fired, the dataset is filled with correct data, the Grid is rebinded but it doesn't show the correct data, it doesn't reload, I tried to solve with an update panel, it works pretty good but when I try to edit a row it throws me a jscript error that says me that "can't find update panel Ctl00_00_...", and if I haven't got the update panel my search event doesn't work.

This is the content of the page:
    <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server" 
        Visible="False">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="UPPantalla">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="GridAlbaranes" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="GridAlbaranes">
                <UpdatedControls>
          
                    <telerik:AjaxUpdatedControl ControlID="GridAlbaranes" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManagerProxy>
    <div id="box_Cabecera"
<div id="datos_Izquierda">
<ol>
    <li><asp:Label ID="LblProveedor" 
        runat="server" Text="Proveedor: " Font-Names="Trebuchet MS" 
        Font-Size="Small"  CssClass="literal"></asp:Label>
    <telerik:RadComboBox runat="server" ID="CmbProveedor" DataTextField="LargeName" 
        DataValueField="Account" 
            AllowCustomText="True" width="300px"  Filter="Contains" MarkFirstMatch="True"
        ></telerik:RadComboBox ></li>
        <li><asp:Label ID="LblAno" 
        runat="server" Text="Año: " Font-Names="Trebuchet MS" 
        Font-Size="Small"  CssClass="literal"></asp:Label>
    <telerik:RadNumericTextBox ID="TxbYear" Runat="server" ShowSpinButtons="True" 
               Font-Names="Trebuchet MS" Font-Size="Small" >
        <NumberFormat DecimalDigits="0" GroupSeparator="" />
    </telerik:RadNumericTextBox></li>
  
    </ol>
</div>
<div id="datos_Derecha">
<ol>
    <li><asp:Label 
        ID="LblCentro" runat="server" Text="Centro: " Font-Names="Trebuchet MS" 
        Font-Size="Small" CssClass="literal"></asp:Label>
    <telerik:RadComboBox runat="server" ID="CmbCentro" 
        DataTextField="ProfitCenterLargeName" DataValueField="ProfitCenterCode" 
         AllowCustomText="True" 
            Width="300px" height="200px" Filter="Contains" Skin="Sunset" ></telerik:RadComboBox>
  
    </li>
    <li>        <telerik:RadButton ID="BtnSoloSinValidar" runat="server" 
            AutoPostBack="False" BorderStyle="Groove" Checked="True" Skin="Sunset" 
            Text="Solo Albaranes no validados" ToggleType="CheckBox">
        </telerik:RadButton></li>
</ol>
</div></div>
<div id="Grid">
  
    <telerik:RadGrid runat="server" Skin="Sunset" Width="90%" ID="GridAlbaranes" 
            AutoGenerateColumns="False" GridLines="None">
        <MasterTableView>
            <CommandItemSettings ExportToPdfText="Export to Pdf" />
            <RowIndicatorColumn>
                <HeaderStyle Width="20px" />
            </RowIndicatorColumn>
            <ExpandCollapseColumn>
                <HeaderStyle Width="20px" />
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridEditCommandColumn ButtonType="ImageButton">
                </telerik:GridEditCommandColumn>
                <telerik:GridBoundColumn DataField="PCNameComplet" HeaderText="Centro" 
                    UniqueName="PCNameComplet">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="SupplierName" HeaderText="Proveedor" 
                    UniqueName="SupplierName">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="IdGRN" HeaderText="Albarán" 
                    UniqueName="IdGRN">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Year" HeaderText="Año" UniqueName="year">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Cuenta" HeaderText="Cuenta" 
                    UniqueName="Cuenta">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="SupplierAccount" 
                    HeaderText="Codigo Proveedor" UniqueName="SupplierAccount" Visible="False">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ProfitCenterCode" HeaderText="ProfitCenter" 
                    UniqueName="ProfitCenter">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Amount" HeaderText="Importe" 
                    UniqueName="Amount">
                </telerik:GridBoundColumn>
            </Columns>
              <EditFormSettings  UserControlName="../UserControl/CuGRN.ascx" EditFormType="WebUserControl">
                    <EditColumn UniqueName="EditCommandColumn">
                    </EditColumn>
                </EditFormSettings>
  
        </MasterTableView>
        <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Sunset" 
            EnableImageSprites="True">
        </HeaderContextMenu>
    </telerik:RadGrid>
  
</div>

And this is the VB:
Public Class ListadoAlbaranes
    Inherits System.Web.UI.Page
    Protected WithEvents Mymaster As Site
  
  
  
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  
        Mymaster = Me.Master
        If Not Me.IsPostBack Then
            LoadCombos()
            Me.TxbYear.Text = Today.Date.Year
            CargarGrid()
        End If
  
  
    End Sub
    Public Sub LoadCombos()
        '+-----------------------------------------------------
        '| Comments: Used to load combos.
        '+-----------------------------------------------------
        Dim Usuario As ClUsuario = New ClUsuario
        Usuario = CType(Session("Usuario"), ClUsuario)
        Dim c As New AraSql
        c.SqlServer = Usuario.SqlServer("Cotejador")
        c.CommandText = "Ara_CargaMaeSupandProfCen"
        c.Ejecutar()
        c.Tables(0).Rows.Add("0", "Todos")
        CmbProveedor.DataSource = c.Tables(0)
        CmbProveedor.DataBind()
        CmbProveedor.SelectedValue = "0"
        c.Tables(1).Rows.Add("0", "Todos")
        CmbCentro.DataSource = c.Tables(1)
        CmbCentro.DataBind()
        CmbCentro.SelectedValue = 0
    End Sub
    Private Sub CargarGrid()
        Try
            Dim usuario As ClUsuario = New ClUsuario
            Dim c As New AraSql
            c.SqlServer = usuario.SqlServer("Cotejador")
            c.CommandText = "Ara_ListGRNs"
            If CmbCentro.SelectedValue <> "0" Then
                c.NewParameter("@ProfitCenterCode", SqlDbType.VarChar, Me.CmbCentro.SelectedValue)
            End If
            If CmbProveedor.SelectedValue <> "0" Then
                c.NewParameter("@SupplierAccount", SqlDbType.VarChar, Me.CmbProveedor.SelectedValue)
            End If
            c.NewParameter("@Onlyopen", SqlDbType.Bit, Me.BtnSoloSinValidar.Checked)
            c.NewParameter("@year", SqlDbType.VarChar, Me.TxbYear.Value)
            c.Ejecutar()
            Me.GridAlbaranes.Dispose()
            Me.GridAlbaranes.DataSource = c.Tables(0)
  
  
        Catch ex As Exception
        End Try
  
    End Sub
    Private Sub ReloadGrid() Handles Mymaster.MasterFind
        GridAlbaranes.DataSource = Nothing
  
        GridAlbaranes.Rebind()
  
  
    End Sub
    Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles GridAlbaranes.NeedDataSource
        CargarGrid()
    End Sub
  
  
  
End Class

Is there anyway to use the radajaxmanagerproxy to make the grid reload when the Masterfind event is raised?


Thanks in advance,
Salva Mas
Top achievements
Rank 1
 answered on 09 Dec 2010
2 answers
104 views
I don't want to display the column selection option in context menu.

I am able to do that within HeaderContextMenu_PreRender

private void HeaderContextMenu_PreRender(object sender, EventArgs e)
{
    GridHeaderContextMenu menu = sender as GridHeaderContextMenu;
    foreach (RadMenuItem item in menu.Items)
        if (item.Text == "Columns")
        {
            item.Visible = false;
        }
}

But when I click on the menu I get this error in dynamic javascript.
code line:  var h=m.findItemByValue("ColumnsContainer").get_items();
Error: Microsoft JScript runtime error: 'findItemByValue(...)' is null or not an object

Any suggestions?

thanks

smdk
Top achievements
Rank 1
 answered on 09 Dec 2010
3 answers
131 views
Hi.

I am trying to integrate RadDatePicker into my sharepoint pages.
It seems to be display correctly but when I click on calandar icon, nothing show up.  it looks like it is trying to do postback when clicked, and put "#" at the end of querystring.

Also, AjaxPanel does not seem to be working either. I don't get any errors and it just not working.. it perfroms postback when click on one of my button.

Thanks

Marshall Scipio
Top achievements
Rank 1
 answered on 09 Dec 2010
2 answers
125 views

We are using the RadScheduler with Web Services binding. On inserting a new appointment, we would like to retrieve the ID of the appointment on the client side after the Web Service request is complete. Can we retrieve this in the result sent back from the service call in the OnClientRequestSuccess method? If so, what is the best approach for doing this? We noticed that the Insert method is passing back IEnumerable<AppointmentData>. How can this data be used?

If the OnClientRequestSuccess method is not the best approach, what other options are there?

By the way, we noticed that it is possible to return a SchedulerResult object with the GetAppointments method. Can that be done with the InsertAppointment method? If so, that would solve our problem.
Jose Granja
Top achievements
Rank 1
 answered on 09 Dec 2010
3 answers
108 views
I have a stored procedure that selects two columns from a single table - size (int) and date.  All I want to do is plot a line graph with the size, and have the X axis item labels show the dates recorded.

So, the data looks like this:
 
size | date 
224 | 1-5-10 
250 | 1-10-10 
156 | 1-22-10 

And this is what I ended up with when I tried to use the Wizard (bound to a SqlDataSource):

 <telerik:RadChart ID="RadChart1" runat="server" DataSourceID="SqlDataSource1"  
                    DefaultType="Line" Skin="Default"
                    <Series> 
                        <telerik:ChartSeries Name="Size" DataYColumn="size" Type="Line"  
                            DataXColumn="size"
                            <Appearance> 
                                <FillStyle MainColor="213, 247, 255"
                                </FillStyle> 
                            </Appearance> 
                        </telerik:ChartSeries> 
                    </Series> 
                    <PlotArea> 
                        <XAxis AutoScale="False" DataLabelsColumn="size"
                            </XAxis> 
                    </PlotArea> 
                </telerik:RadChart> 

What I want is to have the dates as the X axis labels, but I can't figure out how to do it.  It seems like this should be incredibly simple, but I just find the chart syntax really confusing.  Any help would be very much appreciated.



Ves
Telerik team
 answered on 09 Dec 2010
2 answers
122 views
Style issue here:

I've got a radGrid with a Template column that contains an ASP.NET RadioButtonList (simply Yes/No radio buttons). I've turned on AllowHoverStyle in the ClientSettings of the radGrid. The entire row does hover, EXCEPT when I hover over the RadioButtonList, in which case the hover style goes away.

I'm usually pretty good with styling issues, but I'm at a loss on this one. The strange thing is I have other columns that some have buttons, images, dropdown, and hovering over any of these items does NOT make the row hover style go away; it stays and is great. It only disappears when it's over the RadioButtonList. Well technically since the RadioButtonList control renders with a table w/radio buttons inside table cells, the radGrid's hover style appears to disappear when the mouse hovers over this RadioButtonList rendered radio button or radio button's label (still works if Only over the table containing the buttons and labels)

I've already tried setting z-index on the radios and labels to inherit, but that didn't work. not sure what else would cause the full row's hover style to go away?

Any ideas are greatly appreciated. Thanks.

Paul J
Top achievements
Rank 1
 answered on 09 Dec 2010
8 answers
147 views
Hi,

I have designed a multicolumn RADGrid which displays labels. However, when I export it to PDF, it displays only in single column.
Here is the code snippet for your reference--

<telerik:RadGrid ID="grdReport" runat="server" AllowSorting="True" GridLines="None"
                                AllowPaging="True" Font-Names="Arial" Font-Size="10pt" Skin="Outlook"
                                AllowFilteringByColumn="true" PageSize="30" ShowHeader="false" EnableViewState="true"
                                OnPreRender="grdReport_PreRender" OnNeedDataSource="grdReport_NeedDataSource"
                                OnItemCommand="grdReport_ItemCommand" OnItemCreated="grdReport_ItemCreated">
                            <ExportSettings IgnorePaging="True" OpenInNewWindow="True">
                                <Pdf PageWidth="210mm" PageHeight="297mm" Author="VoltTrack" Creator="VoltTrack"
                                    Producer="VoltTrack" PageLeftMargin="0.5in" PageRightMargin="0.5in" />
                            </ExportSettings>
                            <PagerStyle Position="Top"/>
                            <MasterTableView CommandItemDisplay="Top" EnableViewState="true" TableLayout="Fixed">
                                <PagerStyle Mode="NextPrevNumericAndAdvanced" />
                                <CommandItemSettings ShowExportToPdfButton="True" ShowAddNewRecordButton="False" />
                                    <ItemTemplate>
                                        <%# (((GridItem)Container).ItemIndex != 0)? "</td></tr></table>" : "" %>
                                        <asp:Panel ID="ItemContainer" CssClass='<%# (((GridItem)Container).ItemType == GridItemType.Item)? "item" : "alternatingItem" %>'
                                            runat="server">
                                            <b><%# Eval("C_Name")%></b>
                                            <br />
                                            SSN:
                                            <b><%# Eval("SSN")%></b>
                                            W/E:
                                            <b><%# Eval("Weekend_Date")%></b>
                                            <br />
                                            Branch:
                                            <b><%# Eval("Branch")%></b>
                                            Job#:
                                            <b><%# Eval("Job_Number")%></b>
                                            <br />
                                            <b><%# Eval("Cust_Name")%></b>
                                        </asp:Panel>
                                    </ItemTemplate>
                            </MasterTableView>
                            <HeaderStyle HorizontalAlign="Center" />
                            <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">
                                <Scrolling EnableVirtualScrollPaging="True" />
                            </ClientSettings>
                        </telerik:RadGrid>

protected void grdReport_PreRender(object sender, EventArgs e)
        {
            int itemCount = (sender as RadGrid).MasterTableView.GetItems(GridItemType.Item).Length + (sender as RadGrid).MasterTableView.GetItems(GridItemType.AlternatingItem).Length;
            foreach (GridItem item in (sender as RadGrid).Items)
            {
                if (item is GridDataItem && item.ItemIndex < itemCount - 1)
                {
                    ((item as GridDataItem)["C_Name"] as TableCell).Controls.Add(new LiteralControl("<table style='display:none;width: 730px'><colgroup><col /><col /><col /></colgroup><tr><td>"));
                }
            }
        }


Can you please help?

Regards,
Krunal
Daniel
Telerik team
 answered on 09 Dec 2010
5 answers
76 views
Previous verison of the control if DecimalDigits is not set it will not force any decimal places with AllowRounding="false".
Now by default it is rounded to 2 decimal places per regional setting.

I hard coded 6 decimal places...

Pavel
Telerik team
 answered on 09 Dec 2010
0 answers
70 views
My fault. I had a javascript error on the page.

When I add the attribute OnClientSelectedIndexChanged to a RadComboBox, the pull down functionality is disabled. Unfortunately, when I create a simple example, the combo box continues to work. Something on my page is interacting with the RadComboBox.

Any Ideas?
Richard
Top achievements
Rank 1
 asked on 09 Dec 2010
4 answers
1.2K+ views
Hi

is possible to check the minimum size of uploaded file in radexplore?
Because when i upload a txt file empty 0 byte and try to open/download with Handler.ashx method:
<%@ WebHandler Language="C#" Class="Telerik.Web.Examples.FileExplorer.FilterAndDownloadFiles.Handler" %>   
  
using System;   
using System.Data;   
using System.Configuration;   
using System.Web;   
using System.Text;   
using Telerik.Web.UI;   
  
namespace Telerik.Web.Examples.FileExplorer.FilterAndDownloadFiles   
{   
    [RadCompressionSettings(HttpCompression = CompressionType.None)] // Disable RadCompression for this page ;   
    public class Handler : IHttpHandler   
    { 
        #region IHttpHandler Members   
  
        private HttpContext _context;   
        private HttpContext Context   
        {   
            get  
            {   
                return _context;   
            }   
            set  
            {   
                _context = value;   
            }   
        }   
  
  
        public void ProcessRequest(HttpContext context)   
        {   
            Context = context;   
            string filePath = context.Request.QueryString["path"];   
            filePath = context.Server.MapPath(filePath);   
  
            if (filePath == null)   
            {   
                return;   
            }   
  
            System.IO.StreamReader streamReader = new System.IO.StreamReader(filePath);   
            System.IO.BinaryReader br = new System.IO.BinaryReader(streamReader.BaseStream);   
  
            byte[] bytes = new byte[streamReader.BaseStream.Length];   
  
            br.Read(bytes, 0, (int)streamReader.BaseStream.Length);   
  
            if (bytes == null )   
            {   
                return;   
            }   
  
            streamReader.Close();   
            br.Close();   
            string extension = System.IO.Path.GetExtension(filePath);   
            string fileName = System.IO.Path.GetFileName(filePath);   
  
            if (extension == ".jpg")   
            { 
                WriteFile(bytes, fileName, "image/jpeg jpeg jpg jpe", context.Response);   
            }   
            else if (extension == ".gif")   
            { 
                WriteFile(bytes, fileName, "image/gif gif", context.Response);   
            } 
            else if (extension == ".png"
            { 
                WriteFile(bytes, fileName, "image/x-png", context.Response); 
            } 
            else if (extension == ".tif"
            { 
                WriteFile(bytes, fileName, "image/tiff", context.Response); 
            }             
            else if (extension == ".pdf")   
            { 
                WriteFile(bytes, fileName, "application/pdf", context.Response);   
            }           
            else if (extension == ".png"
            { 
                WriteFile(bytes, fileName, "image/x-png", context.Response); 
            } 
 
            else if (extension == ".txt"
            { 
                WriteFile(bytes, fileName, "text/plain", context.Response); 
            } 
 
            else if (extension == ".zip"
            { 
                WriteFile(bytes, fileName, "application/zip", context.Response); 
            }  
  
        }   
  
        /// <summary>   
        /// Sends a byte array to the client   
        /// </summary>   
        /// <param name="content">binary file content</param>   
        /// <param name="fileName">the filename to be sent to the client</param>   
        /// <param name="contentType">the file content type</param>   
        private void WriteFile(byte[] content, string fileName, string contentType, HttpResponse response)               
        { 
 
                response.Buffer = true
                response.Clear(); 
                response.ContentType = contentType; 
 
                response.AddHeader("content-disposition""attachment; filename=" + fileName); 
 
                response.BinaryWrite(content); 
                response.Flush(); 
                response.End(); 
             
                            
        }   
  
        public bool IsReusable   
        {   
            get  
            {   
                return false;   
            }   
        } 
        #endregion   
    }   
}     
i receive this exeption:

Argomento specificato non compreso nell'intervallo.
Nome parametro: offset

Descrizione: Eccezione non gestita durante l'esecuzione della richiesta Web corrente. Per ulteriori informazioni sull'errore e sul suo punto di origine nel codice, vedere l'analisi dello stack.

Dettagli eccezione: System.ArgumentOutOfRangeException: Argomento specificato non compreso nell'intervallo.
Nome parametro: offset

Errore nel codice sorgente:

Riga 109:                response.AddHeader("content-disposition", "attachment; filename=" + fileName);
Riga 110:
Riga 111: response.BinaryWrite(content);
Riga 112: response.Flush();
Riga 113: response.End();

File di origine: z:\Inetpub\wwwroot\MOweb\Handler.ashx    Riga: 111


Thanks

Fabio
Fiko
Telerik team
 answered on 09 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
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
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?