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

Hi,

i open a radwindow fro ma button inside a templatecolumn in a detailtable.

In the radwindow i have a radbutton when i click it the OnClick event doesn't fire.

Here the code.

 

<%@ Page Title="" Language="C#" MasterPageFile="~/SiteT.Master" AutoEventWireup="true" CodeBehind="AnalisiExc.aspx.cs" Inherits="IPadAdmin.AnalisiExc" %>

<asp:Content ID="Content1" ContentPlaceHolderID="StyleSection" runat="server">
    <style>
        .RadGrid {
            border-radius: 10px;
            overflow: hidden;
        }

        th {
            font-size: 14px;
        }

        td {
            font-size: 13px;
        }
    </style>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            var radWindow1 = null;
            var radGrid1 = null;

            function pageLoad() {
                radGrid1 = $find("<%= RadGrid1.ClientID %>");
                radWindow1 = $find("<%= RadWindow1.ClientID %>");
            }
        </script>
    </telerik:RadCodeBlock>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentSection" runat="server">
    <form id="form1" runat="server" onsubmit="return validateForm()">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
        <div class="row page-titles">
            <div class="col-md-5 align-self-center">
                <telerik:RadCodeBlock runat="server">
                    <h3 class="text-primary"><a href="<%=Page.ResolveUrl("~/Default.aspx") %>">Dashboard</a></h3>
                </telerik:RadCodeBlock>
            </div>
            <div class="col-md-7 align-self-center">
                <ol class="breadcrumb">
                    <li class="breadcrumb-item">Amministrazione</li>
                    <li class="breadcrumb-item">Analisi</li>
                    <li class="breadcrumb-item">Eccezioni</li>
                </ol>
            </div>
        </div>
        <div class="container-fluid">
            <div class="row">
                <div class="col-12">
                    <div class="card">
                        <div class="card-body">
                            <div class="table-responsive m-t-40">
                                <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" UpdateInitiatorPanelsOnly="true">
                                    <AjaxSettings>
                                        <telerik:AjaxSetting AjaxControlID="RadGrid1">
                                            <UpdatedControls>
                                                <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                                            </UpdatedControls>
                                        </telerik:AjaxSetting>
                                        <telerik:AjaxSetting AjaxControlID="Button1">
                                            <UpdatedControls>
                                                <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                                            </UpdatedControls>
                                        </telerik:AjaxSetting>
                                    </AjaxSettings>
                                </telerik:RadAjaxManager>
                                <telerik:RadFormDecorator RenderMode="Lightweight" ID="RadFormDecorator1" runat="server" DecorationZoneID="demo" DecoratedControls="All" EnableRoundedCorners="false" />
                                <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1" />
                                <asp:LinkButton ID="Button1"
                                    runat="server"
                                    CssClass="btn btn-primary btn-rounded m-b-10 m-l-5"
                                    Text="AGGIORNA"
                                    OnClick="Button1_Click">
                                </asp:LinkButton>
                                <div class="form-inline">
                                    <label class="control-label">&nbsp;Anno&nbsp;</label>
                                    <telerik:RadNumericTextBox runat="server" ID="txtAnno" NumberFormat-DecimalDigits="0" NumberFormat-GroupSeparator="" Width="100px" />
                                    <label class="control-label">&nbsp;Mese&nbsp;</label>
                                    <telerik:RadComboBox ID="cmbMese" runat="server" AutoPostBack="false" TabIndex="6" AppendDataBoundItems="true">
                                        <Items>
                                            <telerik:RadComboBoxItem runat="server" Value="0" Text="(Seleziona un mese)" />
                                            <telerik:RadComboBoxItem runat="server" Value="1" Text="Gennaio" />
                                            <telerik:RadComboBoxItem runat="server" Value="2" Text="Febbraio" />
                                            <telerik:RadComboBoxItem runat="server" Value="3" Text="Marzo" />
                                            <telerik:RadComboBoxItem runat="server" Value="4" Text="Aprile" />
                                            <telerik:RadComboBoxItem runat="server" Value="5" Text="Maggio" />
                                            <telerik:RadComboBoxItem runat="server" Value="6" Text="Giugno" />
                                            <telerik:RadComboBoxItem runat="server" Value="7" Text="Luglio" />
                                            <telerik:RadComboBoxItem runat="server" Value="8" Text="Agosto" />
                                            <telerik:RadComboBoxItem runat="server" Value="9" Text="Settembre" />
                                            <telerik:RadComboBoxItem runat="server" Value="10" Text="Ottobre" />
                                            <telerik:RadComboBoxItem runat="server" Value="11" Text="Novembre" />
                                            <telerik:RadComboBoxItem runat="server" Value="12" Text="Dicembre" />
                                        </Items>
                                    </telerik:RadComboBox>
                                </div>
                                <br />
                                <div>
                                    <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True" AllowSorting="true" EnableLoadOnDemand="True" ShowGroupPanel="true" OnNeedDataSource="RadGrid1_NeedDataSource"
                                        AutoGenerateColumns="False" AllowPaging="False" PageSize="50" Skin="Material" OnItemCommand="RadGrid1_ItemCommand" OnGroupsChanging="RadGrid1_GroupsChanging" OnDetailTableDataBind="RadGrid1_DetailTableDataBind"
                                        OnItemDataBound="RadGrid1_ItemDataBound" OnCustomAggregate="RadGrid1_CustomAggregate"
                                        RenderMode="Lightweight" ShowFooter="True" ShowStatusBar="True" Culture="it-IT" GridLines="None" Width="100%">
                                        <PagerStyle Mode="NumericPages"></PagerStyle>
                                        <GroupingSettings CaseSensitive="false" />
                                        <MasterTableView DataKeyNames="AG,SlpCode,Mese" AllowMultiColumnSorting="False" GroupLoadMode="Client" HierarchyLoadMode="Client"
                                            CommandItemDisplay="Top" ShowGroupFooter="true" EnableHierarchyExpandAll="true" Caption="" TableLayout="Fixed">
                                            <CommandItemSettings ShowAddNewRecordButton="false" ShowSaveChangesButton="false" ShowCancelChangesButton="false" ShowExportToExcelButton="true" />
                                            <GroupByExpressions>
                                                <telerik:GridGroupByExpression>
                                                    <SelectFields>
                                                        <telerik:GridGroupByField FieldAlias="Limite" FieldName="Limite" />
                                                        <telerik:GridGroupByField FieldAlias="Valid" FieldName="Valid" />
                                                        <telerik:GridGroupByField FieldAlias="AG" FieldName="AG" />
                                                    </SelectFields>
                                                    <GroupByFields>
                                                        <%--<telerik:GridGroupByField FieldName="CA" SortOrder="Ascending"></telerik:GridGroupByField>--%>
                                                        <telerik:GridGroupByField FieldName="AG" SortOrder="Ascending"></telerik:GridGroupByField>
                                                        <%--<telerik:GridGroupByField FieldName="Mese" SortOrder="Ascending"></telerik:GridGroupByField>--%>
                                                    </GroupByFields>
                                                </telerik:GridGroupByExpression>
                                            </GroupByExpressions>
                                            <DetailTables>
                                                <telerik:GridTableView runat="server" AllowFilteringByColumn="False" AllowSorting="False" AllowAutomaticUpdates="false"
                                                    AutoGenerateColumns="False" AllowPaging="false" DataKeyNames="DocEntry" Caption="" Skin="Material"
                                                    RenderMode="Lightweight" ShowFooter="False" ShowStatusBar="True" CellSpacing="0" Name="Rate">
                                                    <Columns>
                                                        <telerik:GridBoundColumn DataField="DocEntry" HeaderText="" ReadOnly="True" Visible="false" UniqueName="DocEntry" />
                                                        <telerik:GridBoundColumn DataField="Aut" HeaderText="" ReadOnly="True" Visible="false" UniqueName="AutV" />
                                                        <telerik:GridBoundColumn DataField="Dec" HeaderText="" ReadOnly="True" Visible="false" UniqueName="Dec" />
                                                        <telerik:GridDateTimeColumn DataField="Data" HeaderText="Data" SortExpression="DocDate" ReadOnly="False" DataType="System.DateTime" DataFormatString="{0:D}"
                                                            UniqueName="Data">
                                                        </telerik:GridDateTimeColumn>
                                                        <telerik:GridBoundColumn DataField="DocNum" HeaderText="#" SortExpression="DocNum" ReadOnly="True" Visible="True"
                                                            UniqueName="DocNum">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="CardCode" HeaderText="Codice" SortExpression="CardCode" ReadOnly="True" Visible="True"
                                                            UniqueName="CardCode">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="CardName" HeaderText="Rag. Sociale" SortExpression="CardName" ReadOnly="True"
                                                            UniqueName="CardName">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="Pagamento" HeaderText="Pagamento" SortExpression="Pagamento" ReadOnly="True"
                                                            UniqueName="Pagamento">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="Netto" HeaderText="Netto" SortExpression="Netto" DataFormatString="{0:N2}" AllowFiltering="false" ItemStyle-HorizontalAlign="Right" HeaderStyle-HorizontalAlign="Right"
                                                            UniqueName="Netto">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="RatDoc" HeaderText="RatDoc" SortExpression="RatDoc" ReadOnly="True"
                                                            UniqueName="RatDoc">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="RatBp" HeaderText="RatBp" SortExpression="RatBp" ReadOnly="True"
                                                            UniqueName="RatBp">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridTemplateColumn HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="center" HeaderText="Aut." AllowFiltering="false" UniqueName="Aut">
                                                            <ItemTemplate>
                                                                <telerik:RadCheckBox ID="chkAut" runat="server" Checked='<%# Bind("Aut") %>' OnCheckedChanged="chkAut_CheckedChanged" />
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridTemplateColumn HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="center" HeaderText="Dec." AllowFiltering="false" UniqueName="Dec">
                                                            <ItemTemplate>
                                                                <telerik:RadCheckBox ID="chDec" runat="server" Checked='<%# Bind("Dec") %>' OnCheckedChanged="chDec_CheckedChanged" />
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridTemplateColumn HeaderText=""
                                                            AllowFiltering="false">
                                                            <HeaderStyle Width="102px" />
                                                            <ItemTemplate>
                                                                <asp:LinkButton ID="cmdNota" runat="server" Text="NOTA" OnClientClick='<%# String.Format("openConfirmationWindow({0}); return false;", Eval("DocEntry")) %>'
                                                                    CssClass="bookNowLink" />
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                    </Columns>
                                                </telerik:GridTableView>
                                            </DetailTables>
                                            <Columns>
                                                <%--<telerik:GridBoundColumn DataField="CA" HeaderText="AREA" SortExpression="AREA" ReadOnly="True" UniqueName="CA" />--%>
                                                <telerik:GridBoundColumn DataField="AG" HeaderText="AG" SortExpression="AG" ReadOnly="True" UniqueName="AG" />
                                                <telerik:GridBoundColumn DataField="SlpCode" HeaderText="Codice" ReadOnly="True" UniqueName="SlpCode" />
                                                <telerik:GridBoundColumn DataField="AGE" HeaderText="Agente" SortExpression="AGE" ReadOnly="True" UniqueName="AGE" />
                                                <telerik:GridBoundColumn DataField="Anno" HeaderText="Anno" ReadOnly="True" UniqueName="Anno" AllowFiltering="false" />
                                                <telerik:GridBoundColumn DataField="Mese" HeaderText="Mese" SortExpression="Mese" ReadOnly="True" AllowFiltering="false" UniqueName="Mese" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" />
                                                <telerik:GridBoundColumn DataField="Numero" HeaderText="Totali" SortExpression="Numero" ReadOnly="True" Groupable="false" UniqueName="Numero" Aggregate="Sum" FooterText="Totali: " FooterStyle-HorizontalAlign="Right" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" AllowFiltering="false" />
                                                <telerik:GridBoundColumn DataField="Valore" HeaderText="Valore" SortExpression="Valore" DataFormatString="{0:N2}" AllowFiltering="false" ItemStyle-HorizontalAlign="Right" HeaderStyle-HorizontalAlign="Right"
                                                    UniqueName="Valore" FooterText="Tot: " Aggregate="Sum" FooterStyle-HorizontalAlign="Right" Groupable="false">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="Limite" HeaderText="Limite" SortExpression="" ReadOnly="True" UniqueName="Limite" AllowFiltering="false" />
                                                <telerik:GridBoundColumn DataField="Valid" HeaderText="" SortExpression="" ReadOnly="True" UniqueName="Valid" Display="false" />
                                                <telerik:GridTemplateColumn HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="center" HeaderText="Term"
                                                    AllowFiltering="false" UniqueName="Term" Groupable="false">
                                                    <ItemTemplate>
                                                        <telerik:RadCheckBox ID="chkTerm" runat="server" Checked='<%# Bind("Term") %>' OnCheckedChanged="chkTerm_CheckedChanged" />
                                                    </ItemTemplate>
                                                </telerik:GridTemplateColumn>
                                            </Columns>
                                        </MasterTableView>
                                        <ClientSettings ReorderColumnsOnClient="True" AllowDragToGroup="True" AllowColumnsReorder="True">
                                            <Selecting AllowRowSelect="True"></Selecting>
                                            <Resizing AllowRowResize="True" AllowColumnResize="True" EnableRealTimeResize="True"
                                                ResizeGridOnColumnResize="False"></Resizing>
                                        </ClientSettings>
                                        <FilterMenu RenderMode="Lightweight"></FilterMenu>
                                        <HeaderContextMenu RenderMode="Lightweight"></HeaderContextMenu>
                                        <GroupingSettings ShowUnGroupButton="true"></GroupingSettings>
                                    </telerik:RadGrid>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <telerik:RadWindowManager RenderMode="Lightweight" ID="RadWindowManager1" ShowContentDuringLoad="false" VisibleStatusbar="true"
            ReloadOnShow="true" runat="server" EnableShadow="true">
            <Windows>
                <telerik:RadWindow RenderMode="Lightweight" ID="RadWindow1" runat="server" VisibleTitlebar="true" Modal="true" Width="500px" Height="300px"
                    Behaviors="None" VisibleStatusbar="false">
                    <ContentTemplate>
                        <asp:Panel ID="FirstStepPanel" runat="server">
                            <div>
                                <asp:HiddenField ID="DocEntry" ClientIDMode="Static" runat="server" />
                                <hr class="lineSeparator" style="margin: 12px 0 12px 0" />
                                <table width="99%">
                                    <tr>
                                        <td>
                                            <telerik:RadTextBox ID="txtNota" runat="server" TextMode="MultiLine" Rows="6" MaxLength="250" Width="99%"></telerik:RadTextBox>
                                        </td>
                                    </tr>
                                </table>
                                <hr class="lineSeparator" style="margin: 12px 0 15px 0" />
                                <telerik:RadButton RenderMode="Lightweight" ID="cmdApprova" runat="server" Text="INSERISCI" CausesValidation="false" OnClientClicking="RadConfirm"
                                    Width="120px" OnClick="cmdApprova_Click" UseSubmitBehavior="false" />
                                <telerik:RadButton RenderMode="Lightweight" ID="cmdAnnulla" runat="server" Text="ANNULLA"
                                    Width="120px" OnClientClicking="cancelClicking" UseSubmitBehavior="false" />
                            </div>
                        </asp:Panel>
                    </ContentTemplate>
                </telerik:RadWindow>
            </Windows>
        </telerik:RadWindowManager>
    </form>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ScriptSection" runat="server">
    <script>
        function validateForm() {
            var errors = false;
            var testo = document.getElementById('<%= txtAnno.ClientID %>');
            if (testo.value == '') {
                errors = true;
                alert('Inserire un anno la ricerca.');
            } else {
                errors = false;
            }
            if (errors == false) {
                document.getElementById("form1").submit();
            }
        }
        function openConfirmationWindow(val) {
            var radtextbox = $find('<%=txtNota.ClientID %>');
            radtextbox.clear();
            document.getElementById("DocEntry").value = val;
            radWindow1.set_title('Nota');
            radWindow1.show();
        }
        function RadConfirm(sender, args) {
            var callBackFunction = function (shouldSubmit) {
                if (shouldSubmit) {
                    sender.click();
                    if (Telerik.Web.Browser.ff) {
                        sender.get_element().click();
                    }
                }
            };

            var text = "Proseguire con l'\operazione?";
            radconfirm(text, callBackFunction, 300, 200, null, "RadConfirm");
            args.set_cancel(true);
        }
        function cancelClicking(sender, args) {
            radWindow1.close();
            args.set_cancel(true);
        }
        function AlertInvia(sender, args) {
            args.set_cancel(!window.confirm("Proseguire con l\'operazione?"));
        }
    </script>
