Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
160 views
Hi Every one,

this is what I am doing on client side

<telerik:RadCodeBlock runat="server">
        <script type="text/javascript">
            function OnClientSelectedIndexChanged_Country(sender, eventArgs) {
                var item = eventArgs.get_item();
                var inputElement = document.getElementById("<%= rpbMainInfo.FindItemByValue("CandidateInformation").FindControl("rtxtState").ClientID %>"); 
                 
                var Combo = document.getElementById("<%= rpbMainInfo.FindItemByValue("CandidateInformation").FindControl("rcbState").ClientID %>");
                if (item.get_selectedItem() == "United States") {
                    Combo.set_visible = true;
                    inputElement.set_visible = false;
                }
                else {
                    Combo.set_visible = false;
                    inputElement.set_visible = true;
                }
            }        
        </script>
    </telerik:RadCodeBlock>


<telerik:RadComboBox ID="rcbCountry" runat="server" DataSourceID="sdsCountries" DataTextField="COUNTRY"
                                                        DataValueField="COUNTRYCODE" Skin="Outlook" EmptyMessage="Please Select.."
                                                         OnClientSelectedIndexChanged="OnClientSelectedIndexChanged_Country">
                                                    </telerik:RadComboBox>


What I am trying to do is when the user selects the country as Unitedstates the combo box for states should be visible and when Country other than United states then the states would be a text box.I am able to do this on server side .But I am not able to get on client side .....

CAn we do it on client side or only sever side.




Can Any one help me with this please.


Thanks,
Sravanthi
sravanthi
Top achievements
Rank 1
 answered on 16 Sep 2011
3 answers
146 views
I've got a self-referencing hierarchical grid that displays the information as desired.  When the user clicks a row, s/he can then either view the row's details, reply to the thread or delete the thread.

The problem I'm having is capturing the Id of the selected row.  The Id is stored in the first column of the grid, which also contains the [+] button code (visible or not, depending on whether there's a child row).  For other columns, the following to retrieve the cell's contents as desired:

                        var rgGrid = $find("<%= grdNotes.ClientID %>");
                        var MasterTable = rgGrid.get_masterTableView();
                        var selectedRows = MasterTable.get_selectedItems();
                        for (var i = 0; i < selectedRows.length; i++)
                        {
                            var row = selectedRows[i];
                            var cell = MasterTable.getCellByColumnUniqueName(row, uniqueColName)
                            parentId = cell.innerHTML;
                        }                       

However, when the uniqueColName is the "Id" column, I also get back the HTML that creates the [+] button (when all I want is 21):

<input type="submit" name="ctl00$DetailBodyPlaceHolder$ucNotesGrid$grdNotes$ctl00$ctl10$MyExpandCollapseButton" value="" id="ctl00_DetailBodyPlaceHolder_ucNotesGrid_grdNotes_ctl00_ctl10_MyExpandCollapseButton" class="rgExpand" style="visibility:hidden;" />&nbsp;21

I've tried moving the button to its own column, but have been unsuccessful.

How can I read the Id value w/o getting the [+] code back as well?  Is there another property that will just return the value (e.g., 21)?

Also, how can I make the detail row line up with the parent row vs. being indented?
D
Top achievements
Rank 1
 answered on 16 Sep 2011
