Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
261 views
Hi,

I'm having a problem with the RadListBox, after I'm looping through the RadListBox and see which item has been checked, I'm clicking on save button
the list coming up again but I have empty checkboxes that been checked!!
what can cause that??

my code in asp.net
<table>
<tr>
<td style="text-align: left; vertical-align: top;" class="GeneralFontShapeSmall">
Locations:<span class="validationClass">*</span>
<div>
Total Selected:
<asp:Label ID="lblTotal" runat="server"></asp:Label>
</div>
</td>
<td style="text-align: left">
<telerik:RadListBox ID="rlbLocations" CheckBoxes="true" Width="260px" OnClientItemChecked="ShowTotalCheckedLocations" EnableViewState="false"
OnClientCheckAllChecked="ShowTotalCheckedLocations" ShowCheckAll="true" Height="163px"
runat="server">
</telerik:RadListBox>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<telerik:RadButton ID="btnShowSelectedOnly" Text="Show Checked Only" ToggleType="CheckBox" Width="135px" AutoPostBack="false" OnClientClicked="toggleLocationShow" runat="server">
<ToggleStates>
<telerik:RadButtonToggleState PrimaryIconCssClass="rbToggleCheckboxChecked"></telerik:RadButtonToggleState>
<telerik:RadButtonToggleState PrimaryIconCssClass="rbToggleCheckbox"></telerik:RadButtonToggleState>
</ToggleStates>
</telerik:RadButton>
</td>
</tr>
</table>


please see the attached file.






Princy
Top achievements
Rank 2
 answered on 23 Jul 2014
4 answers
753 views
Dear all,
how can I insert a command button in the grid header? The button should be linked to a javascript function on the client side.

The button should appear beside the column title.

Thanks!
Shinu
Top achievements
Rank 2
 answered on 23 Jul 2014
4 answers
245 views
Hi All,

I've built a radgrid based on the advanced data binding demo: here. Where can I also find an example of doing editing? Especially when the grid will be postback and disappeared after edit command, how should I handle it?

Thanks in anticipation!
Princy
Top achievements
Rank 2
 answered on 23 Jul 2014
1 answer
216 views
Hi, 

I am trying to use radasyncupload and datepicker controls. I have PostbackTigger property set to Datepicker which does the postback. 

At first, I uploaded a file using radasyncupload. I just set date to the datepicker control so it did postback that lost uploaded file at this time. I thought the file should be persisted during the postback

Please assist me with that. 

Thanks,
Chi MIng