</asp:Content>
IT
Top achievements
Rank 1
 asked on 30 Aug 2023
1 answer
122 views
I have a simple grid running in Batch Edit mode. Need to disable column "Division" and change its color by clicking an outside button. My code gets executed but nothing changes. This column's color gets set by applying custom CSS using 
background-color: white !important;. My code assigns a different CSS with another color.

ASPX:
<telerik:GridBoundColumn DataField="Division" HeaderText="Division" UniqueName="Division"></telerik:GridBoundColumn>

VB cb:
    Protected Sub btnApprove_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnApprove.Click
        Dim Item As GridDataItem
        For Each Item In RadGrid1.MasterTableView.Items
            If (Item.IsDataBound) Then
                Dim col As GridBoundColumn = CType(RadGrid1.MasterTableView.GetColumn("Division"), GridBoundColumn)
                col.ItemStyle.CssClass = "customGriglinesGray"
                col.ReadOnly = True
            End If
        Next
    End Sub
Attila Antal
Telerik team
 answered on 13 Dec 2022
1 answer
267 views

Hello!

As you can see in the image that I attached, my radgrid has 2 buttons at the bottom (Valider & Annuler) which stands for Validate and Cancel in english. These buttons are added as the following:


<EditFormSettings>
     <EditColumn FilterControlAltText="Filter EditCommandColumn column" ButtonType="PushButton" InsertText="Valider" CancelText="Annuler" EditText="Modif" UpdateText="Valider">
     </EditColumn>
