Telerik Forums
UI for ASP.NET AJAX Forum
20 answers
1.2K+ views
Hi All

I have a radgrid and button (Export To pdf)

The radgrid contains the data

When I click the Export to pdf button

The datas are shown in the pdf

Before that a screen appears for open or save

if open i given it opens the pdf

If save is given then the path if asked, and then it is saved

IS THERE ANY OPTION TO AUTOMATICALLY SAVE THE PDF

-Anto
Daniel
Telerik team
 answered on 08 Nov 2016
1 answer
205 views

Hello all,

I have a Radgrid with a DeleteColumn. When I click in delete image the row dessapear but when I refresh the grid the row appear again.

I try with Datasource delete query and code behind, but OnDeleteCommand never triggered.

Code:

 

<telerik:RadGrid  ID="RGVEmpresasEnCentro" runat="server" Width="500px"
                                RenderMode="Lightweight" GridLines="None" 
                                AllowAutomaticDeletes="true"
                                AllowAutomaticInserts="true"
                                PageSize="10"
                                OnPreRender="RGVEmpresasEnCentro_PreRender"
                                OnBatchEditCommand="RGVEmpresasEnCentro_BatchEditCommand"
                                OnDeleteCommand="RGVEmpresasEnCentro_DeleteCommand"
                                AllowAutomaticUpdates="true"
                                AllowPaging="true"
                                AutoGenerateColumns="False"
                                DataSourceID="SDSEmpresasEnCentro"
                                Skin="WebBlue" >
                <MasterTableView CommandItemDisplay="TopAndBottom" DataKeyNames="id"
                    DataSourceID="SDSEmpresasEnCentro" HorizontalAlign="NotSet" EditMode="Batch" AutoGenerateColumns="False"
                    CommandItemSettings-AddNewRecordText="Insertar centro"
                    CommandItemSettings-SaveChangesText="Guardar"
                    CommandItemSettings-CancelChangesText="Cancelar"
                    CommandItemSettings-RefreshText="Refrescar"
                    NoMasterRecordsText="No hay empresas en el centro"
                    NoDetailRecordsText="No hay empresas en el centro">
                    <BatchEditingSettings EditType="Cell" />
                    <Columns>
                        <telerik:GridBoundColumn    DataField="id"
                                                    Visible="false"
                                                    DataType="System.Int32"
                                                    HeaderText="id"
                                                    SortExpression="id"
                                                    UniqueName="id"
                                                    ReadOnly="true"  />
                        <telerik:GridBoundColumn DataField="Empresa"
                            HeaderText="Empresa"
                            SortExpression="Empresa"
                            UniqueName="Empresa">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Numero"
                            HeaderText="Numero"
                            SortExpression="Numero"
                            UniqueName="Numero">
                        </telerik:GridBoundColumn>
                        <telerik:GridDateTimeColumn DataField="Desde"
                            HeaderText="Desde"
                            SortExpression="Desde"
                            UniqueName="Desde" PickerType="DatePicker" DataFormatString="{0:dd/MM/yyyy}" >
                        </telerik:GridDateTimeColumn>
                        <telerik:GridDateTimeColumn DataField="HastaEl" 
                            HeaderText="Hasta el"
                            SortExpression="HastaEl"
                            UniqueName="HastaEl"
                            PickerType="DatePicker"
                            DataFormatString="{0:dd/MM/yyyy}" >
                        </telerik:GridDateTimeColumn>
                         <telerik:GridButtonColumn
                             HeaderText="Delete" HeaderStyle-Width="50px"
                            CommandName="Delete"  Text="Delete" UniqueName="DeleteColumn">
                        </telerik:GridButtonColumn>
                    </Columns>
                </MasterTableView>
                <ClientSettings AllowKeyboardNavigation="true"></ClientSettings>
            </telerik:RadGrid>
 
        <asp:SqlDataSource ID="SDSEmpresasEnCentro" runat="server" ConnectionString="<%$ ConnectionStrings:PCMConnectionString %>"
                            SelectCommand="SELECT * From EmpresasEnCentros Where idRevisionCentros=@idRevisionCentros"
                            DeleteCommand="DELETE EmpresasEnCentros WHERE id = @id"
                            InsertCommand="INSERT INTO EmpresasEnCentros (idRevisionCentros,Empresa,Numero,Desde,HastaEl) VALUES (@idRevisionCentros,@Empresa,@Numero,@Desde,@HastaEl)"
                            UpdateCommand="UPDATE EmpresasEnCentros SET Empresa=@Empresa, Numero=@Numero,Desde=@Desde,HastaEl=@HastaEl WHERE id = @id">
            <DeleteParameters>
                <asp:Parameter Name="id" Type="Int32"></asp:Parameter>
            </DeleteParameters>
            <SelectParameters>
                <asp:parameter Name="idRevisionCentros" DefaultValue="0" type="Int32" />
            </SelectParameters>
            <InsertParameters>
                <asp:parameter Name="idRevisionCentros" type="Int32" />
                <asp:Parameter Name="Empresa" Type="String"></asp:Parameter>
                <asp:Parameter Name="Numero" Type="Int32"></asp:Parameter>
                <asp:Parameter Name="Desde" Type="DateTime"></asp:Parameter>
                <asp:Parameter Name="HastaEl" Type="DateTime"></asp:Parameter>
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="id" Type="Int32"></asp:Parameter>
                <asp:Parameter Name="Empresa" Type="String"></asp:Parameter>
                <asp:Parameter Name="Numero" Type="Int32"></asp:Parameter>
                <asp:Parameter Name="Desde" Type="DateTime"></asp:Parameter>
                <asp:Parameter Name="HastaEl" Type="DateTime"></asp:Parameter>
            </UpdateParameters>
        </asp:SqlDataSource>

 

