Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
63 views

Hello, i have RadCombobox with ItemTemplate (Icon  + Text):

<telerik:RadComboBox ID="rcCombo" runat="server" Width="500" >
    <ItemTemplate>
        <table>
            <tr>
                <td>
                    <span class='<%# DataBinder.Eval(Container.DataItem, "ICON") %>'>
                    </span>
                </td>
                <td>
                    <%# DataBinder.Eval(Container.DataItem, "TEXT") %>
                </td>
            </tr>
        </table>
    </ItemTemplate>
</telerik:RadComboBox>

 

and i made reorderig at first posision in Client via javascript

var combo = $find("<%= rcCombo.ClientID %>");
var items = combo.get_items();
combo.trackChanges();
var comboItem = combo.findItemByValue('value');
items.insert(0, comboItem);
comboItem.highlight();
combo.updateClientState();
combo.commitChanges();

 

and after repositioning of comboitem ItemTemplate is not showing - no ICON only simple Text.

Do i need to create ClientItemTemplate for repositioned items or any recomendation?

thanks

Yano
Top achievements
Rank 1
 asked on 08 Jun 2018
3 answers
201 views
I am getting duplicate paging (page next, page previous etc) when the Grid is setup with Bootstrap them and Lightweight render. (see attached screen capture) Any ideas?
insomnia
Top achievements
Rank 2
Iron
 answered on 08 Jun 2018
2 answers
139 views

Hello,

I have a radgrid which is bound with records from one tables. I want to bind radGantt chart in expanded grid row. Is it possible to display Gantt chart inside grid?

I have two tables, e.g. A & B

I am bindding A to grid, and I want to show it's relevant tasks with statuses in ganttchart when expand grid row. I don't want any updates on ganttchart. It is just a view purpose. Also I am not caring for predessor and successors.

Please let me know if such requirement is possible or not. If not then suggest how can I implement this functionality using any other controls.

Raghu
Top achievements
Rank 1
 answered on 08 Jun 2018
0 answers
39 views

Hello,

 

The bug can best be described as the following:

When setting a radgrid datasource with an IEnumerable, filterexpressions behave not as expected.

 

Reproduce:

Create a radgrid with EnableLinqexpressions set to true, and set its datasource to an IEnumerable. Set a filter on a column. Check the filterexpression that is being generated. Notice the filterexpressions is NOT a valid linqexpression, but has the following format: "([CustomerID] LIKE '%ALFKI%')";

Now set the datasource to a list instead of an IEnumerable. Notice that suddenly the filterexpressions that is generated is different.

 

See also your Filterexpression documentation

 

Issue:

I have a requirement where i have to set an initial filter in a grid when opening the page. But we also have export buttons on that page that use the grids filterexpression to filter a dataset for the export. This no longer worked because the filterexpression was no longer a valid linq expression. In my opinion this behavior is not very intuitive, and i could not find any documentation about it.

 

Regards,

Johan

 

Johan
Top achievements
Rank 1
 asked on 08 Jun 2018
2 answers
7.2K+ views
Hi,
I have a radgrid with several rows generated from a sql query. I want to update those rows with different statuses (update status column in a database) dependent on the result meaning that rows should be updated with different statuses. Rows in radgrid are selectable (via checkbox) and three buttons triggers three different types of updates (status update). I will try to explain scenario with pseudo code below.

Select rows you will update to status 1
Button1 clicked
{
    Update status = 1 for selected rows in radgrid
    Remove updated/selected rows from radgrid
    Reload grid with remaining rows/items
}
Select rows you will update to status 2
Button2 clicked
{
    Update status = 2 for selected rows in radgrid
    Remove updated/selected rows from radgrid
    Reload grid with remaining rows/items
}
Select rows you will update to status 3
Button3 clicked
{
    Update status = 3 for selected rows in radgrid
    Remove updated/selected rows from radgrid
    Reload grid with remaining rows/items
}

I'm using C# and asp.net so kindly translate above pseudo code to C# code.

Any kind of help/advice is highly appreciated!

Rgds,
Jesper
Sriram
Top achievements
Rank 1
 answered on 07 Jun 2018
1 answer
154 views

I am dynamically creating an ajaxified RadGrid in an asp:UpdatePanel in a user control.

The RadGrid is created in Page_Init,and the MasterTableView.CommandItemSettings.ShowExportToExcelButton set true;

The RadGrid is added to the RadAjaxManagerProxy AjaxSettings in Page_Load, in if (!Page.IsPostBack).