</EditFormSettings>

I would like to change their design and apply a skin.  I have applied the Material skin to the whole RadGrid however these buttons seem to not be affected by that. Would that be possible to style them, just like we style any radbutton using Skins? Would changing the ButtonType from pushbutton to another type help with this matter?

 

Here's the full code of the radgrid shown in the attached image:


<telerik:RadGrid ID="RadGrid1" runat="server" CellSpacing="0" Culture="French (France)"
            DataSourceID="SDS_Notes" GridLines="None" Width="775px" Skin="Material" 
            AllowAutomaticInserts="True" AutoGenerateEditColumn="True">
            <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
            </HeaderContextMenu>
            <MasterTableView AutoGenerateColumns="False" CommandItemDisplay="Top" DataSourceID="SDS_Notes"
                NoMasterRecordsText="Aucune note" DataKeyNames="NumNote" 
                AllowAutomaticUpdates="True"
                Font-Size="13px">
                <CommandItemSettings ExportToPdfText="Export to PDF" AddNewRecordText="Ajouter une note"
                    RefreshText="Rafraichir"></CommandItemSettings>
                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                    <HeaderStyle Width="20px"></HeaderStyle>
                </RowIndicatorColumn>
                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                    <HeaderStyle Width="20px"></HeaderStyle>
                </ExpandCollapseColumn>
                <Columns>
                    <telerik:GridDropDownColumn DataField="AgenceAction" FilterControlAltText="Filter AgenceAction column"
                        HeaderText="Agence" SortExpression="AgenceAction" UniqueName="AgenceAction" HeaderStyle-Width="61px" DataSourceID="SDSAgence" ListTextField="AgenceAction" ListValueField="AgenceAction" ItemStyle-Width="130px">
                        <HeaderStyle Font-Size="15px" Width="80px"></HeaderStyle>
                        </telerik:GridDropDownColumn>
                    <telerik:GridDateTimeColumn DataField="DateAction" DataType="System.DateTime" FilterControlAltText="Filter DateAction column"
                        HeaderText="Date Action" SortExpression="DateAction" UniqueName="DateAction"
                        DataFormatString="{0:dd/MM/yyyy}" HeaderStyle-Width="110px">
                        <HeaderStyle Font-Size="15px" Width="130px"></HeaderStyle>
                    </telerik:GridDateTimeColumn>
                    <telerik:GridDateTimeColumn DataField="HeureAction" DataType="System.DateTime" FilterControlAltText="Filter HeureAction column"
                        HeaderText="Heure" SortExpression="HeureAction" UniqueName="HeureAction" PickerType="TimePicker" 
                        DataFormatString="{0:HH:mm}" HeaderStyle-Width="70px">
                        <HeaderStyle Font-Size="15px" Width="60px"></HeaderStyle>
                    </telerik:GridDateTimeColumn>
                    <telerik:GridBoundColumn DataField="Observations" FilterControlAltText="Filter Observations column"
                        HeaderText="Observations" SortExpression="Observations" UniqueName="Observations"
                        HeaderStyle-Width="500px" MaxLength="105">
                        <HeaderStyle Font-Size="15px" Width="500px"></HeaderStyle>
                        <ItemStyle CssClass="form-control" />
                    </telerik:GridBoundColumn>
                </Columns>
                <EditFormSettings>
                    <EditColumn FilterControlAltText="Filter EditCommandColumn column" ButtonType="PushButton" InsertText="Valider" CancelText="Annuler" EditText="Modif" UpdateText="Valider">
                    </EditColumn>
                </EditFormSettings>
                <HeaderStyle BackColor="#757575" Font-Bold="false" ForeColor="White"/>

            </MasterTableView>
            <FilterMenu EnableImageSprites="False">
            </FilterMenu>
        </telerik:RadGrid>

