Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
324 views
I have a grid that is setup very similar to the example for Grid / Hierarchy with Templates.

That is I have a RadGrid with a NestedViewTemplate.  In that template I have an asp:Panel and in that I have a RadTabStrip.  The first page view contains a label with a key value for EmployeeID and a RadGrid that uses that label to get the data and populate that grid.  Just like the example.

However, I need to edit and insert items into that grid that is in the first tab of the strip in the nested view.  I have  an ascx file that I'm using for that purpose.  Edit works just fine.  When I insert, however, I need to access that value from the label to put in the database as the foreign key.  The insert function seems to wipe all the data from the binding expressions used in the ascx page.  All of the code samples I've seen don't cover the ascx file for inserts.

<MasterTableView DataSourceID="SqlDataSource1" DataKeyNames="EmployeeID" AllowMultiColumnSorting="True" 
                GroupLoadMode="Server">  
                <NestedViewTemplate> 
                    <asp:Panel runat="server" ID="InnerContainer" CssClass="viewWrap" Visible="false">  
                        <telerik:RadTabStrip runat="server" ID="TabStip1" MultiPageID="Multipage1" 
                            SelectedIndex="0">  
                            <Tabs> 
                                <telerik:RadTab runat="server" Text="Sales" PageViewID="PageView1">  
                                </telerik:RadTab> 
                                <telerik:RadTab runat="server" Text="Contact Information" PageViewID="PageView2">  
                                </telerik:RadTab> 
                                <telerik:RadTab runat="server" Text="Statistics Chart" PageViewID="PageView3">  
                                </telerik:RadTab> 
                            </Tabs> 
                        </telerik:RadTabStrip> 
                        <telerik:RadMultiPage runat="server" ID="Multipage1" SelectedIndex="0" RenderSelectedPageOnly="false">  
                            <telerik:RadPageView runat="server" ID="PageView1">  
                                <asp:Label ID="Label1" Font-Bold="true" Font-Italic="true" Text='<%# Eval("EmployeeID") %>' 
                                    Visible="false" runat="server" /> 
                                <telerik:RadGrid runat="server" ID="OrdersGrid" DataSourceID="SqlDataSource2" 
                                    ShowFooter="true" AllowSorting="true" EnableLinqExpressions="false">  
                                    <MasterTableView ShowHeader="true" AutoGenerateColumns="False" AllowPaging="true" 
                                        DataKeyNames="OrderID" PageSize="7" HierarchyLoadMode="ServerOnDemand"

To use the ID's from the example, I need the OrdersGrid to function where the insert form is an ascx page and it needs to know the value of Label1 in PageView1.  Oh, and my OrdersGrid doesn't have any detail tables.

The ascx page has a button on it:
<asp:Button ID="btnUpdate"    
                    Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update"%>'   
                    runat="server"   
                    CommandName='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'   
                    onclick="btnUpdate_Click"/> 

and that button event needs to be able to reference the label.
protected void btnUpdate_Click(object sender, EventArgs e)  
        {  
            if (btnUpdate.Text == "Update")  
            {  
               //This works swimmingly with the bindings from the form  
            }  
            if (btnUpdate.Text == "Insert")  
            {  
               //This doesn't work because I can't pass the datakey that is in the label. Using the insert 
                command button on the grid clears the data sent to the form.  
            }  
        } 


I'm assuming I can put something in the page load event of the ascx page to access the value of that label, but I don't have any idea where to begin.

Thanks in advance.
Eyup
Telerik team
 answered on 07 Aug 2018
3 answers
456 views

Hi, I'm having troubles removing a blank row in my export file (See example1);

The only thing I have between the rows is an "EditItemTemplate" where I update the row.(check example2).
Is that what's causing it?

My export code:

            gridOrdenes.ExportSettings.IgnorePaging = true;
            gridOrdenes.ExportSettings.ExportOnlyData = true;
            gridOrdenes.ExportSettings.OpenInNewWindow = true;
            gridOrdenes.ExportSettings.HideStructureColumns = true;
            gridOrdenes.MasterTableView.ExportToExcel();

Thank you.
Vessy
Telerik team
 answered on 07 Aug 2018
2 answers
287 views

I have been struggling to get the callback function to be recognized.  My situation is that I have a javascript function that executes when a user clicks a button.  This function contains code similar to the following to open the radconfirm prompt window

 var oManager = GetRadWindowManager();
    oManager.radconfirm(pMsg, "returnFunction",400,300,"Popup Title");

 

When the user clickes either the Ok or Cancel button the following error occurs.

JavaScript runtime error: Function expected

 

The function returnFunction(arg) exsits in the same javascript file but is not recognized.

Any ideas as to the issue.

 