My problem is that after postback, the export button is not set to trigger a postback (it's not excluded from Ajax). I gather it is excluded automatically on the original page load when the RadGrid is added to the AjaxSettings, but it doesn't happen after a ajax update to the RadGrid (sorting, or filtering, for example).

I read this article, but I can't resolve my problem: Export from Ajaxified Grid

If I inspect the button in the browser before and after an ajax update this is what I see:

BEFORE:
<input name="ctl00$MainContent$ucSystems$rgSystems$ctl00$ctl02$ctl00$ExportToExcelButton" title="Export to Excel" class="rgExpXLS" id="ctl00_MainContent_ucSystems_rgSystems_ctl00_ctl02_ctl00_ExportToExcelButton" onclick="javascript:__doPostBack('ctl00$MainContent$ucSystems$rgSystems$ctl00$ctl02$ctl00$ExportToExcelButton','')" type="button" value=" ">

AFTER:

<input
name="ctl00$MainContent$ucSystems$rgSystems$ctl00$ctl02$ctl00$ExportToExcelButton"
title="Export to Excel" class="rgExpXLS" id="ctl00_MainContent_ucSystems_rgSystems_ctl00_ctl02_ctl00_ExportToExcelButton"
type="submit" value=" ">

How can I get the postback on the ExportToExcelButton after an ajax update to the RadGrid?

Marin Bratanov
Telerik team
 answered on 07 Jun 2018
1 answer
380 views

Hi,
Wonder if someone could give me a hand with a problem.  I have a radgrid with two columns.  One column is a raddropdownlist with three static items.  The user changes the dropdownlist values as required and then clicks the SAVE button which invokes a code behind function.

At this point I iterate through the rows, getting the values of the two columns to then save manually in my database.

Whilst I can get the first databound column (menuname), what ever I do the raddropdownlist returns nothing.

I've tried various options including findcontrol, mastertable getdatakeyvalues, tablecells but everything returns nothing.

                   <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False">
                        <GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>
                        <ClientSettings>
                            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                        </ClientSettings>
                        <MasterTableView EditMode="Batch">
                            <Columns>
                                <telerik:GridBoundColumn DataField="menuname" UniqueName="menuname" HeaderText="Plugin" ReadOnly="True">
                                    <HeaderStyle Width="200px" Font-Bold="True"/>
                                </telerik:GridBoundColumn>
                                <telerik:GridTemplateColumn HeaderText="Permission" DefaultInsertValue="None" UniqueName="Pluginperm" DataField="Pluginperm">
                                    <HeaderStyle Width="150px" Font-Bold="True"/>
                                    <ItemTemplate>
                                        <%# Eval("pluginperm") %>
                                    </ItemTemplate>
                                    <EditItemTemplate>
                                        <telerik:RadDropDownList ID="pluginpermRadDropDownList" runat="server" SelectedText="None" SelectedValue="None">
                                            <Items>
                                                <telerik:DropDownListItem runat="server" Text="None" ToolTip="No access" Value="N" />
                                                <telerik:DropDownListItem runat="server" Text="View" ToolTip="View only access" Value="V" />
                                                <telerik:DropDownListItem runat="server" Text="Admin" ToolTip="Full access to all options" Value="A" />
                                            </Items>
                                        </telerik:RadDropDownList>
                                    </EditItemTemplate>
                                    <HeaderStyle Width="150px"></HeaderStyle>
                                </telerik:GridTemplateColumn>
                                <telerik:GridBoundColumn FilterControlAltText="Filter column column" UniqueName="Pluginhidden" Visible="False">
                                </telerik:GridBoundColumn>
                            </Columns>
                        </MasterTableView>
                    </telerik:RadGrid>

I know "b = item("pluginperm").ToString" won't work - I've just put it in for completeness.

... in the code behind function 

          For Each item As GridDataItem In RadGrid1.Items
              Dim a As String
              Dim b As String
              a = item("menuname").Text
              b = item("pluginperm").ToString

          Next

I know "b = item("pluginperm").ToString" won't work - I've just put it in for completeness.

Any help would be really appreciated.

Craig


Marin Bratanov
Telerik team
 answered on 07 Jun 2018
0 answers
315 views

I have a grid that I want to make a specific cell only to be in edit mode and never go in view mode

 

RadGridControl.MasterTableView.BatchEditingSettings.EditType = GridBatchEditingType.Cell; (using the batcheediting with cell editing)

 

https://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/batch-editing/defaultcs.aspx

Like in this demo, I have a checkbox that I don't want to be shown in view mode, just in edit mode. Made a thing that the checkbox will work without clicking it twice(once to select the column and one to select the checkbox), it works with already saved items, but when i insert a new row the view mode doesn't display the checkbox, but the editing mode displays it.... I can't manage to show it in the view mode, so the only think is when I insert a new row to place it automatically in edit mode, can I even do this(without generating a lot of errors)?

Radu
Top achievements
Rank 1
 asked on 07 Jun 2018
3 answers
418 views

I have a RadGrid in batch edit mode, cell edit.  I'm using the events 'OnBatchEditOpened' to manipulate some of the UI before the user gets to see/use it and then 'BatchEditCellValueChanged' to run further logic.

 

I have a pair of cells in the grid, in column X, that need to be the opposite of each other's selections in the rad comboBox I'm using in the editor.  If one cell has optionA selected in row A then the other cell needs to show optionB in row B.  The issue I'm running into is that to change cell values I have been using this method:

    batchManager.changeCellValue(cellToChange, valueToUse).

This works fine...normally when I'm updating values in some OTHER grid.  But when I run this logic from the 'BatchEditCellValueChanged' method of the SAME GRID then the grid gets a bit wonky.  I already have code to avoid recursive looping.  The problem is that the grid has a set of functions that are fired in a set sequence, like opening, opened, changing, changed, closing, closed, etc.  When you cause that data flow to step INTO itself before the first is finished... it winds up leaving the edit control visible in the starting cell.

So - CellA opens in editor, I select the radComboBox option A and tab out of the cell.  This causes Telerik's event chain to start firing... it gets to 'BatchEditCellValueChanged' and runs my code.  My code then tell the SAME grid to update CellB in the other row... and that starts the grid's event chain to START OVER... before CellA's 'value changed' event is finished.  I think this is what is causing the logic issues and is making the editor, i.e. the radComboBox in CellA, to remain visible even after I exit the cell.

 

So - all that being said.  What is the 'correct' way to change cellB's in row B when cellA's value changes in rowA of the same batch edit grid?

 

Marin Bratanov
Telerik team
 answered on 07 Jun 2018
2 answers
208 views

I am attempting to place a confirm delete prompt message on a RadButton in a GridTemplateColumn.  Depending on the browser, I am getting mixed results, none of which are acceptable.

In Edge and Chrome, Pressing the delete button pops the message up, but pressing Ok or Cancel will pop the message up second time immedately, and pressing Ok or Cancel on the second message will perform the action desired (Cancel will close message and do nothing, Ok will fire DeleteCommand on server side)

In IE11, pressing the Ok or Cancel will show the confirm message only once.  Ok will run the DeleteCommand routine as expected.  However, Cancel will ignore the cancel and ALSO run the DeleteCommand routine.  

My guess is whatever is causing the issue to show a double-message in Edge or Chrome is being ignored in IE and it just fires the delete command regardless of what button was pressed on the confirm message.

Here are some code snippets:

GRID:

    <telerik:RadGrid OnItemCreated="RadGrid1_ItemCreated" ID="RadGrid1" runat="server" Skin="Simple" AllowPaging="True" AllowSorting="true" >
        <ClientSettings>
            <Scrolling AllowScroll="true" UseStaticHeaders="True" SaveScrollPosition="true" ScrollHeight="415px"></Scrolling>
        </ClientSettings>
        <PagerStyle Mode="NumericPages"></PagerStyle>
        <MasterTableView AutoGenerateColumns="False" DataKeyNames="CapitalProjectID" ClientDataKeyNames="CapitalProjectID" TableLayout="Fixed"
            Width="100%" CommandItemDisplay="Top" PageSize="100" AllowPaging="true" PagerStyle-AlwaysVisible="true" >
            <Columns>
                <%--<telerik:GridButtonColumn ButtonType="ImageButton" UniqueName="RecordStatus" HeaderStyle-Width="3%"  />--%>
                <telerik:GridTemplateColumn HeaderStyle-Width="3%">
                    <ItemTemplate>
                        <asp:Image ID="RecordStatus" runat="server" ImageUrl="/images/spacer.gif" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <%--<telerik:GridButtonColumn ButtonType="ImageButton" UniqueName="PartnerStatus" HeaderStyle-Width="3%"  />--%>
                <telerik:GridTemplateColumn HeaderStyle-Width="3%">
                    <ItemTemplate>
                        <asp:Image ID="PartnerStatus" runat="server" ImageUrl="/images/spacer.gif" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="cpNumber" HeaderText="Project Number" HeaderStyle-Width="15%" />
                <telerik:GridBoundColumn DataField="cpStatus" HeaderText="Status" HeaderStyle-Width="8%" />
                <telerik:GridBoundColumn DataField="SchoolName" HeaderText="School" HeaderStyle-Width="20%" />
                <telerik:GridBoundColumn DataField="cpName" HeaderText="Project Name" HeaderStyle-Width="25%" />
                <telerik:GridBoundColumn DataField="CPPartnershipProject" HeaderText="Partnership" HeaderStyle-Width="9%" />
                <telerik:GridTemplateColumn UniqueName="TemplateEditColumn" HeaderStyle-Width="15%">
                    <ItemTemplate>
                        <telerik:RadButton runat="server" ID="EditButton" Text="EDIT" Skin="ARButton" Width="40px" EnableEmbeddedSkins="false" RenderMode="Lightweight" Visible="true"  />
                        <telerik:RadButton runat="server" ID="DeleteButton" Text="DELETE" CommandName="Delete" Skin="ARButton" Width="50px" EnableEmbeddedSkins="false" RenderMode="Lightweight" Visible="true"  />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn DataField="CapitalProjectID" HeaderText="ID" ReadOnly="True"
                    SortExpression="CapitalProjectID" UniqueName="CapitalProjectID" Display="false" >
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="CPProjectStatus" HeaderText="Status" Display="false" />
                <telerik:GridBoundColumn DataField="ShowHandshake" HeaderText="Status" Display="false" />
            </Columns>
            <CommandItemTemplate>
                <div style="vertical-align: text-bottom; padding: 5px 5px;">
                    <asp:Table ID="Table1" runat="server" Width="100%">
                        <asp:TableRow>
                            <asp:TableCell HorizontalAlign="Left"><asp:LinkButton ID="lnkAddNew" runat="server" OnClientClick="ShowInsertForm();"><img style="border:0px;vertical-align:middle;" alt="" src="/images/AddRecord.png"/>&nbsp;New Project</asp:LinkButton></asp:TableCell>
                            <asp:TableCell HorizontalAlign="Left"><asp:LinkButton ID="lnkFilter" runat="server" OnClientClick="FilterForm();"><img style="border:0px;vertical-align:middle;" alt="" src="/images/filter.gif"/>&nbsp;Filter List</asp:LinkButton></asp:TableCell>
                            <asp:TableCell HorizontalAlign="Right"><asp:LinkButton ID="lnkRefresh" runat="server" CommandName="RebindGrid"><img style="border:0px;vertical-align:middle;" alt="" src="/images/Refresh.png"/>&nbsp;Refresh</asp:LinkButton></asp:TableCell>
                        </asp:TableRow>
                    </asp:Table>
                </div>
            </CommandItemTemplate>
        </MasterTableView>
        <ClientSettings>
            <Selecting AllowRowSelect="true"></Selecting>
            <ClientEvents OnRowDblClick="RowDblClick"></ClientEvents>
        </ClientSettings>
    </telerik:RadGrid>

 

SERVER SIDE:

    Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As GridItemEventArgs) Handles RadGrid1.ItemCreated
        If TypeOf e.Item Is GridDataItem Then
                Dim deleteButton As RadButton = DirectCast(e.Item.FindControl("DeleteButton"), RadButton)
                Dim msg As String = "'Are you sure you want to delete this project ?'"
                If Not e.Item.DataItem Is Nothing Then
                        msg = [String].Format("'Are you sure you want to delete {0} ?'", DirectCast(e.Item.DataItem, ARKAPP.BusinessLogicLayer.CapitalProject).CPNumber)
                End If
                msg = "if (!confirm(" & msg & ")) {return false;}"
                deleteButton.Attributes("onclick") = msg
        End If
    End Sub

 

    Protected Sub RadGrid1_DeleteCommand(ByVal source As Object, ByVal e As GridCommandEventArgs) Handles RadGrid1.DeleteCommand
        Try
            Dim iProjectID As Integer = DirectCast((DirectCast(e.Item, GridDataItem)).GetDataKeyValue("CapitalProjectID"), Integer)
            SqlHelper.ExecuteNonQuery(System.Configuration.ConfigurationManager.AppSettings(ARKAPP.Web.[Global].CfgKeyConnString), "sp_WA_Del_CapitalProject", iProjectID)
        Catch ex As Exception
            Dim sMsg As String = "ERROR DELETING PROJECT FROM GRID: " & ex.Message
            Document.DeleteLog(sMsg, 0, 0)
            ShowErrorMessage(ex.Message)
        End Try
    End Sub

Mark
Top achievements
Rank 1
 answered on 07 Jun 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?