I have tried setting the SkinID from codebehind in the itemcreated property however I am receiving the following error:

"The 'SkinId' property can only be set in or before the Page_PreInit event for static controls. For dynamic controls, set the property before adding it to the Controls collection."


    Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemCreated
    If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then
        If Not e.Item.OwnerTableView.IsItemInserted Then
            '[......]
        Else
            '[......]
        End If
        Dim cancelButton As Button = CType(e.Item.FindControl("CancelButton"), Button)
            cancelButton.SkinID = "Material"
    End If
End Sub

Thanks a lot!
Valentin Dragnev
Telerik team
 answered on 25 Aug 2022
1 answer
241 views

Hi

I have a RadButton with  ButtonType="LinkButton".

I want remove the link from Head Office by following code.

ASPX

<telerik:GridTemplateColumn HeaderText="Branch" HeaderStyle-Width="10%" DataType="System.String" UniqueName="Branch" DataField="Branch">
                                    <ItemTemplate>
                                        <telerik:RadButton ID="btnBranch" Width="100%" runat="server" Text='<%#Eval("Branch") %>' ButtonType="LinkButton" ToggleType="CustomToggle" 
                                            Font-Underline="true" BorderStyle="None" CommandName="ViewBranchDtls" CommandArgument='<%#Eval("Branch") %>'>
                                        </telerik:RadButton>
                                        <asp:HiddenField ID="hdBranch" runat="server" Value='<%#Eval("Branch") %>' />
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>