Andy
Top achievements
Rank 1
Iron
 answered on 06 Aug 2018
1 answer
104 views

I would like to be able to remove formatting when pasting into the spreadsheet control. I have followed the recommendation on this article.

https://docs.telerik.com/devtools/aspnet-ajax/controls/spreadsheet/how-to/pasting-data-only

However, this._content is always undefined.

What am I missing? I am using version 2016.2.607.45

Marin Bratanov
Telerik team
 answered on 06 Aug 2018
3 answers
327 views
I am looking into your editor HTML to PDF conversion demo: http://demos.telerik.com/aspnet-ajax/editor/examples/pdfexport/defaultcs.aspx and converting the editor to PDF only converts the visible content. If you scroll further down the editor content, you placed a table with browser info and graphics in it, but this data does not render to the pdf, Why?
Is this the only example you have on your site?
Is the pdf conversion tool unable to convert form elements (checkboxes, textboxes) into pdf?
What HTML elements can the generator convert to pdf?
Rumen
Telerik team
 answered on 06 Aug 2018
5 answers
198 views
I have a GridHyperLinkColumn in my radgrid that is used to link to a SSRS report on a per-row basis - I would like to add a header link button that allows the users to execute a report that generates a report of all row items (1 record per-page).  To my mind setting the HeaderImageUrl and HeaderButtonType to LinkButton should result in a HyperLink control being rendered in the header cell however that is not the case - all I get is a Image control with the referenced image I set.  It appears that setting the HeaderButtonType has no effect so I'm wondering what column types is this property valid for as it does not seem to be valid for a GridHyperLinkColumn.  Obviously I could use a template column but I thought if I could use the properties provided (HeaderImageUrl/HeaderButtonType) life could be much simpler - that appears to not be the case.

<telerik:GridHyperLinkColumn UniqueName="MemoColumn" ImageUrl="Content/Images/memo16.png" Target="_blank"
                                    HeaderImageUrl="Content/Images/memo16.png" HeaderButtonType="LinkButton">
                                    <ItemStyle HorizontalAlign="Center" Width="3%" Wrap="false" />
                                    <HeaderStyle HorizontalAlign="Center" Width="3%" />
                                </telerik:GridHyperLinkColumn>
Eyup
Telerik team
 answered on 06 Aug 2018
3 answers
355 views

I have a link button in my RadGrid. When I clicked the link button,it will pop out a new page. All is working fine without error. Here is my code:


ASP
<telerik:RadGrid ID="gvCustomer" runat="server" AllowPaging="True" AllowSorting="True"
        AutoGenerateColumns="False" CellSpacing="0" GridLines="None" Width="100%">
        <MasterTableView AllowMultiColumnSorting="True">
            <CommandItemSettings ExportToPdfText="Export to PDF" />
            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
            </RowIndicatorColumn>
            <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn column" HeaderText="Customer Name"
                    SortExpression="CUSTOMERNAME" UniqueName="TemplateColumn">
                    <ItemTemplate>
                        <asp:LinkButton ID="lnkCustomerName" runat="server" CommandArgument='<%#Eval("CUSTOMERNAME") "," +Eval("IC")+ "," +Eval("ACCNO")%>' 
   CommandName="command" Font-Underline="True" Text='<%# Bind("CUSTOMERNAME") %>'>
 </
asp:LinkButton>
                    </ItemTemplate>
                    <FooterStyle HorizontalAlign="Center" />
                    <HeaderStyle Width="25%" />
                    <ItemStyle HorizontalAlign="Left" VerticalAlign="Top" />
                </telerik:GridTemplateColumn>
            </Columns>
            <EditFormSettings>
                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                </EditColumn>
            </EditFormSettings>
            <PagerStyle AlwaysVisible="True" />
        </MasterTableView>
        <HeaderStyle HorizontalAlign="Center" />
        <PagerStyle AlwaysVisible="True" />
        <FilterMenu EnableImageSprites="False">
        </FilterMenu>
</telerik:RadGrid>

VB.NET
Protected Sub gvCustomer_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles gvCustomer.ItemCommand
 
       If e.CommandName = "command" Then
           Dim arg As String() = e.CommandArgument.ToString.Split(",")
           Dim strName As String = arg(1)
           Dim strIC As String = arg(2)
           Dim strAccountNo As String = arg(3)
 
           Dim str As String
           str = "<script language='javascript'>window.open(' " + "~/Customer.aspx?CustomerName=" & strName & "&OldIC=" & strIC & "&AccountNo=" & strAccountNo + " ');</script>"
           ClientScript.RegisterStartupScript(Me.GetType(), "script", str)
       End If
   End Sub

