Telerik Forums
UI for ASP.NET AJAX Forum
14 answers
1.6K+ views
Hello, I am using GridClientSelectColumn, and I'm trying to add a javascript onclick event.  I added the following to my ItemDataBound grid event:

 

 

if (e.Item is GridDataItem)

 

{

 

 

GridDataItem item = (GridDataItem)e.Item;

 

 

 

CheckBox chkbx = (CheckBox)item["ClientSelectColumn"].Controls[0];

 

chkbx.AutoPostBack =

 

true;

 

chkbx.Attributes.Add(

 

"OnClick", "return alert('" + chkbx.Checked + "');");

 

}



But every time, the value is displayed as false after I check the box.  I just want to get the value of the checkbox after it is selected.


Eyup
Telerik team
 answered on 17 May 2019
3 answers
272 views
I have a RadWizard that I would like to have a "loading" function on, when user clicks on "Next" button. However, it only works on the first click. All subsequent clicks on "next" show no loading from the RadAjaxLoadingPanel.
Rumen
Telerik team
 answered on 17 May 2019
6 answers
312 views
Hi,

Is it impossible to add  two or more GridClientSelectColumn to the Grid?

I want to make grid in witch will be:
Column1(name), Column2(GridClientSelectColumn), Column3(GridClientSelectColumn), ...

I have created this grid but I have one problem:
When  I select a column grid select all columns

 <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1"  
            GridLines="None" AllowMultiRowSelection="True"> 
            <ClientSettings> 
                <Selecting AllowRowSelect = "true" /> 
            </ClientSettings> 
            <MasterTableView datasourceid="SqlDataSource1" AutoGenerateColumns = "false"> 
                <Columns> 
                    <telerik:GridBoundColumn DataField="Name" HeaderText="Name"  
                        SortExpression="Name" UniqueName="Name"> 
                    </telerik:GridBoundColumn> 
                    <telerik:GridClientSelectColumn UniqueName="CheckboxSelectColumn1" HeaderText="CheckboxSelect column1 <br />" /> 
                    <telerik:GridClientSelectColumn UniqueName="CheckboxSelectColumn2" HeaderText="CheckboxSelect column2 <br />" /> 
                </Columns> 
            </MasterTableView> 
        </telerik:RadGrid> 

Can anyone help me, I'll be grateful
Antony
Top achievements
Rank 1
 answered on 17 May 2019
1 answer
535 views

I have the followig RadGrid

<telerik:RadGrid ID="RadGrid1" OnInit="RadGrid1_Init" runat="server" AllowPaging="True" AutoGenerateColumns="False"
        OnNeedDataSource="RadGrid1_NeedDataSource" PageSize="30"
        OnItemDataBound="RadGrid1_ItemDataBound" AllowMultiRowEdit="True"
        RenderMode="Lightweight"
        OnPreRender="RadGrid1_PreRender"
        CssClass="RadGrid_ModernBrowsers"
        OnBatchEditCommand="RadGrid1_BatchEditCommand"
        HorizontalAlign="Center" Height="740px" OnItemCreated="RadGrid1_ItemCreated" Skin="Simple" OnColumnCreating="RadGrid1_ColumnCreating" AllowFilteringByColumn="True" OnItemCommand="RadGrid1_ItemCommand" AllowSorting="True" OnBiffExporting="RadGrid1_BiffExporting">
        <GroupingSettings CollapseAllTooltip="Collapse all groups" CaseSensitive="false"></GroupingSettings>
        <MasterTableView CommandItemDisplay="Bottom" CommandItemStyle-Font-Size="10" DataKeyNames="ID_Trafo_2D" EditMode="Batch" BatchEditingSettings-EditType="Row" Font-Names="Calibri" Font-Size="8" TableLayout="Fixed">
            <ColumnGroups>
                <...>
            </ColumnGroups>
            <CommandItemSettings ShowCancelChangesButton="True"
                ShowSaveChangesButton="True"/>
            <Columns>
                <telerik:GridBoundColumn DataField="ID_Trafo_2D"
                    FilterControlAltText="Filter column column" HeaderText="Trafo 2D ID"
                    UniqueName="column" ReadOnly="True" ColumnGroupName="InformacionBasica" HeaderStyle-Font-Size="10" FilterControlWidth="70%">
                    <HeaderStyle Font-Size="10pt" Wrap="False" Width="80px" HorizontalAlign="Center"
                        BackColor="#CCCCCC"></HeaderStyle>
                    <ItemStyle Wrap="True" HorizontalAlign="Center" />
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumn
                    HeaderText="Conexion1 ID" FilterControlAltText="Filter TemplateColumn1 column" UniqueName="ID_T2D_Conexion1" DataField="NombreConexion" ColumnGroupName="Caracteristicas" HeaderStyle-Font-Size="10" AutoPostBackOnFilter="false" ShowFilterIcon="true">
                    <EditItemTemplate>
                        <telerik:RadButton ID="RadButton1" runat="server" OnClientClicked="openRadWindowConexion1" Width="120%" AutoPostBack="False" Text='Editar Conexión'>
                            <Icon PrimaryIconUrl="~/Resources/EditIcon18x18.png" PrimaryIconTop="2px" PrimaryIconLeft="2px" PrimaryIconWidth="18px" PrimaryIconHeight="18px" />
                        </telerik:RadButton>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <%# Eval("NombreConexion")%>
                    </ItemTemplate>
                    <HeaderStyle BackColor="#DDEBF7" />
                    <ItemStyle Wrap="False" />
                </telerik:GridTemplateColumn>
                <telerik:GridBoundColumn FilterControlAltText="Filter column4 column"
                    HeaderText="Nombre" FilterControlWidth="70%" UniqueName="column4" DataField="Trafo2DNombre" ColumnGroupName="DescripcionTransformadores2D" HeaderStyle-Font-Size="10" AutoPostBackOnFilter="false" ShowFilterIcon="true">
                    <ColumnValidationSettings EnableRequiredFieldValidation="True">
                        <RequiredFieldValidator ForeColor="#FF3300" ToolTip="Campo Obligatorio">(*)</RequiredFieldValidator>
                    </ColumnValidationSettings>
                    <HeaderStyle Font-Size="10pt" BackColor="#E8FFEA"></HeaderStyle>
                    <ItemStyle Wrap="False" />
                </telerik:GridBoundColumn>
            </Columns>
            <BatchEditingSettings EditType="Row"></BatchEditingSettings>
            <CommandItemStyle Font-Size="10pt"></CommandItemStyle>
        </MasterTableView>
        <ClientSettings>
            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
            <Resizing AllowColumnResize="true" ResizeGridOnColumnResize="true" AllowResizeToFit="true" />
            <ClientEvents OnBatchEditOpening="OnBatchEditOpening" />
        </ClientSettings>
        <PagerStyle PageSizes="15;30;90;150;300" Position="Bottom" />
        <FilterMenu RenderMode="Lightweight"></FilterMenu>
        <HeaderContextMenu RenderMode="Lightweight"></HeaderContextMenu>
    </telerik:RadGrid>

 