<div class="row">
             <div class="form-group">
                 <asp:Label ID="lblERSDate" runat="server" Text="Date Received by ERS" CssClass="control-label col-md-3" AssociatedControlID="dateERSDate">Date Received by ERS<span class="required">*</span></asp:Label>
 
                 <div class="col-md-4">
                     <div class="input-group date form_datetime">
                         <telerik:RadDatePicker ID="dateERSDate" runat="server" AutoPostBack="false" Width="100px" TabIndex="0" OnSelectedDateChanged="dateERSDate_SelectedDateChanged" DateInput-AutoPostBack="true"></telerik:RadDatePicker>
                         <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="dateERSDate" ForeColor="Red" ErrorMessage="Date Received by ERS is Required" ValidationGroup="s3" Display="None"></asp:RequiredFieldValidator>
 
                     </div>
                 </div>
             </div>
         </div>
         <div class="row">
             <div class="form-group">
                 <asp:Label ID="lblcordate" runat="server" Text="Correspondence Date" CssClass="control-label col-md-3" AssociatedControlID="dateCorDate">Correspondence Date<span class="required">*</span></asp:Label>
 
                 <div class="col-md-4">
                     <div class="input-group date form_datetime">
                         <telerik:RadDatePicker ID="dateCorDate" runat="server" AutoPostBack="false" Width="100px" TabIndex="0">
                             <ClientEvents OnDateSelected="OnDateSelectedHandler" />
                         </telerik:RadDatePicker>
                         <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="dateCorDate" ForeColor="Red" ErrorMessage="Correspondence Date is Required" ValidationGroup="s3" Display="None"></asp:RequiredFieldValidator>
 
                     </div>
                 </div>
             </div>
         </div>
         <div class="row">
             <div class="form-group">
                 <asp:Label ID="lblExpedite" runat="server" CssClass="control-label col-md-3" Text="Expedite Request?" AssociatedControlID="btnExpediteYes">Expedite Request?<span class="required">*</span></asp:Label>
 
                 <div class="col-md-4">
                     <telerik:RadButton ID="btnExpediteYes" runat="server" ToggleType="Radio" GroupName="groupExpedite" Text="Yes" ButtonType="ToggleButton" OnClick="btnExpedite_Click" Value="1" TabIndex="0"></telerik:RadButton>
                     <telerik:RadButton ID="btnExpediteNo" runat="server" ToggleType="Radio" GroupName="groupExpedite" Text="No" ButtonType="ToggleButton" OnClick="btnExpedite_Click" Value="0" TabIndex="0"></telerik:RadButton>
                     <asp:CustomValidator ID="Customvalidator1" ErrorMessage="Expedite Request is Required" runat="server" ForeColor="Red" ValidationGroup="s3" ClientValidationFunction="ValidateRadButtons" Display="None" />
                 </div>
             </div>
         </div>
         <div class="row">
             <div class="form-group">
                 <asp:Label ID="lblDueDate" runat="server" CssClass="control-label col-md-3" Text="Due Date" AssociatedControlID="txtDueDate">Due Date</asp:Label>
 
                 <div class="col-md-4">
                     <telerik:RadTextBox ID="txtDueDate" runat="server" Enabled="false" TabIndex="0"></telerik:RadTextBox>
                 </div>
             </div>
         </div>
         <div class="row">
             <div class="form-group">
                 <asp:Label ID="lblVAIQ" runat="server" Text="VAIQ Number" CssClass="control-label col-md-3" AssociatedControlID="txtvaiq">VAIQ Number<span class="required">*</span></asp:Label>
 
                 <div class="col-md-4">
                     <telerik:RadTextBox ID="txtvaiq" runat="server" CssClass="form-control" Width="450px" TabIndex="0" MaxLength="15"></telerik:RadTextBox>
                     <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" Display="None" ControlToValidate="txtvaiq" ForeColor="Red" ErrorMessage="VAIQ Number is Required" ValidationGroup="s3"></asp:RequiredFieldValidator>
                     <asp:RegularExpressionValidator
                         ID="RegularExpressionValidator1"
                         runat="server"
                         ControlToValidate="txtvaiq"
                         ValidationExpression="^[a-zA-Z0-9]+$"
                         ErrorMessage="Please enter Valid  VAIQ Number. Only Alphanumeric allowed."
                         ValidationGroup="s3" ForeColor="Red" Display="None">
                     </asp:RegularExpressionValidator>
 
 
                 </div>
             </div>
         </div>
 
         <div class="row">
             <div class="form-group">
                 <asp:Label ID="lblupload" runat="server" Text="Upload Files" CssClass="control-label col-md-3" AssociatedControlID="RadAsyncUpload1">Upload Files</asp:Label>
 
                 <div class="col-md-4">
                     <telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" Width="450px" OnClientFileUploading="OnClientFileUploading" ValidationGroup="s3" DisablePlugins="True" PostbackTriggers="dateERSDate,btnExpediteYes,btnExpediteNo" OnClientFileUploaded="checkFileNameNewReqeust" ChunkSize="0"></telerik:RadAsyncUpload>
 
                 </div>
             </div>
         </div>
Princy
Top achievements
Rank 2
 answered on 23 Jul 2014
7 answers
237 views
Hi, I am writing the statement like,
 int value=Convert.ToInt32(objRadDropDowmTree.EmbadedTree.Nodes[1].Value);

But its showing an error "Input string was not correct"
 Please tell me, how to access any specific node value? 

Please also help me, how to assign tooltip in RadDropDowmTree Nodes .
Shinu
Top achievements
Rank 2
 answered on 23 Jul 2014
1 answer
267 views

Hi,

I'm developing a web site using .Net 4.5, recently upgraded telerik from Bin40 to Bin45.

I have a parent master page, a nested master page that is use by the child  page with the issue.
the parent master page is a plain page (no telerik), the nested master page has telerik controls and contains the RadScriptManager, the child page uses the nested master page and its RadScriptManager.

Please let me know if you need more information. Thanks!