2 answers
140 views
Hi, I have this Radcombo with checkbox itemtemplate,  without any update panel it works perfectly as I wanted.
But if I add the update pannels in it won't load anymore unless user type in something on the radcombox box
Is there anyway to work around this. I need it to load without have to wait for user to type in a search string
and I also need the loadondemand because it is a huge amount of data to load to the radcombo
Thanks,
Quynh
Default.aspx
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="RadCombo._Default" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
    <style type="text/css">
        table
        {
            border-collapse: collapse;
        }
        table tr, td
        {
            padding: 3px;
        }
    </style>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <asp:ObjectDataSource ID="PatientDS" runat="server" SelectMethod="GetPatient" 
        TypeName="RadCombo.DB"  >
                                <SelectParameters>
                                    <asp:ControlParameter Name="Study" ControlID="ddlStudy" Type="String" DefaultValue="%" />
                                    <asp:ControlParameter Name="Site" ControlID="ddlSite" Type="String" DefaultValue="%" />
                                </SelectParameters>
                            </asp:ObjectDataSource>
      
    <div>
          
          
        <table>
            <tr>
                <td>
                    Study
                </td>
                <td>
                    <asp:DropDownList ID="ddlStudy" runat="server" Width="500px" AutoPostBack="true"
                        OnSelectedIndexChanged="ddlStudy_SelectedIndexChanged">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                    Site
                </td>
                <td>
                    <asp:UpdatePanel ID="updatePanel1" runat="server">
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="ddlStudy" EventName="SelectedIndexChanged" />
                        </Triggers>
                        <ContentTemplate>
                            <asp:DropDownList ID="ddlSite" runat="server" Width="500px" AutoPostBack="true"
                                >
                            </asp:DropDownList>
                              
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </td>
            </tr>
            <tr>
                <td style="height: 130px;" valign="top">
                    Patient<br />
                    <asp:CheckBox ID="cbPatientAll" runat="server" Text="Check All" />
                </td>
                <td valign="top">
                    <asp:UpdatePanel ID="updatePanel2" runat="server">
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="ddlStudy" EventName="SelectedIndexChanged" />
                            <asp:AsyncPostBackTrigger ControlID="ddlSite" EventName="SelectedIndexChanged" />
                        </Triggers>
                        <ContentTemplate>
                            <telerik:RadComboBox ID="cblPatient" runat="server" Skin="Office2007" DataSourceID="PatientDS"
                                EmptyMessage="All Patients" DataTextField="TEXT" DataValueField="VALUE" ShowMoreResultsBox="true"
                                ItemsPerRequest="250" LoadingMessage="Retrieving Patients" EnableAutomaticLoadOnDemand="true"
                                Filter="Contains" MaxHeight="100px" Height="100px" AllowCustomText="false" OnItemDataBound="CB1_ItemDataBound"
                                HighlightTemplatedItems="False" Width="300px" OpenDropDownOnLoad="true" OnClientDropDownClosing="onDropDownClosing"
                                OnDataBound="CB1_DataBound">
                                <ItemTemplate>
                                    <div onclick="StopPropagation(event)">
                                        <asp:CheckBox runat="server" ID="chk1" />
                                        <asp:Label runat="server" ID="label1" AssociatedControlID="chk1"><%# DataBinder.Eval(Container, "Text") %></asp:Label>
                                    </div>
                                </ItemTemplate>
                                <CollapseAnimation Duration="200" Type="OutQuint" />
                                  
                            </telerik:RadComboBox>
                              
                            <asp:HiddenField ID="HV1" runat="server" />
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </td>
            </tr>
        </table>
    </div>
    <script type="text/javascript" src="Scripts/jquery-1.4.1.min.js"></script>
    <script type="text/javascript">
        // NOTE - these two functions can be moved to the page
        function StopPropagation(e) {
            //cancel bubbling 
            e.cancelBubble = true;
            if (e.stopPropagation) {
                e.stopPropagation();
            }
        }
  
        function onDropDownClosing(sender, eventArgs) {
            eventArgs.set_cancel(true);
        }
        function allchecked(box) {
            var combo = $find(box);
            var items = combo.get_items();
            for (var i = 0; i < items.get_count(); i++) {
                var item = items.getItem(i);
                var chk1 = $get(combo.get_id() + '_i' + i + '_chk1');
                if (!chk1.checked) return false;
            }
            return true;
        }
        function onCheckBoxClick(me) {
            var cb = $("#<%=cbPatientAll.ClientID%>");
            cb.attr('checked', allchecked('<%=cblPatient.ClientID%>'));
  
            var chk1 = $get(me.id);
            var i = me.id.replace("<%=cblPatient.ClientID%>", "").replace("_chk1", "").replace("_i", "");
            //alert(i);
            var combo = $find('<%=cblPatient.ClientID%>');
            var items = combo.get_items();
            var item = items.getItem(i);
            var keepValue = $("#<%=HV1.ClientID %>").val();
            if (chk1.checked) {
                keepValue += item.get_value() + ',';
  
            }
            else {
                keepValue = keepValue.replace(item.get_value() + ',', '');
            }
            $("#<%=HV1.ClientID %>").val(keepValue);
        }
        $(document).ready(function () {
            $("#<%= cbPatientAll.ClientID %>").click(function (event) {
                var keepValue = "";
                var combo = $find('<%=cblPatient.ClientID%>');
                var items = combo.get_items();
                for (var i = 0; i < items.get_count(); i++) {
                    var item = items.getItem(i);
                    var chk1 = $get(combo.get_id() + '_i' + i + '_chk1');
                    chk1.checked = $('#' + this.id).is(':checked');
                    if ($('#' + this.id).is(':checked')) {
                        keepValue += item.get_value() + ',';
                    }
                }
                $("#<%=HV1.ClientID %>").val(keepValue);
  
            });
  
        });
        function pageLoad(sender, args) {
            $("#<%= ddlSite.ClientID %>").change(function () {
                //var combo = $find('<%=cblPatient.ClientID%>');
                //combo.clearItems();
                //combo.requestItems(' ', false);
  
            });
  
        }
          
  
  
    </script>