protected void RGVEmpresasEnCentro_PreRender(object sender, EventArgs e)
    {
        RGVEmpresasEnCentro.Rebind();
        GridTableView masterTable = (sender as RadGrid).MasterTableView;
        foreach (GridColumn column in masterTable.RenderColumns)
        {
            if ((column is IGridEditableColumn) && (column as IGridEditableColumn).IsEditable && masterTable.GetBatchColumnEditor(column.UniqueName) != null)
            {
                Control container = (masterTable.GetBatchColumnEditor(column.UniqueName) as IGridColumnEditor).ContainerControl;
                if (container != null && container.Controls.Count > 0)
                {
                    (container.Controls[0] as WebControl).Width = Unit.Percentage(100);
                }
            }
        }
    }
protected void RGVEmpresasEnCentro_BatchEditCommand(object sender, GridBatchEditingEventArgs e)
    {
        foreach (GridBatchEditingCommand command in e.Commands)
        {
            if(command.Type == GridBatchEditingCommandType.Insert)
            {
                Hashtable newValues = command.NewValues;
                if(!newValues.ContainsValue(null))
                {
                    string centro = Request.QueryString["Centro"];
                    string periodo = Request.QueryString["Periodo"];
                    int idRevisionCentro =CentrosBLL.ComprobarYCrearRegistros(centro, periodo, Session["codigoSap"].ToString());
                    string empresa = newValues["Empresa"].ToString();
                    int numero = Convert.ToInt32(newValues["Numero"]);
                    DateTime desde = Convert.ToDateTime(newValues["Desde"]);
                    DateTime hasta=Convert.ToDateTime(newValues["HastaEl"]);;
                    CentrosBLL.insertEmpresaCentro(idRevisionCentro,empresa,numero,desde,hasta);
                }
                e.Canceled = true;
            }
        }
    }
    protected void RGVEmpresasEnCentro_DeleteCommand(object sender, GridCommandEventArgs e)
    {
        //Some code for delete programatically
    }
Pavlina
Telerik team
 answered on 08 Nov 2016
3 answers
184 views

I would like to customize the cell tooltip using RadTooltipManager. Is there an example somewhere? I'm using VB.NET with a SQL data source. The value I want in the tooltip is a separate value from what is displayed in the cell.

Konstantin Dikov
Telerik team
 answered on 07 Nov 2016
3 answers
975 views

Hi,

I use the spreadsheet part with much satisfaction, but since a while I get the following error

'Could not load file or assembly Telerik.Windows.Zip, Version=2016.1.106.40'

And i can't get any solution. I tried to upgrade all Telerik controls, but that didn't work yet.I will try again...

 

Can someone please help?

It breaks on the last line of my code block.

IWorkbookFormatProvider formatProvider = new XlsxFormatProvider();
 
var workbook = new EpicExcelExportManager().GetFilledWorkbook();
byte[] renderedBytes;
 