Unhandled exception at line 15, column 16485 in http://localhost:62340/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=MainContent_ScriptManagerDetail_TSM&compress=1&_TSM_CombinedScripts_=;;System.Web.Extensions,+Version=4.0.0.0,+Culture=neutral,+PublicKeyToken=31bf3856ad364e35:en-US:fa6755fd-da1a-49d3-9eb4-1e473e780ecd:ea597d4b:b25378d2;Telerik.Web.UI:en-US:68d9452f-f268-45b2-8db7-8c3bbf305b8d:16e4e7cd:f7645509:22a6274a:88144a7a:7c926187:8674cba1:b7778d6c:c08e9f8a:59462f1:a51ee93e:24ee1bba:f46195d3:2003d0b8:1e771326:aa288e2d:258f1c72:82923ac3:52af31a4:58366029
0x800a139e - JavaScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object.

web.config

<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <configSections>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
      <section name="CAFS.Web.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </sectionGroup>
  </configSections>
  <appSettings>
    ...
  </appSettings>

  <!--
    For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.

    The following attributes can be set on the <httpRuntime> tag.
      <system.Web>
        <httpRuntime targetFramework="4.5.1" />
      </system.Web>
  -->
  <system.web>
    <compilation debug="true" targetFramework="4.5.1" >
      <assemblies>
        <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
        <add assembly="System.Speech, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      </assemblies>
    </compilation>
    <authentication mode="Windows"/>
    <authorization>
      <allow roles="ADGROUP"/>
      <deny users="*"/>
    </authorization>
    <customErrors mode="RemoteOnly" defaultRedirect="~/Error/ErrorGeneric.aspx"/>
    <httpHandlers>
      <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false"/>
    </httpHandlers>
  </system.web>
  <system.diagnostics>
    <switches>
      <add name="sysLogSwitch" value="All"/>
      <add name="operationLogSwitch" value="All"/>
    </switches>
    <sources>
      <source name="sysLogSource" switchName="sysLogSwitch" switchType="System.Diagnostics.SourceSwitch">
        <listeners>
          <clear/>
        </listeners>
      </source>
      <source name="operationLogSource" switchName="operationLogSwitch" switchType="System.Diagnostics.SourceSwitch">
        <listeners>
          <clear/>
        </listeners>
      </source>
    </sources>
  </system.diagnostics>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <validation validateIntegratedModeConfiguration="false"/>
    <handlers>
      <add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource"/>
    </handlers>
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"/>
  </runtime>
  <applicationSettings>
      <!--SOME STTINGS HERE WS -->
  </applicationSettings>
</configuration>

Master Page
<%@ Master Language="C#" CodeBehind="Site.master.cs" Inherits="CAFS.Web.SiteMaster" %>...

Nested Master Page

<%@ Master Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Detail.master.cs" Inherits="CAFS.Web.Detail" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">

<script type="text/javascript">

function OnClientFilesUploaded(sender) {

--JSCODE HERE--

 

 

}

 

 

</script>

<telerik:RadScriptManager ID="ScriptManagerDetail" runat="server" ScriptMode="Release" EnablePartialRendering="true">

<Scripts>

<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js"></asp:ScriptReference>

<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js"></asp:ScriptReference>

<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js"></asp:ScriptReference>

</Scripts>

</telerik:RadScriptManager>
......

Child Page:
<%@ Page Title="" Language="C#" MasterPageFile="~/Detail.Master" CodeBehind="ManageAppeal.aspx.cs" Inherits="CAFS.Web.ManageAppeal"

EnableEventValidation="false" ValidateRequest="true" AutoEventWireup="true" EnableViewState="true" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

...

Steve
Top achievements
Rank 1
 answered on 22 Jul 2014
6 answers
260 views
I discovered that RadTreeView findControl only works in finding Telerik controls in a NodeTemplate, but does not work when trying to find an ASP control embedded in a NodeTemplate.  This forced me to change my NodeTemplate column from <asp:dropdownlist> to <telerik:RadDropDownList>. I dynamically add values to the dropdownlist server side in NodeDataBound (see code below).  This worked great with <asp:dropdownlist> but with <telerik:RadDropDownList> there are several issues:  1) values aren't displaying in the dropdownlist,  2) it appears there is a dropdown behind a dropdown, 3) dropdownlist width is incorrect.  I've attached an image showing RadTreeView using <telerik:RadDropDownList> versus <asp:dropdownlist>.  I want the solution using <telerik:RadDropDownList> to look exactly as it does using <asp:dropdownlist>.  Assistance in resolving this issue would be appreciated.  We are using Telerik Runtime Version v4.0.30319.  Thanks.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebFormRadDDL.aspx.cs" Inherits="WebApplication2.WebFormRadDDL" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<head runat="server">
    <title></title>