CS

protected void gvReport_ItemDataBound(object sender, GridItemEventArgs e) { try { if (e.Item is GridDataItem) { GridDataItem item = e.Item as GridDataItem; if ((item.FindControl("btnBranch") as RadButton).Text == "HEAD OFFICE" ) { (e.Item.FindControl("btnBranch") as RadButton).Style.Add("pointer-events", "none"); // here need to remove the underline } } } catch (Exception ex) { } finally { } }

sample Extracted HTML

<td>
                                        <a id="ctl00_ContentPlaceHolder1_gvReport_ctl00_ctl12_btnBranch" class="RadButton RadButton_Default rbLinkButton" href="javascript:void(0)" style="display:inline-block;border-style:None;text-decoration:underline;width:100%;pointer-events:none;text-decoration:none;"><span class="rbText" style="text-decoration:underline;width:100%;padding-left:0;padding-right:0;text-align:center;">HEAD OFFICE</span><input id="ctl00_ContentPlaceHolder1_gvReport_ctl00_ctl12_btnBranch_ClientState" name="ctl00_ContentPlaceHolder1_gvReport_ctl00_ctl12_btnBranch_ClientState" type="hidden" autocomplete="off"></a>
                                        <input type="hidden" name="ctl00$ContentPlaceHolder1$gvReport$ctl00$ctl12$hdBranch" id="ctl00_ContentPlaceHolder1_gvReport_ctl00_ctl12_hdBranch" value="HEAD OFFICE">
                                    </td>

I notice Telerik will auto generate SPAN with underline.

How to remove the underline?

Thanks.

fsloke


Doncho
Telerik team
 answered on 05 Aug 2022
1 answer
75 views

the problem is that i declared the function of onitemdatabound but theres an error that says it cant find the cell bound  

for example i have a telerik: gridtemplatecolumn with unique name action and meta resourcekey gtcaction 

then i have an item template where i have an imagebutton with present the id

 

 

Vessy
Telerik team
 answered on 01 Oct 2021
1 answer
100 views

I'd like to have a RadButton whose icon differs between two images depending on the value of the field. I'm not sure if this is the best approach, but I am defaulting to one specific icon and attempting to change it in the _ItemDataBound method. However, I can't seem to figure out how to access the icon from the RadButton:

                        <ItemTemplate>
                            <telerik:RadButton RenderMode="Lightweight" ID="Image2"
                                CommandName="OnCommentToggleHandled" runat="server">
                                <Icon PrimaryIconUrl='<%# DataBinder.Eval(Container.DataItem, "Dismissed").Equals(true) ? "/App/images/green-check.png" : "/App/images/comment.gif" %>' runat="server"></Icon>
                            </telerik:RadButton>
                        </ItemTemplate>
        protected void StatusGrid_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem dataBoundItem = e.Item as GridDataItem;
                RadButton foo = dataBoundItem["Dismissed"].Controls[1] as RadButton;

                if ((dataBoundItem["Important"].Controls[1] as Image).ImageUrl.Contains("green-check.png"))
                {
                    dataBoundItem.BackColor = System.Drawing.Color.LemonChiffon;
                }
                else if ((dataBoundItem["Dismissed"].Controls[1] as RadButton).PrimaryIconUrl.Contains("blank.gif"))
                {
                    e.Item.CssClass = "rgRow unhandledMessage ";
                }

                dataBoundItem["Text"].Text = WebUtility.HtmlDecode(dataBoundItem["Text"].Text);
            }
        }
I tried looking through the documentation, but it's very unclear -- I didn't even realize that <Icon> had to be a child within the button until stumbling upon a third-party example, and even then I couldn't figure out how to query to the icon from the C# code. Can someone please show me how to reach the icon in the C# code, or possibly show me another way to do what I am trying to do?

Doncho
Telerik team
 answered on 05 Aug 2021
1 answer
233 views

Hi,

I have  a Gridhyprlink column with a DataNavigateUrlFormatString and 2    DataNavigateUrlFields

however I want one of those fileds to be conditional on another Column;

eg

DataNavigateUrlFormatString="https://main.aspx?etn={0}&pagetype=entityrecord&id={1}"

 DataNavigateUrlFields= ((if (entityid ==2) {a} else {b}) ,mainid )

Attila Antal
Telerik team
 answered on 14 May 2021
1 answer
54 views

Hello,

I'm currently working on a project where I have a RadGrid displaying some data. The filter functionality is already implemented and I've created a custom skin from an existing embedded skin for the GridDateTimeColumn and implemented according to the documentation here. Everything works perfect except that upon adding the <FilterTemplate> and setting the custom skin for the <telerik:RadDatePicker> the filter button it's not generated anymore. I've inspected the page and indeed the button is not just hidden with CSS or missing it's icon, it's not present at all in the HTML and the result is in the pictures attached.

Here is the markup I'm using.

<telerik:GridDateTimeColumn DataField="foo" UniqueName="foo" HeaderText="foo" PickerType="DatePicker" DataFormatString="{0: MM/dd/yyyy}" FilterDateFormat="MM/dd/yyyy" ReadOnly="true">
     <HeaderStyle Width="130" Font-Bold="true" />
          <FilterTemplate>
               <telerik:RadDatePicker runat="server" Skin="MyCustomSkin" EnableEmbeddedSkins="false"></telerik:RadDatePicker>
          </FilterTemplate>
 </telerik:GridDateTimeColumn>

Once I remove the <FilterTemplate> and return the skin to default the Filter button is displayed. I've looked for solutions but I couldn't seem to find any. What's causing this behaviour? Is it something I'm missing? 

 

Attila Antal
Telerik team
 answered on 05 May 2021
Narrow your results
Selected tags
Tags
+? more
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?