using (var ms = new MemoryStream())
{
    formatProvider.Export(workbook, ms);

 

Thanks.

John

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 07 Nov 2016
5 answers
187 views

Hi,

This is for IE11 on Widnows 7 with <meta http-equiv="X-UA-Compatible" content="IE=Edge" />

I have multiple rad editors on a page. For each of them the EditMode is set to Preview. The first editor shows correctly (cannot edit contents), all the rest of them are editable. The problem being the iframe body has contenteditable set to true for all of them except the first.

I am ina  fix over this. I reaallly need help urgently

Marin Bratanov
Telerik team
 answered on 07 Nov 2016
12 answers
272 views
I am busy with an investigation which ASP.NET grid control to use. Some of the other grid vendors have the ability of having a visual field chooser in which the end user can add and remove the colums by having a toolbox with the invisible columns.

Does the RadGrid have this functionality too?
Viktor Tachev
Telerik team
 answered on 07 Nov 2016
3 answers
82 views

Hi,

Today I have used HTML validator (https://validator.w3.org/) to check if I have any errors and found that there is summary attribute rendered inside of a table element which, according to the validator, is obsolete and instead of summary attribute, caption element should be used. Tried fixing this myself and found that however I set up GridTableView it always renders that summary attribute - internally summary attribute is always rendered. I would like to know how to solve that issue if it is possible to do so now or, if not, I would like to report it as an issue. (We are using Version 2016.2.607.45 of Telerik.Web.UI - Telerik UI for ASP.NET AJAX)

Thank you for your help.

Viktor Tachev
Telerik team
 answered on 07 Nov 2016
1 answer
150 views
I use ExternalDialogs and LinkManager.ascx
How do I set the height of the dialog, the buttons is outside the dialog. See attached image.
I have set RenderMode Lightweight and  Skin Bootstrap
Vessy
Telerik team
 answered on 07 Nov 2016
1 answer
104 views
I have just upgraded Telerik-UI. It's working correctly on my local. When i publish the project to ftp, the problem is occured. I attached the screenshot of the problem. Where is source of the problem ?
Vessy
Telerik team
 answered on 07 Nov 2016
3 answers
156 views

I have a radgrid in batchedit. The Update and Select works fine but Insert didn't.

I use a defaultValue for a Select and Insert in code behind. For a select this works fine but when i try to insert the field of Database have null v

<telerik:RadGrid  ID="RGV" runat="server" Width="500px"
                                RenderMode="Lightweight" GridLines="None" 
                                AllowAutomaticDeletes="True"
                                AllowAutomaticInserts="True"
                                PageSize="10"
                                AllowAutomaticUpdates="True"
                                AllowPaging="True"
                                AutoGenerateColumns="False"
                                DataSourceID="SDS"
                                Skin="WebBlue" >
                <MasterTableView CommandItemDisplay="TopAndBottom" DataKeyNames="id"
                    DataSourceID="SDS" HorizontalAlign="NotSet" EditMode="Batch" AutoGenerateColumns="False"
                    CommandItemSettings-AddNewRecordText="Insertar centro"
                    CommandItemSettings-SaveChangesText="Guardar"
                    CommandItemSettings-CancelChangesText="Cancelar"
                    CommandItemSettings-RefreshText="Refrescar"
                    NoMasterRecordsText="No data"
                    NoDetailRecordsText="No data">
                    <BatchEditingSettings EditType="Cell" />
                    <Columns>
                        <telerik:GridBoundColumn DataField="Empresa"
                            HeaderText="Empresa"
                            SortExpression="Empresa"
                            UniqueName="Empresa">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Numero"
                            HeaderText="Numero"
                            SortExpression="Numero"
                            UniqueName="Numero">
                        </telerik:GridBoundColumn>
                        <telerik:GridDateTimeColumn DataField="Desde"
                            HeaderText="Desde"
                            SortExpression="Desde"
                            UniqueName="Desde" >
                        </telerik:GridDateTimeColumn>
                        <telerik:GridDateTimeColumn DataField="HastaEl"
                            HeaderText="Hasta el"
                            SortExpression="HastaEl"
                            UniqueName="HastaEl" >
                        </telerik:GridDateTimeColumn>
                    </Columns>
                </MasterTableView>
                <ClientSettings AllowKeyboardNavigation="true"></ClientSettings>
            </telerik:RadGrid>
 
        <asp:SqlDataSource ID="SDS" runat="server" ConnectionString="<%$ ConnectionStrings:PCMConnectionString %>"
            SelectCommand="SELECT * From Table1 Where idRevisionCentros=@idRevisionCentros"
            InsertCommand="INSERT INTO Table1 (idRevisionCentros,Empresa,Numero,Desde,HastaEl) VALUES (@idRevisionCentros,@Empresa,@Numero,@Desde,@HastaEl)"
            UpdateCommand="UPDATE Table1 SET Empresa=@Empresa, Numero=@Numero,Desde=@Desde,HastaEl=@HastaEl WHERE id = @id">
            <SelectParameters>
                <asp:parameter Name="idRevisionCentros" type="Int32" />
            </SelectParameters>
            <InsertParameters>
                <asp:parameter Name="idRevisionCentros" type="Int32" />
                <asp:Parameter Name="Empresa" Type="String"></asp:Parameter>
                <asp:Parameter Name="Numero" Type="Int32"></asp:Parameter>
                <asp:Parameter Name="Desde" Type="DateTime"></asp:Parameter>
                <asp:Parameter Name="HastaEl" Type="DateTime"></asp:Parameter>
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="id" Type="Int32"></asp:Parameter>
                <asp:Parameter Name="Empresa" Type="String"></asp:Parameter>
                <asp:Parameter Name="Numero" Type="Int32"></asp:Parameter>
                <asp:Parameter Name="Desde" Type="DateTime"></asp:Parameter>
                <asp:Parameter Name="HastaEl" Type="DateTime"></asp:Parameter>
            </UpdateParameters>
        </asp:SqlDataSource>
    </fieldset>
protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
int idRevisionCentros = getIdRevisionCentros();//return any number, for exemple 1;
                    SDS.SelectParameters[0].DefaultValue = idRevisionCentros.ToString();//<-- Works fine
                    SDS.InsertParameters[0].DefaultValue = idRevisionCentros.ToString();//<-- Insert null in DB for this field.....
        }
    }
Konstantin Dikov
Telerik team
 answered on 07 Nov 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?