<!--Commenting out style stuff does not improve issues with RadDropDownList-->
<!--The style section below overrides Telerik skin to reduce the spacing between tree nodes.
Added background and border attributes to remove highlighting when selecting or mousing over a node.-->
<style type="text/css">
 
    div.RadTreeView
    {
        line-height: 16px !important;
    }
          
    div.RadTreeView .rtSp
    {
        height: 14px !important;
    }
          
    div.RadTreeView .rtHover .rtIn, div.RadTreeView .rtSelected .rtIn
    {
        background: none !important;
        border: none !important;
        padding: 1px 2px 1px !important;
    }
          
    div.RadTreeView .rtIn
    {
        padding: 1px 2px 1px !important;
    }
     
</style>
</head>
 
<body>
 
    <form id="form1" runat="server">
    <div>
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadTreeView ID="RadTreeView1" runat="server" 
        AutoGenerateColumns="False" OnNodeDataBound="RadTreeView1_NodeDataBound" OnNodeCreated="RadTreeView1_NodeCreated"
        DataFieldID="Node" DataFieldParentID="ParentNode" DataTextField="ParentNode" DataValueField="Description"
        Skin="Web20">   
        <NodeTemplate>
        <!-- don't make cellspacing too big or it messes with ddl activation-->
        <table cellspacing="10px">
            <tr>
            <td>
                <asp:Label runat="server" ID="lbl" Text='<%# DataBinder.Eval(Container, "Value") %>'></asp:Label>
            </td>
            <td></td>
            <td>
                <telerik:RadDropDownList ID="ddl" runat="server" DropDownHeight="15px" DropDownWidth="20px" Font-Size="10px" Enabled="true"> </telerik:RadDropDownList>
            </td>
            </tr>                 
         </table>
         </NodeTemplate>
     </telerik:RadTreeView>  
    </div>
    </form>
</body>
</html>
 
       protected void RadTreeView1_NodeDataBound(object sender, RadTreeNodeEventArgs e)
        {
 
            DataRowView item = e.Node.DataItem as DataRowView;
            string bold = item["Bold"].ToString();
            string validResponses = item["ValidResponses"].ToString();
            string responseRequired = item["ResponseRequired"].ToString() ;
            //RadTreeNode node = RadTreeView1.Nodes[0];
            RadDropDownList ddl = (RadDropDownList)e.Node.FindControl("ddl");
            Label lbl = (Label)e.Node.FindControl("lbl");
 
            if (bold == "Y")
            {
                lbl.Font.Bold = true;
            }
            if (responseRequired == "N")
            {
                ddl.Visible = false;
            }
            else
            {
                Array responses = validResponses.Split('|');
                ddl.Items.Add(new DropDownListItem("", ""));
                foreach (string response in responses)
                {
                 DropDownListItem ddlItem = new DropDownListItem(response, response);
                  ddl.Items.Add(ddlItem);
                }
            }
        }
Lynne
Top achievements
Rank 1
 answered on 22 Jul 2014
1 answer
964 views
Problem: The RadScriptManager is incompatible with the Ajax Control Toolkit (Version number 40412 and higher).

The following error appears when controls from the ACT are present on the page:
Microsoft JScript runtime error: AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts. Ensure the correct version of the scripts are referenced. If you are using an ASP.NET ScriptManager, switch to the ToolkitScriptManager in AjaxControlToolkit.dll.

Solution for .NET 4.0 projects:  Upgrade the RadControls for ASP.NET AJAX version 2010.1.625 or newer.

Important: Make sure you use the .NET 4.0 build of both Telerik.Web.UI.dll and AjaxControlToolkit.dll

If upgrade is not option you can use the following workaround:
<telerik:RadScriptManager runat="server" EnableScriptCombine="false" /> 