When a user wants to add a new row, he has to select a name ("Nombre") and a connection ("Conexion") from a window that pops up and assigns the selected connection to the selected cell. I can validate the name using the built-in validator for BoundColumns, however, I haven't found a way to validate the Eval("NombreConexion") that is on the ItemTemplate of the GridTemplateColumn so that it is not an empty value (some users forget to assign a connection).

Is there any way of doing this? I can't use a FieldValidator because the Eval field is not a control and if I try to transform it into a radlabel I just get errors.

Thank you.

 

Eyup
Telerik team
 answered on 17 May 2019
1 answer
143 views

Hi,

I have a RadGrid with a radcombobox for the filter template. In the ASPX code I have the following:

 

<telerik:GridTemplateColumn DataField="ID_Tipo" UniqueName="ID_Tipo" <br>  
HeaderText="Tipo Usuario" DataType="System.string" FilterControlWidth="150px" <br>                        SortExpression= "ID_Tipo"
<br>                        GroupByExpression="TipoUsuario Group by TipoUsuario"><br>                            <ItemTemplate><br>
                                <%#DataBinder.Eval(Container.DataItem, "TipoUsuario")%><br>                            </ItemTemplate><br> 
<FilterTemplate><br> 
<telerik:RadComboBox ID="RCB_Filtro"<br>                                    Height="200px"<br>                                    OnClientSelectedIndexChanged="TipoUsuarioIndexChanged"<br>                                    DataSourceID="SqlDataSource1"<br>                                   
EnableAutomaticLoadOnDemand="True"<br>
CurrentFilterFunction="Contains" <br>                                    AutoPostBackOnFilter="True"<br>                                   
AppendDataBoundItems="true"<br>  
SelectedValue='<%# TryCast(Container, GridItem).OwnerTableView.GetColumn("Id_Tipo").CurrentFilterValue %>'<br>                                   
DataTextField="TipoUsuario"
DataValueField="ID_tipoUsuario"<br>                                   
runat="server" <br>                                   
EnableLoadOnDemand="True"><br>             
<Items><br>                                    
    <telerik:RadComboBoxItem Text="Todos" Value="" /><br>                                   </Items><br>                               
</telerik:RadComboBox><br>                           
<telerik:RadScriptBlock ID="RadScriptBlock3" runat="server"><br>                               
<script type="text/javascript"><br>                                   
function TipoUsuarioIndexChanged(sender, args) {<br>                                  
var tableView = $find("<%# TryCast(Container, GridItem).OwnerTableView.ClientID %>");<br>                                   
if (args.get_item().get_value() == "Todos") { tableView.filter("ID_Tipo", args.get_item().get_value(), "NoFilter");<br>                                    }<br>                                   
else {<br>                                  
tableView.filter("ID_Tipo", args.get_item().get_value(), "EqualTo");<br>                                 }<br>                           } <br>                                       
</script><br>                           
</telerik:RadScriptBlock><br>                       
</FilterTemplate>

 

The radcombobox has an associated SQlDataSource:

 