But after I added the RadAjaxManager to handle the RadGrid. The link button is not working anymore. The new page does not pop out. But if I remove the ajax manager will work fine,the page is post back and new page is pop out. Below is the code I added:


ASP
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="gvCustomer">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="gvCustomer" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
</telerik:RadAjaxManager>

Please help me to find out the solution.Thank you very much!
Attila Antal
Telerik team
 answered on 06 Aug 2018
4 answers
63 views

I have implemented RadGrid in my project for displaying data. But facing one severe issue, when trying to post back or going to the next page, the pager control is shifting down. In order to fix Grid height and width according to the page height and width, i have implemented bellow java script in page load. But unfortunately after post back it is not working.

                   var grid, gridHeight;
                   gridHeight = document.documentElement.offsetHeight - 130;
                   grid = $find('<%= GridControl1.FindControl("RadGrid4").ClientID %>');
                   if(grid !== null){
                        contentPane.set_height(document.documentElement.offsetHeight - 90);  
                        grid.get_element().style.height = gridHeight+ "px";
                        contentSplitter.repaint();
                        grid.repaint();
                    }
                    else{
                        contentPane.set_height(document.documentElement.offsetHeight - 75);
                    }

Kindly suggest, how to fix Grid height in post back so that pager control should not shift down or disappear.

Thanks in advance.

Dipak

Eyup
Telerik team
 answered on 06 Aug 2018
1 answer
80 views

Hi,

We are currently evaluating the use of radgrids inside a radwizard to create a wizard that needs to collect validated data during entry in tables and that needs to send the collected info to a process at the last page of the wizard (classic behavior).

The idea seems mainstream but the use of grids and grids inside a wizard is not so easy.

Here is some problems we are facing:

1)We use fully client side radgrids: their initial data is populated by passing them empty lists of objects as a DataSource.
Rows can then be added manually using a button which triggers a 'fireCommand("InitInsert", "")'. 
The users can batch edit the cells.  
Can your please provide a working exemple of a RadGrid properly set up to be used fully client side and of the proper way to get its client values?

2)We tried setting ClientDataKeyNames to get the RadGrids data more easily: manually created rows with InitInsert, even when data has been entered manually, always provide empty values using getDataKeyValue("xxx") on the row.
Which is understandable as no data is actually bound.
How to properly get data from a RadGrid which is used this way?
As for now, we get the cells with js and search them for values. :(

3)Rows can also be added programmatically. Rows containGridTemplateColumns with DropDownList EditItemTemplate: How to programmatically set a RadDropDownList value in a client side RadGrid?
<telerik:GridTemplateColumn  UniqueName="UserLanguage" SortExpression="UserLanguage" HeaderText="UserLanguage" DataField="UserLanguage" ShowFilterIcon="false" 
EditFormColumnIndex="4" ColumnEditorID="CompanyListColumnEditor">
<HeaderStyle Width="50px" />
<ItemTemplate>
<%#DataBinder.Eval(Container.DataItem, "UserLanguage")%>
</ItemTemplate>
<EditItemTemplate>
<telerik:RadDropDownList RenderMode="Lightweight" ID="UserLangDD1" runat="server"  Width="200px">
<Items>
<telerik:DropDownListItem Value="0" />
<telerik:DropDownListItem Value="F" Text="Français" />
<telerik:DropDownListItem Value="E" Text="English" />
</Items>
</telerik:RadDropDownList>
</EditItemTemplate>
</telerik:GridTemplateColumn>
I guess the problem resides in DataBinder.Eval() as no data is actually bound to the grid.
We tried setting UserLanguage with the display value ("Français" or "English") which does not work.
We tried to set UserLangDD1 with the Value (F or E) which does not work either.

4) The radWizard's Steps contain also other controls which are part of a validation group for each Step.
The validation works for these controls but does not apply to the fields of the rows which have been added to the Radgrids, despite these Column have as well Validators referencing the same ValidationGroup as the controls outside the Grids.
How to make a RadWizardStep apply RequiredFieldValidator on Grid Columns of RadGrids that it contains?

5) In a RadGrid, how not to block the user to getting out of a cell containing a Required control which has not yet been filled?
Currently, when a required control of a grid is not filled, it is forbidden to edit another control of these row, is there a workaround?

6) How to properly make a batch editable GridBoundColumn launch a popup (or equivalent) with a list of checkboxes as potential values and disallow users to actually write in this cell?

Any direction will be highly appreciated!

 

 

Daniel
Top achievements
Rank 1
 answered on 06 Aug 2018
6 answers
243 views
Just like in title, I am using TextBox set as numeric. I would like to translate error messages like "Please  enter a number."
Jacek
Top achievements
Rank 1
 answered on 03 Aug 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?