</asp:Content>
  
Default.aspx.cs
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
namespace RadCombo
{
    public partial class _Default : System.Web.UI.Page
    {
        private string Delimiter = ",";
        private DB myDBProc = new DB(); //DBProcessing Class Library
         
        protected void Page_Load(object sender, EventArgs e)
        {
  
            if (!this.IsPostBack)
            {
  
                myDBProc.GetStudy(ddlStudy);
            }
  
  
        }
        protected void CB1_ItemDataBound(object sender, RadComboBoxItemEventArgs e)
        {
            (e.Item.FindControl("chk1") as CheckBox).Attributes["onclick"] = "onCheckBoxClick(this)";
            if (HV1.Value.Contains(e.Item.Value)) (e.Item.FindControl("chk1") as CheckBox).Checked = true;
        }
        protected void CB1_DataBound(object sender, EventArgs e)
        {
            HV1.Value = "";
            StringBuilder sbValues = new StringBuilder();
            foreach (Telerik.Web.UI.RadComboBoxItem rcbItem in cblPatient.Items)
            {
                //If the box is checked return a value
                CheckBox cb = (CheckBox)rcbItem.FindControl("chk1");
                if (null != cb && cb.Checked)
                {
                    sbValues.Append(rcbItem.Value);
                    sbValues.Append(Delimiter);
                }
            }
  
            HV1.Value = sbValues.ToString();
  
        }
  
        protected void btnExecute_Click(object sender, EventArgs e)
        {
            string test = HV1.Value;
        }
        protected void ddlStudy_SelectedIndexChanged(object sender, EventArgs e)
        {
            myDBProc.GetSite(ddlSite, ddlStudy.SelectedValue);
        }
    }
}
  