Solution for .NET 3.5 projects: Override the references to MicrosoftAjax.js and MicrosoftAjaxWebForms.js to point to the ACT script files.

<telerik:RadScriptManager runat="server"
    <Scripts> 
        <asp:ScriptReference Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
            Name="MicrosoftAjax.js" Path="Scripts-40412/MicrosoftAjax.js" /> 
        <asp:ScriptReference Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
            Name="MicrosoftAjaxWebForms.js" Path="Scripts-40412/MicrosoftAjaxWebForms.js" /> 
    </Scripts> 
</telerik:RadScriptManager> 
 

The script files are obtained by building the ACT from source. Sample project, including the scripts for version 40412, is attached.

Eyup
Telerik team
 answered on 22 Jul 2014
1 answer
83 views
Hi, I try to add new row to radGrid by this code (Add button)

PartDt.Rows.InsertAt(dr, 0);
dgdPart.CurrentPageIndex = 0;
dgdPart.DataSource = PartDt;
dgdPart.DataBind();
dgdPart.MasterTableView.Items[0].Edit = true;
dgdPart.Rebind();



   

After             dgdPart.Rebind();   code step into 

protected void dgdPart_ItemDataBound(object sender, GridItemEventArgs e)
{
           if (e.Item.IsInEditMode && e.Item is GridEditFormItem)
            {
                if (e.Item.ItemIndex > -1)
                {
                         RadComboBox cmbPart = (RadComboBox)dgdPart.Items[e.Item.ItemIndex].FindControl("radcmbPart");    //Error line
                          ....
}



I try to debug and see while e.Item.ItemIndex is 0 and the dgdPart.Items.Count is 0 at line "//Error line" so I got error "Index was out of range. Must be non-negative and less than the size of the collection."

I also found the dgdPart.Items.Count is 0 only in dgdPart_ItemDataBound, If I skip the erorr line above and continue until finish dgdPart_ItemDataBound, It comeback to dgdPart.Items.Count = 1

Could you suggest me to solve this problem?  Thanks!!



Below is my aspx code for this radGrid

<telerik:RadGrid ID="dgdPart" runat="server" AllowPaging="True" CellSpacing="0" GridLines="None" AutoGenerateColumns="False" OnEditCommand="dgdPart_EditCommand" OnNeedDataSource="dgdPart_NeedDataSource" OnCancelCommand="dgdPart_CancelCommand" OnItemDataBound="dgdPart_ItemDataBound" OnUpdateCommand="dgdPart_UpdateCommand">
                                                           <ClientSettings>
                                                               <Selecting CellSelectionMode="None">
                                                               </Selecting>
                                                           </ClientSettings>
                                                           <MasterTableView>
                                                               <CommandItemSettings ExportToPdfText="Export to PDF">
                                                               </CommandItemSettings>
                                                               <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                                                                   <HeaderStyle Width="20px"></HeaderStyle>
                                                               </RowIndicatorColumn>
                                                               <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                                                                   <HeaderStyle Width="20px"></HeaderStyle>
                                                               </ExpandCollapseColumn>
                                                               <Columns>
                                                                    <telerik:GridTemplateColumn FilterControlAltText="Filter CheckBoxTemplateColumn column" UniqueName="CheckBoxTemplateColumn">
                                                                                       <ItemTemplate>
                                                                                           <asp:CheckBox ID="chkToDelete" runat="server"/>
                                                                                       </ItemTemplate>
                                                                                       <ItemStyle HorizontalAlign="Center" VerticalAlign="Top" Width="20px" />
                                                                    </telerik:GridTemplateColumn>  
                                                                   <telerik:GridBoundColumn DataField="t_name" FilterControlAltText="Filter column column" HeaderText="อะไหล่" UniqueName="column">
                                                                   </telerik:GridBoundColumn>
                                                                   <telerik:GridBoundColumn DataField="life_time" FilterControlAltText="Filter column1 column" HeaderText="อายุการใช้งาน" UniqueName="column1">
                                                                   </telerik:GridBoundColumn>
                                                                   <telerik:GridBoundColumn DataField="start_date" FilterControlAltText="Filter column2 column" HeaderText="วันเริ่มต้นใช้งาน" UniqueName="column2">
                                                                   </telerik:GridBoundColumn>
                                                                   <telerik:GridBoundColumn DataField="expire_date" FilterControlAltText="Filter column3 column" HeaderText="วันสิ้นสุดใช้งาน" UniqueName="column3">
                                                                   </telerik:GridBoundColumn>
                                                                   <telerik:GridEditCommandColumn FilterControlAltText="Filter EditCommandColumn column">
                                                                   </telerik:GridEditCommandColumn>
                                                               </Columns>
                                                               <EditFormSettings EditFormType="Template">
                                                                                 <EditColumn uniquename="edit_data_form"/>
                                                                                   <FormTemplate>
                                                                                      
                                                                                       <table>
                                                                                           <tr>
                                                                                               <td style="width:100px;height:20px">
                                                                                                   อะไหล่ :
                                                                                               </td>
                                                                                               <td>
                                                                                                   <telerik:RadComboBox ID="radcmbPart" runat="server"   Width="300px"></telerik:RadComboBox>
                                                                                               </td>
                                                                                           </tr>
                                                                                           <tr>
                                                                                               <td style="width:100px;height:20px">
                                                                                                   อายุการใช้งาน :
                                                                                               </td>
                                                                                               <td>
                                                                                                   <telerik:RadNumericTextBox ID="radtxtLiftTime" runat="server" Text='<%# Bind("life_time") %>' Width="100px"></telerik:RadNumericTextBox>
                                                                                               </td>
                                                                                           </tr>
                                                                                              <tr>
                                                                                               <td style="width:100px;height:20px">
                                                                                                   วันเริ่มต้นใช้งาน :
                                                                                               </td>
                                                                                               <td>
                                                                                                   <asp:TextBox ID="txtPartStartDate" Text='<%# Bind("start_date") %>' runat="server" ></asp:TextBox>
                                                                                                   <asp:CalendarExtender ID="calendarPartStartDate" Format="dd/MM/yyyy" runat="server" TargetControlID="txtPartStartDate"></asp:CalendarExtender>
                                                                                                   
                                                                                               </td>
                                                                                           </tr>
                                                                                            </tr>
                                                                                              <tr>
                                                                                               <td style="width:100px;height:20px">
                                                                                                   วันสิ้นสุดใช้งาน :
                                                                                               </td>
                                                                                               <td>
                                                                                                   <asp:TextBox ID="txtPartExpireDate" Text='<%# Bind("expire_date") %>' runat="server" ></asp:TextBox>
                                                                                                   <asp:CalendarExtender ID="calendarPartExpireDate" Format="dd/MM/yyyy" runat="server" TargetControlID="txtPartExpireDate"></asp:CalendarExtender>
                                                                                               </td>
                                                                                           </tr>
 
                                                                                           <tr>
                                                                                               <td>                                                                                       
                                                                                               </td>
                                                                                               <td>
                                                                                                   <asp:Button ID="btnUpdate" CommandName="Update" Text="Update" runat="server" />  <asp:Button ID="btnCancel" CommandName="Cancel" Text="Cancel" runat="server" />                                           
                                                                                               </td>
                                                                                           </tr>
                                                                                       </table>                                                               
                                                                                   </FormTemplate>
                                                                                   <PopUpSettings ScrollBars="None" />                           
                                                                           </EditFormSettings>
                                                           </MasterTableView>
                                                           <FilterMenu EnableImageSprites="False">
                                                           </FilterMenu>
                                                       </telerik:RadGrid>

Viktor Tachev
Telerik team
 answered on 22 Jul 2014
3 answers
842 views
Hi all,
I'm dinamically adding columns to my RadGrid.
I need to add a GridDateTimeColumn to show and allow the user change a time, so I need to display data in format HH:ss .
I am trying to do this using DataFormatString property but it doesn't work: I always see the standard format yyyy/MM/dd HH:mm:ss .

Here is my code:

                    GridDateTimeColumn col = new GridDateTimeColumn();
                    col.PickerType = GridDateTimeColumnPickerType.TimePicker;
                    col.DataField = "FIELD";
                    col.DataType = typeof(DateTime);
                    col.DataFormatString = "{0:HH mm}";
                    myRadGrid.MasterTableView.Columns.Add(col);

Can anyone help me?
Thanks in advance.
Daniele
Top achievements
Rank 1
 answered on 22 Jul 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?