<asp:SqlDataSource <br>        runat="server"<br>        ID="SqlDataSource1"<br>        ConnectionString="<%$ ConnectionStrings:ApplicationServices %>"<br>        ProviderName="System.Data.SqlClient" SelectCommand="SELECT [ID_tipoUsuario], [TipoUsuario] from [Tipos_usuario] ORDER By [TipoUsuario]"><br>    </asp:SqlDataSource>

 

But when I run the application, only the "All" item appears in the radcombobox. And when the "All" item is removed from the selection window, then the elements of the table are also loaded.

In the VB module there is no action defined for RadGrid_ItemDataBound or RadGrid_ItemCreated, since the load is done by SQLDataSource.

 

You can help me to see what is wrong or what I lack in the radcomobox definition. Thank you

TomShelby
Top achievements
Rank 1
 answered on 17 May 2019
4 answers
1.1K+ views

I have a simple grid that allows the user to add new contacts. Certain need to be pre-populated and set to read only so the user cannot change then.

 

I've tried using <telerik:GridBoundColumn DataField="STATUS" HeaderText="Status" ReadOnly="true"/> but this hides the column when you try to add a new contact. I've tried various different way to render the column as read only including using a prerender function and attempting to set the read only status using javascript but i'm struggling to find the correct syntax for it.

 

My full code:

 

<telerik:RadGrid RenderMode="Lightweight" runat="server" ID="RadGridContats" AutoGenerateColumns="false" AllowPaging="true"
                        OnNeedDataSource="RadGridContats_NeedDataSource" OnUpdateCommand="RadGridContats_UpdateCommand"
                        OnInsertCommand="RadGridContats_InsertCommand" >
                        <MasterTableView DataKeyNames="ContactID" CommandItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnCurrentPage">
                            <CommandItemSettings AddNewRecordText="Add Contact" />
                            <Columns>
                                <telerik:GridEditCommandColumn />
                                <telerik:GridBoundColumn DataField="ContactID" HeaderText="ID" ReadOnly="true" Visible="false"
                                    ForceExtractValue="Always" ConvertEmptyStringToNull="true" />
                                <telerik:GridBoundColumn DataField="Firstname" HeaderText="First Name">
                                <ColumnValidationSettings EnableRequiredFieldValidation="true" >
                                <RequiredFieldValidator ForeColor="Red" ErrorMessage="  Please enter a first name"></RequiredFieldValidator>
                                </ColumnValidationSettings></telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Lastname" HeaderText="Last Name">
                                 <ColumnValidationSettings EnableRequiredFieldValidation="true" >
                                <RequiredFieldValidator ForeColor="Red" ErrorMessage="  Please enter a last name"></RequiredFieldValidator>
                                </ColumnValidationSettings></telerik:GridBoundColumn>   
                                <telerik:GridBoundColumn DataField="Email" HeaderText="Email">
                                <ColumnValidationSettings EnableRequiredFieldValidation="true" >
                                <RequiredFieldValidator ForeColor="Red" ErrorMessage="  Enter a valid email address"></RequiredFieldValidator>
                                </ColumnValidationSettings></telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Workphone" HeaderText="Phone" />
                                <telerik:GridBoundColumn DataField="Title" HeaderText="Title" />
                                <telerik:GridBoundColumn DataField="Status" HeaderText="Status" ReadOnly="true"/>
                                <%--<telerik:GridButtonColumn HeaderStyle-Width="20px" Text="&lt;img src=/_layouts/15/Styles/LeadGen/images/deactivate4.png border=0 align=absmiddle alt='Select this Item'&gt;" CommandName="Select"></telerik:GridButtonColumn>--%>
                            </Columns>
                        </MasterTableView>
                        <PagerStyle Mode="NextPrevAndNumeric" />
                    </telerik:RadGrid>

 

Any help is greatly appreciated.

Attila Antal
Telerik team
 answered on 17 May 2019
7 answers
1.1K+ views
Hi,

My project involves displaying products in RadGrid. I would like to reorder rows using RadGrid's drag and drop feature wherein after reordering the row, the order should be autosaved to the database.

Is this possible and if yes, then how? I'm looking for the code on an urgent basis. Any help on this is highly appreciated.

Many thanks,
Ritika
Vessy
Telerik team
 answered on 17 May 2019
2 answers
106 views

Hi, I need to know how I can resize the appointment to make it full fill the height of the row ?

 

 

Peter Milchev
Telerik team
 answered on 17 May 2019
3 answers
276 views
Hi,

I am using the RadToolTip on an image gallery much like your demo but I would like to add a LinkButton in the ToolTip that opens up a RadWindow. I can add the LinkButton OK but can't figure out how to open the RadWindow with it.....

Many thanks,

Jon

Eyup
Telerik team
 answered on 17 May 2019
1 answer
345 views

Hi 

I have a radgrid with the following column

  <telerik:GridButtonColumn ButtonType="ImageButton" UniqueName="delete" CommandName="Detete"  ImageUrl="../../Images/MatchIt/TrashCan_Blue.png" ItemStyle-Width="10%"></telerik:GridButtonColumn>

The delete command works perfectly, but the Post-back only fires on the second click. Is there any new known issues that may have caused this?

Thanks,

John E

Attila Antal
Telerik team
 answered on 16 May 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?