DB.cs
sing System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Web.UI.WebControls;
namespace RadCombo
{
    public class DB
    {
        public void GetStudy( DropDownList list)
        {
  
            DataTable dt = new DataTable();
            dt.Columns.Add( new DataColumn("VALUE", typeof(int)));
            dt.Columns.Add(new DataColumn("TEXT", typeof(string)));
            DataRow dr = dt.NewRow();
            dr["Value"] = 1;
            dr["TEXT"] = "One";
            dt.Rows.Add(dr);
            list.DataValueField = dt.Columns["VALUE"].ColumnName;
            list.DataTextField = dt.Columns["TEXT"].ColumnName;
            list.DataSource = dt;
            list.DataBind();
            list.Items.Insert(0, new ListItem("Select a Study", ""));
        }
        public void GetSite( DropDownList list, string Study)
        {
              
            if (string.IsNullOrEmpty(Study) || Study == "%")
            {
                list.Items.Clear();
                return;
            }
  
            DataTable dt = new DataTable();
            dt.Columns.Add(new DataColumn("VALUE", typeof(int)));
            dt.Columns.Add(new DataColumn("TEXT", typeof(string)));
            DataRow dr = dt.NewRow();
            dr["Value"] = 11;
            dr["TEXT"] = "Eleven";
            dt.Rows.Add(dr);
            list.DataValueField = dt.Columns["VALUE"].ColumnName;
            list.DataTextField = dt.Columns["TEXT"].ColumnName;
            list.DataSource = dt;
            list.DataBind();
            list.Items.Insert(0, new ListItem("All Sites", "%"));
            list.Items.Insert(0, new ListItem("Select a Site", ""));
        }
        public DataTable GetPatient(string Study, string Site)
        {
  
            if (string.IsNullOrEmpty(Study) || Study == "%" || string.IsNullOrEmpty(Site))
            {
  
                 
                return new DataTable();
            }
            DataTable dt = new DataTable();
            dt.Columns.Add(new DataColumn("VALUE", typeof(int)));
            dt.Columns.Add(new DataColumn("TEXT", typeof(string)));
            DataRow dr = dt.NewRow();
            dr["Value"] = 100;
            dr["TEXT"] = "One Hundred";
            dt.Rows.Add(dr);
            dr = dt.NewRow();
            dr["Value"] = 101;
            dr["TEXT"] = "One Hundred And One";
            dt.Rows.Add(dr);
            dr = dt.NewRow();
            dr["Value"] = 102;
            dr["TEXT"] = "One Hundred And Two";
            dt.Rows.Add(dr);
  
             
            return dt;
        }
    }
      
  
}
Quynh
Top achievements
Rank 1
 answered on 16 Sep 2011
3 answers
488 views
Hi,
i am using Q2 2009 version.I am having a problem with RadDatePicker control.I want to set  focus to the raddatepicker when the page gets loaded. i am using myraddatepicker.dateinput.focus() on my page_load function,But the focus is not setting to raddatepicker.

Please give me the solution ASAP.

Regards
Rahul Khinvasara.
Big
Top achievements
Rank 1
 answered on 16 Sep 2011
1 answer
97 views
Hello,

Our core web application is using several telerik charting controls. Customers have asked us to implement a radar type of chart control. From what I understand telerik is not supporting this type of control in its suite of chart types.

The microsoft controls on the other hand do support this type in "System.Web.DataVisualization". Most logical sollution would be to combine the 2. While doing this I run into a spot of trouble. Both sollutions require several similar web.config alterations. Added hanlers "chartimagehandler" pointing towards "ChartImg.axd".

How can I solve this situation. Of course I can drop telerik charting tools in favour of the ms version. But at this point we are rather satisfied how the telerik controls work.

Some guidance would be appreciated.

-- jan willem







jan willem fransen
Top achievements
Rank 1
 answered on 16 Sep 2011
3 answers
138 views
I took a break from ASP.NET development for several months but now I'm coming back to it.  I still prefer web forms to MVC, but for this discussion that may be irrelevant.  I have a Premium Collection license and I'm always interested in what can be done to maximize my efficiency in the use of these tools.

Coming back to this after some time off I'm struck by the labor involved to manifest extremely common functionality.  Specifically, I'm talking about binding data to controls, with subsequent sort, filter, and paging abilities where supported by the controls (like RadGrid).  I know this applies to all ASP.NET development but I'm wondering what we can use in RadControls to simplify our development - or if there is something else I should be considering to merge with RadControls.

We can create classes to support ObjectDataSource but there is always the question of whether the source object should be a DataSet, DataTable, DataView, etc.  A basic List<T> doesn't provide extended functionality.  I want my UI controls to allow the user to filter and sort client-side data without going back to the server.  When going back to the server, the Select DataMethod should provide server-tier filtering and sorting.  Paging from a data set created on the server should be as fast as possible, without rebuilding the data set each time to extract a new page.

The ObjectDataSource itself is limited. Manuel Abadia offers customized ODS components to overcome the limitations.  Scott Gu is writing a series of blogs on upcoming "vNext" improvements in databinding and related functionality.  Many of us choose not to use the ODS for some projects, preferring to bind strongly typed classes directly to the DataSource property of controls and then manually handling the events for all functionality.

Given all of that, we keep rebuilding the same functionality over and over.  Has anyone adopted a set of classes that is specifically designed to handle all of these situations?  Is there a book that describes the best practices for each case of client- or server-side processing of data sources for specific kinds of components?  Is there something special in .NET 4 that addresses a lot of these concerns?  Does Telerik have blogs or other documentation that goes in-depth on the best ways to handle NeedsDataSource and other events?  ... And I don't mean the same documentation that we've seen over many years, but something new and fresh that picks up where the old documentation leaves off.

I want to put all of this behind me.  I want to make use of the latest knowledge and code advances to code faster and more effectively.  I want information or an SDK (FOSS or commercial) that does for databinding what RadControls does for the user interface.  I want to spend my time on actual functionality rather than on all of this plumbing.

Thanks for your consideration and responses.
Veli
Telerik team
 answered on 16 Sep 2011
5 answers
309 views
Hi all, how can i FindControl GridTableView when i click "Next" button :((. i try to find control "<asp:Label ID="OrderIDLabel" runat="server" Text='<%# Eval("OrderID") %>'></asp:Label> "
  but i can't, who can help me now
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
 
 
        <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" GridLines="None"
            ShowGroupPanel="True" Skin="Outlook" OnDetailTableDataBind="RadGrid1_DetailTableDataBind"
            HorizontalAlign="Left" DataMember="T_Company"    
                    onitemcommand="RadGrid1_ItemCommand"
                    onneeddatasource="RadGrid1_NeedDataSource"
                    onitemdatabound="RadGrid1_ItemDataBound" onprerender="RadGrid1_PreRender">
            <ClientSettings AllowDragToGroup="True">
            </ClientSettings>
            <MasterTableView Name="abc_" AutoGenerateColumns="false" AllowMultiColumnSorting="True" GridLines="Horizontal"
                DataKeyNames="CompanyID" DataMember="T_Company"
                GroupsDefaultExpanded="true">
                <ParentTableRelation>
                    <telerik:GridRelationFields DetailKeyField="CustomerID" MasterKeyField="CustomerID" />
                </ParentTableRelation>
                <ExpandCollapseColumn Visible="True">
                </ExpandCollapseColumn>
                <Columns>
                    <telerik:GridBoundColumn DataField="CompanyName" HeaderText="Dịch Vụ" UniqueName="column2">
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn DataField="Deposit" HeaderText="Đặt Cọc" UniqueName="column">
                        <EditItemTemplate>
                            <asp:Label ID="DepositLabel" runat="server" Text='<%# Eval("Deposit") %>'></asp:Label>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:TextBox ID="DepositTextBox" runat="server" Text='<%# Bind("Deposit") %>'></asp:TextBox>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                    <telerik:GridTemplateColumn UniqueName="column1" HeaderText="Người Thanh Toán">
                        <EditItemTemplate>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="SqlDataSource1"
                                DataTextField="GuiderName" DataValueField="GuiderID">
                            </asp:DropDownList>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                </Columns>
                <DetailTables>
                    <telerik:GridTableView Name="show_" runat="server" Visible="true" DataKeyNames="CompanyID"
                        DataMember="CompanyID" Width="100%" AutoGenerateColumns="false" GridLines="Horizontal"
                        ShowFooter="True" Font-Bold="False" Font-Italic="False"
                        Font-Overline="False" Font-Strikeout="False" Font-Underline="False"
                        ForeColor="Blue">
                        <ParentTableRelation>
                            <telerik:GridRelationFields DetailKeyField="CompanyID" MasterKeyField="CompanyID" />
                        </ParentTableRelation>
                        <Columns>
                            <telerik:GridTemplateColumn DataField="OrderID" HeaderText="ID" UniqueName="column1">
                                <EditItemTemplate>
                                    <asp:TextBox ID="OrderIDTextBox" runat="server" Text='<%# Bind("OrderID") %>'></asp:TextBox>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="OrderIDLabel" runat="server" Text='<%# Eval("OrderID") %>'></asp:Label>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridBoundColumn DataField="ProvideName" HeaderText="Dịch Vụ" UniqueName="column2">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="CurrentPrice" HeaderText="Đơn Giá" UniqueName="column3">
                            </telerik:GridBoundColumn>
                            <telerik:GridTemplateColumn DataField="BookQty" HeaderText="SL Dự Kiến" UniqueName="column4">
                                <EditItemTemplate>
                                    <asp:TextBox ID="BookQtyTextBox" runat="server" Text='<%# Bind("BookQty") %>'></asp:TextBox>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="BookQtyLabel" runat="server" Text='<%# Eval("BookQty") %>'></asp:Label>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn DataField="PriceOper" HeaderText="TT Dự Kiến" UniqueName="column5">
                                <EditItemTemplate>
                                    <asp:TextBox ID="PriceOperTextBox" runat="server" Text='<%# Bind("PriceOper") %>'></asp:TextBox>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="PriceOperLabel" runat="server" Text='<%# Eval("PriceOper") %>'></asp:Label>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn DataField="CurrentQty" HeaderText="SL thực Tế" UniqueName="column6"
                                DataType="System.Int32">
                                <EditItemTemplate>
                                    <asp:Label ID="CurrentQtyLabel" runat="server" Text='<%# Eval("CurrentQty") %>'></asp:Label>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:TextBox ID="CurrentQtyTextBox" runat="server" Width="50" Text='<%# Eval("CurrentQty") %>'></asp:TextBox>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridTemplateColumn DataField="CurrentPay" HeaderText="TT Thực Tế" UniqueName="column7"
                                DataType="System.Int32">
                                <EditItemTemplate>
                                    <asp:Label ID="CurrentPayLabel" runat="server" Text='<%# Eval("CurrentPay") %>'></asp:Label>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:TextBox ID="CurrentPayTextBox" runat="server" Width="50" Text='<%# Eval("CurrentPay") %>'></asp:TextBox>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <telerik:GridBoundColumn DataField="DifferenceQty" HeaderText="SL Phát Sinh" UniqueName="column9">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="DifferencePrice" HeaderText="CP Phát Sinh" UniqueName="column10">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="TotalPrice" HeaderText="Thành Tiền" UniqueName="column11">
                            </telerik:GridBoundColumn>
                        </Columns>
                        <FooterStyle Font-Bold="True" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
                            Font-Underline="False" ForeColor="Red" Wrap="True" />
                    </telerik:GridTableView>
                </DetailTables>
            </MasterTableView>
        </telerik:RadGrid>
<asp:Button ID="Button1" runat="server" Text="Tiếp Tục"
                    onclick="Button1_Click" />
Ho Tri
Top achievements
Rank 1
 answered on 16 Sep 2011
7 answers
342 views
In using the radgrid control we want the scroll bars to behave as if in auto mode, displaying the scroll bars when there's more data to display. However if we set one of the columns to frozen, I see that the control builds it's own horizontal scrollbar overwriting the one set by the browser. We currently use the grid allowing the users to customize the columns to be displayed, thus they are able to display fewer columns which doesn't fill their browser width. This *should* result in the scroll bar getting hidden, and in IE8 under compatibility mode it does. However for our users not using compatibility mode they continue to see the scrollbar even when there's nothing to scroll to. The scroll bar is displaying properly in that it's grayed out showing there's nothing to scroll ( basically functioning as if the scroll mode is set to overflow: scroll vice overflow: auto), however we'd like to hide the scroll bar if there is nothing to scroll to see (overflow: auto).

Thanks
Bryant
Pavlina
Telerik team
 answered on 16 Sep 2011
9 answers
1.5K+ views
Version: Q1 2009 (.NET 3.5)
Language: C#
Dev: VS 2005

I have a page that allows the user to select a database table from a dropdown list and display the data in a RadGrid.  The RadGrid is set to automatically generate columns and allow scrolling and sorting.  If I switch between tables without sorting, I get no errors.  However, if I pick a table, sort on a column, and then select another table to view, I get a runtime error of "[column] is neither a DataColumn nor a DataRelation for table [tablename]."   Code snippet below. 

protected void RefreshData() 
        { 
          DataSet  ds; 
          string   query; 
          string   tableName; 
           
          // clear old data 
          UserMsg.Text = ""
          Cache.Remove("wadv_ds"); 
          clearGrid(); 
 
          // get data 
          tableName = cbTableList.SelectedValue; 
          query = @"SELECT * FROM " + tableName; 
          ds = dba.ReadData(query, tableName); 
 
          // update grid 
          if (ds == null) 
            { 
              UserMsg.Text = "DataSet is null."
            } 
           else if (ds.Tables[0].Rows.Count == 0) 
            { 
              UserMsg.Text = "Table has no data."
            } 
           else 
            { 
              Cache["wadv_ds"] = ds.Tables[0]; 
 
              rgData.DataSource = ds.Tables[0]; 
              rgData.DataBind();                               //  <=== ERROR OCCURS HERE 
            } 
        } 
        //------------------------------------------------------------------------- 
    protected void clearGrid() 
    { 
      rgData.DataSource = null
      rgData.DataBind(); 
      rgData.Columns.Clear(); 
    } 
    //------------------------------------------------------------------------- 

Any help resolving this would be greatly appreciated.  Thanks.
Swapna
Top achievements
Rank 1
 answered on 16 Sep 2011
3 answers
156 views
I have a method that I use to reset a form after a submit or if the user chooses to click a reset button. For the most part it works, however if Im using a combobox that is tied to a LoadOnDemand event, the selected item is still displayed. It does appear that the remaining items are reloaded when I click the dropdown arrow.

Here is the code I'm using:

public static void resetForm(Control parent)
 {
     foreach (Control c in parent.Controls)
     {
         if (c.Controls.Count > 0)
         {
             resetForm(c);
         }
         else
         {
             switch (c.GetType().ToString())
             {
                 case "Telerik.Web.UI.RadTextBox":
                     ((RadTextBox)c).Text = "";
                     break;
 
                 case "Telerik.Web.UI.RadComboBox":
                     ((RadComboBox)c).ClearSelection();
                     ((RadComboBox)c).Text = string.Empty;
 
                     break;
 
                 case "Telerik.Web.UI.RadTimePicker":
                     ((RadTimePicker)c).Clear();
                     break;
 
                 case "Telerik.Web.UI.RadDatePicker":
                     ((RadDatePicker)c).Clear();
                     break;
 
                 case "System.Web.UI.WebControls.CheckBox":
                     ((CheckBox)c).Checked = false;
                     break;
 
             }
         }
     }
 }

Thanks,
Kalina
Telerik team
 answered on 16 Sep 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?