Radcombobox value clear

Thread is closed for posting
9 posts, 0 answers
  1. Tamim
    Tamim avatar
    64 posts
    Member since:
    May 2011

    Posted 18 Jan 2013 Link to this post

    I have used radcombobox in RadGrid column

    See my Aspx code:
    <telerik:RadGrid ID="RadGrid1" runat="server" OnItemDataBound="RadGrid1_ItemDataBound"
                                                Skin="Office2007" GridLines="None" OnItemCreated="RadGrid1_ItemCreated">
                                                <MasterTableView AutoGenerateColumns="False" IsFilterItemExpanded="false">
                                                    <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                                                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                                                    </RowIndicatorColumn>
                                                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                                                    </ExpandCollapseColumn>
                                                    <Columns>
                                                        <telerik:GridTemplateColumn HeaderText="<%$ Resources:PurchaseOrder, SN %>">
                                                            <ItemTemplate>
                                                                <asp:Label ID="Sno" runat="server" Text="Label" Width="35px" Style="text-align: center">
                                                                </asp:Label>
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridTemplateColumn HeaderText="<%$ Resources:PurchaseOrder, Itm %>">
                                                            <ItemTemplate>
                                                               <telerik:RadComboBox ID="itemcode" runat="server" Width="100px" ShowToggleImage="false"
                                                                    DataTextField="itemno" DataValueField="itemno" EnableAutomaticLoadOnDemand="true"
                                                                    ItemsPerRequest="10" ToolTip="Item ComboBox" ShowMoreResultsBox="true" AutoPostBack="true"
                                                                    OnSelectedIndexChanged="Item_SelectedIndexChanged" EnableVirtualScrolling="true"
                                                                    Skin="Simple" AccessKey="T" MarkFirstMatch="true" AppendDataBoundItems="true" >
                                                                </telerik:RadComboBox>
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridTemplateColumn HeaderText="<%$ Resources:PurchaseOrder, WrDesc %>">
                                                            <ItemTemplate>
                                                               <telerik:RadComboBox ID="Description" runat="server" Width="250px" ShowToggleImage="false"
                                                                    DataTextField="workdescription" DataValueField="workdescription" EnableAutomaticLoadOnDemand="True"
                                                                    ItemsPerRequest="10" ToolTip="Item ComboBox" ShowMoreResultsBox="true" EnableVirtualScrolling="true"
                                                                    Skin="Simple" AccessKey="T" MarkFirstMatch="true" OnSelectedIndexChanged="Description_SelectedIndexChanged"
                                                                    AutoPostBack="true">
                                                                </telerik:RadComboBox>
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridTemplateColumn HeaderText="<%$ Resources:PurchaseOrder, Cat %>">
                                                            <ItemTemplate>
                                                                <telerik:RadTextBox ID="Category" runat="server" Width="100px" AutoCompleteType="Disabled"
                                                                    FocusedStyle-BackColor="Lavender" MaxLength="30" CssClass="Capitalize1" Text='<%# Bind("category") %>'
                                                                    onkeydown="return (event.keyCode!=13);">
                                                                </telerik:RadTextBox>
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridTemplateColumn HeaderText="<%$ Resources:PurchaseOrder, ArtNo %>">
                                                            <ItemTemplate>
                                                                <telerik:RadTextBox ID="ArticleNo" runat="server" Width="100px" AutoCompleteType="Disabled"
                                                                    FocusedStyle-BackColor="Lavender" MaxLength="15" CssClass="Capitalize1" Text='<%# Bind("articleno") %>'
                                                                    onkeydown="return (event.keyCode!=13);">
                                                                </telerik:RadTextBox>
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridTemplateColumn HeaderText="<%$ Resources:PurchaseOrder, Qty %>">
                                                            <ItemTemplate>
                                                                <telerik:RadNumericTextBox ID="Quantity" runat="server" Width="50px" AutoCompleteType="Disabled"
                                                                    FocusedStyle-BackColor="Yellow" MaxLength="5" IncrementSettings-InterceptMouseWheel="false"
                                                                    NumberFormat-GroupSizes="5" Text='<%# Bind("quantity") %>' onkeydown="return (event.keyCode!=13);">
                                                                    <ClientEvents OnKeyPress="NoDecimal" />
                                                                </telerik:RadNumericTextBox>
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridTemplateColumn HeaderText="<%$ Resources:PurchaseOrder, Unt %>" Visible="false">
                                                            <ItemTemplate>
                                                                <telerik:RadComboBox ID="RadComboBox_Unit" runat="server" AutoPostBack="false" AppendDataBoundItems="true"
                                                                    FocusedStyle-BackColor="Lavender" Width="70px" DataValueField="unit" DataTextField="unit"
                                                                    Enabled="false" Visible="false">
                                                                </telerik:RadComboBox>
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridTemplateColumn HeaderText="<%$ Resources:PurchaseOrder, ppu %>">
                                                            <ItemTemplate>
                                                                <telerik:RadNumericTextBox ID="price" runat="server" Width="80px" AutoCompleteType="Disabled"
                                                                    FocusedStyle-BackColor="Yellow" MaxLength="8" IncrementSettings-InterceptMouseWheel="false"
                                                                    NumberFormat-GroupSizes="8" Text='<%# Bind("price") %>' onkeydown="return (event.keyCode!=13);">
                                                                </telerik:RadNumericTextBox>
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridTemplateColumn HeaderText="<%$ Resources:PurchaseOrder, amt %>">
                                                            <ItemTemplate>
                                                                <telerik:RadNumericTextBox ID="Amount" runat="server" Width="85px" ReadOnly="true"
                                                                    ReadOnlyStyle-ForeColor="Red" MaxLength="8" Text='<%# Bind("amount") %>' onkeydown="return (event.keyCode!=13);">
                                                                </telerik:RadNumericTextBox>
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                    </Columns>
                                                    <EditFormSettings>
                                                        <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                                                        </EditColumn>
                                                    </EditFormSettings>
                                                </MasterTableView>
                                                <ClientSettings EnablePostBackOnRowClick="false" AllowDragToGroup="true">
                                                    <Selecting AllowRowSelect="true" />
                                                </ClientSettings>
                                                <FilterMenu EnableImageSprites="False">
                                                </FilterMenu>
                                                <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_">
                                                </HeaderContextMenu>
                                            </telerik:RadGrid>

    See my Po image select items
    when i click Add row button clear the first and second column are empty to bind (see My Po1 image)
    My cs coding is :

    protected void btnaddrow_Click(object sender, EventArgs e)
            {
                DataTable dt = (DataTable)Session["PurchaseOrder"];
                int finalrow = dt.Rows.Count + 1;
                object[] emptyrow = new object[columcount];
                emptyrow[0] = finalrow.ToString();
                dt.Rows.Add(emptyrow);

                assigndt2(dt);

                tabledata1 = dt;
                RadGrid1.DataSource = tabledata1;
                RadGrid1.DataBind();

                for (int i = 0; i <= RadGrid1.Items.Count - 1; i++)
                {
                    RadComboBox ddlitemcode = (RadComboBox)RadGrid1.Items[i].FindControl("itemcode");

                    string orgreqfinal = ("select itemno from dsprojectwork " +
                                            "where status <> 'del'");

                    ddlitemcode.DataSource = oDBClientADO.GetDataTable(orgreqfinal);// UnitName.DataSource = orgreqfinal;
                    ddlitemcode.DataValueField = "itemno";
                    ddlitemcode.DataTextField = "itemno";
                }
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    RadComboBox ddlitemcode = (RadComboBox)RadGrid1.Items[i].FindControl("itemcode");

                    if (dt.Rows.Count > i)
                    {
                        if (dt.Rows[i]["itemno"].ToString() != "")
                        {
                            ddlitemcode.SelectedValue = dt.Rows[i]["itemno"].ToString();
                        }
                        else
                        {
                            break;
                        }
                    }
                    else
                    {
                        break;
                    }
                }
            }

      private DataTable tabledata1
            {
                get
                {
                    DataTable dt = (DataTable)Session["PurchaseOrder"];

                    if (dt == null)
                    {
                        dt = new DataTable();
                        object[] emptyrow = new object[columcount];
                        dt.Columns.Add("Sno", typeof(string));
                        dt.Columns.Add("itemno", typeof(string));
                        dt.Columns.Add("workdescription", typeof(string));
                        dt.Columns.Add("Category", typeof(string));
                        dt.Columns.Add("ArticleNo", typeof(string));
                        dt.Columns.Add("Quantity", typeof(string));
                        dt.Columns.Add("Unit", typeof(string));
                        dt.Columns.Add("price", typeof(string));
                        dt.Columns.Add("Amount", typeof(string));

                        for (int i = 1; i < rowcount + 1; i++)
                        {
                            emptyrow[0] = i.ToString();
                            dt.Rows.Add(emptyrow);
                        }
                        tabledata1 = dt;
                    }
                    return dt;
                }
                set
                {
                    Session["PurchaseOrder"] = value;
                }
            }

            private void assigndt2(DataTable dt)
            {
                RadComboBox r1;
                RadNumericTextBox rn1;
                RadTextBox rt1;
                for (int i = 0; i <= RadGrid1.Items.Count - 1; i++)
                {
                    r1 = (RadComboBox)RadGrid1.Items[i].FindControl("itemcode");
                    dt.Rows[i]["itemno"] = r1.SelectedValue;
                    r1 = (RadComboBox)RadGrid1.Items[i].FindControl("Description");
                    dt.Rows[i]["workdescription"] = r1.SelectedValue;
                    rt1 = (RadTextBox)RadGrid1.Items[i].FindControl("Category");
                    dt.Rows[i]["Category"] = rt1.Text;
                    rt1 = (RadTextBox)RadGrid1.Items[i].FindControl("ArticleNo");
                    dt.Rows[i]["ArticleNo"] = rt1.Text;
                    rn1 = (RadNumericTextBox)RadGrid1.Items[i].FindControl("Quantity");
                    dt.Rows[i]["Quantity"] = rn1.Text;
                    rn1 = (RadNumericTextBox)RadGrid1.Items[i].FindControl("price");
                    dt.Rows[i]["price"] = rn1.Text;
                    rn1 = (RadNumericTextBox)RadGrid1.Items[i].FindControl("Amount");
                    dt.Rows[i]["Amount"] = rn1.Text;
                }
            }

    Advance Thanks
    Ansari

     
  2. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 23 Jan 2013 Link to this post

    Hi Ansari,

    "Po1" image is missing. Can you attach it again? You can try to clear the  RadComboBoxes after the new row is added in btnaddrow_Click event handler, using clearSelection() method.

    Kind regards,
    Hristo Valyavicharski
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Tamim
    Tamim avatar
    64 posts
    Member since:
    May 2011

    Posted 24 Jan 2013 Link to this post


    Thanks Hristo Valyavicharski ur reply. I have attached Po1 image.
    In grid 5 rows default. How to row added in 5th row item selected.
    See my PO3 image When i select item in last row Previous row item & Work description are cleared(See image Po1).
    how to fix the problem.
    This form i have used RadTab also


    One more doubt in How to Check duplicate item selected in grid when item selected.

    Thanks & Advance
    Ansari.
  5. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 29 Jan 2013 Link to this post

    Hi Ansari,

    I'm not sure what exactly you are trying to achieve. After adding new row do you want to clear values of the combos or you want to select them as default values. The fastest way to help you in resolving this is to provide us with runnable sample.

    Regards,
    Hristo Valyavicharski
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  6. Tamim
    Tamim avatar
    64 posts
    Member since:
    May 2011

    Posted 31 Jan 2013 Link to this post

    Thanks for ur reply Hristo Valyavicharski ....

    Attached one image.
    Description RadCombobox used databind to database. First 4rows are data entried then 5th row description selected values previous 4 rows data are cleared description field only how to solve this problem?

    one more doubt. How could i check Description selected value again not selected(Duplicate) set alert message.

    This is my aspx coding is:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frmsample.aspx.cs" Inherits="Sampleproject.frmsample"
        MasterPageFile="~/Site.Master" %>

    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <asp:Content ID="aboutContent" ContentPlaceHolderID="MainContent" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <telerik:RadCodeBlock runat="server" ID="radCodeBlock">
            <style type="text/css">
                .rcbHeader ul, .rcbFooter ul, .rcbItem ul, .rcbHovered ul, .rcbDisabled ul
                {
                    width: 100%;
                    display: inline-block;
                    margin: 0;
                    padding: 0;
                    list-style-type: none;
                }
                
                .col1, .col2, .col3
                {
                    float: left;
                    width: 110px;
                    margin: 0;
                    padding: 0 5px 0 0;
                    line-height: 14px;
                }
                
                label, .selection-result
                {
                    font: 13px 'Segoe UI' , Arial, sans-serif;
                    color: #4888a2;
                }
                
                label
                {
                    padding: 0 10px 0 0;
                }
                
                .button
                {
                    vertical-align: middle;
                    margin-left: 10px;
                }
                
                .selection-result
                {
                    padding: 10px 0 10px 0;
                    display: block;
                }
                
                div.bigModuleBottom
                {
                    padding-top: 25px;
                }
            </style>
            <script type="text/javascript">
                function isnull(val1, val2) {
                    if (val1 == "")
                        return val2;
                    else
                        return val1;
                }
                function AmountCalculation(Grid, Quantity, Rate, Amount, subtoal) {
                    var sbtot = 0;
                    var Amtvalue = 0;
                    var Feesvalue = 0;
                    var Grid = $find(Grid);
                    var Quantity = $find(Quantity).get_textBoxValue();
                    var Rate = $find(Rate).get_textBoxValue();
                    var Amount = $find(Amount);
                    var gsctperc = $find("<%=NetFees.ClientID %>");
                    var check = document.getElementById("<%=chk_discount.ClientID %>");
                    var common1 = gsctperc.get_value();
                    Amount.set_value(Quantity * Rate);
                    var test = Amount.set_value(Quantity * Rate);
                    var NetAmount = $find("<%=NetAmount.ClientID %>");
                    var grid = $find("<%=RadGrid1.ClientID %>");
                    var MasterTable = grid.get_masterTableView();
                    var Rows = MasterTable.get_dataItems();
                    var common = NetAmount.get_value();
                    for (var i = 0; i < Rows.length; i++) {
                        var row = Rows[i];
                        var qnt = row.findControl("Quantity");
                        var Amt = row.findControl("Amount");
                        var Amnt = Amt.get_value();
                        var QTY = qnt.get_value();

                        if (QTY != "") {
                            if (check.checked == true) {
                                Amtvalue = eval(isnull(Amnt, 0));
                                sbtot = eval(isnull(sbtot, 0)) + Amnt;
                                sbtot1 = (sbtot * common1 / 100)
                                sbtot2 = (sbtot1 + sbtot);
                                sbtot3 = (sbtot1 + sbtot);
                                calcsubtotal(Grid, sbtot, sbtot1, sbtot2, sbtot3);
                                TotalCalculation(Grid, Amtvalue, 0)
                            }
                            else {

                            }
                        }
                    }
                }
                function calcsubtotal(Grid, sbtot, sbtot1, sbtot2, sbtot3) {
                    var NetAmount = $find("<%=NetAmount.ClientID %>");
                    var gstper = $find("<%=NetFees.ClientID %>");
                    var gstamt = $find("<%=Netfeesamount.ClientID %>");
                    var nettoal = $find("<%=NetTotal.ClientID %>");
                    var Quat_Amt = $find("<%=Quat_Amt.ClientID %>");
                    Quat_Amt.set_value(sbtot);
                    NetAmount.set_value(sbtot);
                    gstamt.set_value(sbtot1);
                    nettoal.set_value(sbtot2);
                }
                function TotalCalculation(Grid, Amount, va) {
                    var sbtot = 0;
                    var sbtot1 = 0;
                    var sbtot2 = 0;
                    var samt = 0;
                    var Grid = $find(Grid);

                    var NetFees = $find("<%=NetFees.ClientID %>");
                    var NetTotal = $find("<%=NetTotal.ClientID %>");
                    var Quat_Amt = $find("<%=Quat_Amt.ClientID %>");

                    var grid = $find("<%=RadGrid1.ClientID %>");
                    var MasterTable = grid.get_masterTableView();
                    var Rows = MasterTable.get_dataItems();
                    var common1 = NetFees.get_value();
                    var common2 = NetTotal.get_value();
                    common2 = 0;
                    for (var i = 0; i < Rows.length; i++) {
                        var row = Rows[i];
                        var Amt = row.findControl("Amount");
                        var Amnt = Amt.get_value();
                    }
                }
                function calcsubtotal1(Grid, sbtot, sbtot1, sbtot2) {

                    var NetFees = $find("<%=NetFees.ClientID %>");
                    var NetTotal = $find("<%=NetTotal.ClientID %>");
                    var Quat_Amt = $find("<%=Quat_Amt.ClientID %>");

                    NetTotal.set_value(sbtot1);
                    Quat_Amt.set_value(sbtot2);
                }
                function CheckCalulation(Grid) {
                    //debugger;
                    var subtoal = $find("<%=NetAmount.ClientID %>");
                    var gstper = $find("<%=NetFees.ClientID %>");
                    var gstamt = $find("<%=Netfeesamount.ClientID %>");
                    var nettoal = $find("<%=NetTotal.ClientID %>");
                    var sbtot = subtoal.get_value();
                    var sbtot1 = gstamt.get_value();
                    var sbtot2 = 0;
                    var sbtot3 = 7;
                    var sbtot4 = 0;
                    var check = document.getElementById("<%=chk_discount.ClientID %>");
                    if (check.checked == true) {
                        sbtot4 = (sbtot * sbtot3 / 100)
                        sbtot2 = (sbtot + sbtot4);
                        gstper.set_value(sbtot3);
                        gstamt.set_value(sbtot4);
                        nettoal.set_value(sbtot2);
                    }
                    else {
                        gstper.set_value();
                        gstamt.set_value();
                        nettoal.set_value(sbtot);
                    }
                }
                function UpdateItemCountField(sender, args) {
                    sender.get_dropDownElement().lastChild.innerHTML = "A total of " + sender.get_items().get_count() + " items";
                }


            </script>
        </telerik:RadCodeBlock>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="txt_QuotationNo">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="txt_QuotationNo" />
                        <telerik:AjaxUpdatedControl ControlID="txt_QuotationDate" />
                        <telerik:AjaxUpdatedControl ControlID="RadComboBox_Client" />
                        <telerik:AjaxUpdatedControl ControlID="RadComboBox_MainCon" />
                        <telerik:AjaxUpdatedControl ControlID="txt_ProjectName" />
                        <telerik:AjaxUpdatedControl ControlID="Quat_Amt" />
                        <telerik:AjaxUpdatedControl ControlID="Refno" />
                        <telerik:AjaxUpdatedControl ControlID="txt_Remarks" />
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                        <telerik:AjaxUpdatedControl ControlID="NetAmount" />
                        <telerik:AjaxUpdatedControl ControlID="NetFees" />
                        <telerik:AjaxUpdatedControl ControlID="NetTotal" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="RadComboBox_Client">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadComboBox_Client" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="RadComboBox_MainCon">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadComboBox_MainCon" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                        <telerik:AjaxUpdatedControl ControlID="Workdesc" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="tbsLoadingPanel" runat="server" Skin="Default" IsSticky="false">
        </telerik:RadAjaxLoadingPanel>
        <div>
            <table style="margin-top: 10px; width: 100%">
                <tr>
                    <td>
                        <telerik:RadTabStrip ID="RadTabStrip1" runat="server" MultiPageID="RadMultiPage1"
                            SelectedIndex="0" CssClass="tabStrip" Skin="Office2007">
                            <Tabs>
                                <telerik:RadTab Text="Master" Selected="True">
                                </telerik:RadTab>
                                <telerik:RadTab Text="Details">
                                </telerik:RadTab>
                            </Tabs>
                        </telerik:RadTabStrip>
                        <telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0" CssClass="multiPage">
                            <telerik:RadPageView ID="RadPageView1" runat="server">
                                <table width="100%" class="ourtertable">
                                    <tr>
                                        <td valign="top" align="center">
                                            <table style="width: 100%" class="ourtertable" cellspacing="2">
                                                <tr>
                                                    <td colspan="4">
                                                        <asp:TextBox Width="100px" ID="ClientId" AutoCompleteType="Disabled" runat="server"
                                                            Text='<%# Bind("ClientId") %>' Visible="false"></asp:TextBox>
                                                        <asp:TextBox Width="100px" ID="ProCode" runat="server" Visible="false"></asp:TextBox>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="Label4" runat="server" Text="Quation No."></asp:Label>
                                                    </td>
                                                    <td>
                                                        <asp:Label runat="server" ID="lbcaption" Visible="false"></asp:Label>
                                                        <telerik:RadComboBox runat="server" ID="txt_QuotationNo" Height="190px" Width="300px"
                                                            MarkFirstMatch="true" EnableLoadOnDemand="true" HighlightTemplatedItems="true"
                                                            OnClientItemsRequested="UpdateItemCountField" AutoPostBack="true">
                                                            <HeaderTemplate>
                                                                <ul>
                                                                    <li class="col1">Quotation No.</li>
                                                                    <li class="col2">Revise No.</li>
                                                                </ul>
                                                            </HeaderTemplate>
                                                            <ItemTemplate>
                                                                <ul>
                                                                    <li class="col1">
                                                                        <%# DataBinder.Eval(Container.DataItem, "quotationno")%></li>
                                                                    <li class="col2">
                                                                        <%# DataBinder.Eval(Container.DataItem, "revnumbr")%></li>
                                                                </ul>
                                                            </ItemTemplate>
                                                            <FooterTemplate>
                                                                A total of
                                                                <asp:Literal runat="server" ID="RadComboItemsCount" />
                                                                items
                                                            </FooterTemplate>
                                                        </telerik:RadComboBox>
                                                        <%--<asp:SqlDataSource runat="server" ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
                                                            ProviderName="System.Data.SqlClient" SelectCommand="SELECT [CompanyName] from [Customers] ORDER By [CompanyName]">
                                                        </asp:SqlDataSource>--%>
                                                    </td>
                                                    <td>
                                                        <asp:Label ID="Label5" runat="server" Text="Quation Date"></asp:Label>
                                                    </td>
                                                    <td>
                                                        <telerik:RadDatePicker ID="txt_QuotationDate" runat="server" Skin="Vista" onkeydown="return (event.keyCode!=13);">
                                                            <DateInput ID="DateInput1" DateFormat="dd/MM/yyyy" runat="server" FocusedStyle-BackColor="Lavender">
                                                            </DateInput>
                                                        </telerik:RadDatePicker>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td colspan="4" style="height: 3px;">
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:Label ID="Label18" runat="server" Text="Quation Amt."></asp:Label>
                                                    </td>
                                                    <td>
                                                        <telerik:RadNumericTextBox ID="Quat_Amt" runat="server" Width="64%" AutoCompleteType="Disabled"
                                                            MaxLength="8" ReadOnlyStyle-ForeColor="Red" onkeydown="return (event.keyCode!=13);">
                                                        </telerik:RadNumericTextBox>
                                                    </td>
                                                    <td>
                                                        <asp:Label ID="Label22" runat="server" Text="Quation Reno"></asp:Label>
                                                    </td>
                                                    <td>
                                                        <telerik:RadTextBox ID="Refno" runat="server" Width="64%" AutoCompleteType="Disabled"
                                                            FocusedStyle-BackColor="Lavender" MaxLength="15" CssClass="Capitalize1" onkeydown="return (event.keyCode!=13);">
                                                        </telerik:RadTextBox>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                            </telerik:RadPageView>
                            <telerik:RadPageView ID="RadPageView2" runat="server" CssClass="pageViewEducation">
                                <table width="100%" class="ourtertable" cellspacing="1" cellpadding="0" border="0">
                                    <tr>
                                        <td style="height: 220px">
                                            <telerik:RadGrid ID="RadGrid1" runat="server" OnItemDataBound="RadGrid1_ItemDataBound"
                                                Skin="Office2007" OnItemCreated="RadGrid1_ItemCreated">
                                                <MasterTableView AutoGenerateColumns="False" IsFilterItemExpanded="false">
                                                    <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                                                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                                                    </RowIndicatorColumn>
                                                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                                                    </ExpandCollapseColumn>
                                                    <Columns>
                                                        <telerik:GridTemplateColumn HeaderText="S.No">
                                                            <ItemTemplate>
                                                                <asp:Label ID="Sno" runat="server" Text='<%# Bind("Sno") %>' Width="35px" Style="text-align: center">
                                                                </asp:Label>
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridTemplateColumn HeaderText="Description">
                                                            <ItemTemplate>
                                                            <%--DataSourceID="SqlDataSource1" DataTextField="CompanyName" DataValueField="CompanyName"--%>
                                                                <telerik:RadComboBox ID="Workdesc" runat="server" Width="250px" ShowToggleImage="false"
                                                                    EnableAutomaticLoadOnDemand="True" ItemsPerRequest="10" ToolTip="Item ComboBox"
                                                                    ShowMoreResultsBox="true" EnableVirtualScrolling="true" Skin="Simple" AccessKey="T"
                                                                    TabIndex="1" MarkFirstMatch="true" OnSelectedIndexChanged="Workdesc_SelectedIndexChanged"
                                                                    AutoPostBack="true">
                                                                </telerik:RadComboBox>
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridTemplateColumn HeaderText="Unit" Visible="false">
                                                            <ItemTemplate>
                                                                <telerik:RadComboBox ID="Radcombo_Unit" runat="server" AutoPostBack="false" AppendDataBoundItems="true"
                                                                    FocusedStyle-BackColor="Lavender" Width="75%" Enabled="false" Visible="false">
                                                                </telerik:RadComboBox>
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridTemplateColumn HeaderText="Quantity">
                                                            <ItemTemplate>
                                                                <telerik:RadNumericTextBox ID="Quantity" runat="server" Width="50px" AutoCompleteType="Disabled"
                                                                    FocusedStyle-BackColor="Yellow" MaxLength="8" NumberFormat-GroupSizes="8" Text='<%# Bind("quantity") %>'
                                                                    onkeydown="return (event.keyCode!=13);">
                                                                    <IncrementSettings InterceptMouseWheel="false" />
                                                                </telerik:RadNumericTextBox>
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridTemplateColumn HeaderText="Price/Unit">
                                                            <ItemTemplate>
                                                                <telerik:RadNumericTextBox ID="Rate" runat="server" Width="50px" AutoCompleteType="Disabled"
                                                                    FocusedStyle-BackColor="Yellow" MaxLength="8" NumberFormat-GroupSizes="8" Text='<%# Bind("Rate") %>'
                                                                    onkeydown="return (event.keyCode!=13);">
                                                                    <IncrementSettings InterceptMouseWheel="false" />
                                                                </telerik:RadNumericTextBox>
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridTemplateColumn HeaderText="Amount">
                                                            <ItemTemplate>
                                                                <telerik:RadNumericTextBox ID="Amount" runat="server" Width="60px" ReadOnly="true"
                                                                    MaxLength="8" ForeColor="Red" Text='<%# Bind("Amount") %>' onkeydown="return (event.keyCode!=13);">
                                                                </telerik:RadNumericTextBox>
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridTemplateColumn HeaderText="Fees" Visible="false">
                                                            <ItemTemplate>
                                                                <telerik:RadNumericTextBox ID="Fees" runat="server" Width="65px" AutoCompleteType="Disabled"
                                                                    FocusedStyle-BackColor="Yellow" MaxLength="8" NumberFormat-GroupSizes="8" Text='<%# Bind("Fees") %>'
                                                                    onkeydown="return (event.keyCode!=13);" Visible="false">
                                                                    <IncrementSettings InterceptMouseWheel="false" />
                                                                </telerik:RadNumericTextBox>
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridTemplateColumn HeaderText="Total" Visible="false">
                                                            <ItemTemplate>
                                                                <telerik:RadNumericTextBox ID="Total" runat="server" Width="65px" ReadOnly="true"
                                                                    MaxLength="8" ForeColor="Red" Text='<%# Bind("Total") %>' onkeydown="return (event.keyCode!=13);"
                                                                    Visible="false">
                                                                </telerik:RadNumericTextBox>
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                    </Columns>
                                                    <EditFormSettings>
                                                        <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                                                        </EditColumn>
                                                    </EditFormSettings>
                                                </MasterTableView>
                                                <ClientSettings EnablePostBackOnRowClick="false" AllowDragToGroup="true">
                                                    <Selecting AllowRowSelect="true" />
                                                </ClientSettings>
                                                <FilterMenu EnableImageSprites="False">
                                                </FilterMenu>
                                                <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_">
                                                </HeaderContextMenu>
                                            </telerik:RadGrid>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <table class="ourtertable" cellspacing="1" cellpadding="1" width="100%" align="center"
                                                border="0">
                                                <tbody>
                                                    <tr>
                                                        <td width="70%">
                                                        </td>
                                                        <td width="13%">
                                                            <asp:Label ID="Label6" runat="server" Text="Sub Total (SGD $)"></asp:Label>
                                                        </td>
                                                        <td>
                                                            <telerik:RadNumericTextBox ID="NetAmount" runat="server" Width="65px" ReadOnly="true"
                                                                MaxLength="8" ReadOnlyStyle-ForeColor="Red" onkeydown="return (event.keyCode!=13);">
                                                            </telerik:RadNumericTextBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td width="70%">
                                                        </td>
                                                        <td width="13%">
                                                            <asp:Label ID="Label3" runat="server" Text="GST %"></asp:Label>
                                                        </td>
                                                        <td>
                                                            <div style="float: left;">
                                                                <telerik:RadNumericTextBox ID="NetFees" runat="server" Width="65px" ReadOnly="true"
                                                                    Value="7" MaxLength="8" ReadOnlyStyle-ForeColor="Red" onkeydown="return (event.keyCode!=13);">
                                                                </telerik:RadNumericTextBox>
                                                            </div>
                                                            <div style="float: left;">
                                                                <telerik:RadNumericTextBox ID="Netfeesamount" runat="server" Width="65px" ReadOnly="true"
                                                                    MaxLength="8" ReadOnlyStyle-ForeColor="Red" onkeydown="return (event.keyCode!=13);">
                                                                </telerik:RadNumericTextBox>
                                                            </div>
                                                            <div style="float: left;">
                                                                <asp:CheckBox ID="chk_discount" runat="server" Checked="true" onkeydown="return (event.keyCode!=13);" />
                                                            </div>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td width="70%">
                                                        </td>
                                                        <td width="13%">
                                                            <asp:Label ID="Label7" runat="server" Text="Total Amount"></asp:Label>
                                                        </td>
                                                        <td>
                                                            <telerik:RadNumericTextBox ID="NetTotal" runat="server" Width="65px" ReadOnly="true"
                                                                MaxLength="8" ReadOnlyStyle-ForeColor="Red" onkeydown="return (event.keyCode!=13);">
                                                            </telerik:RadNumericTextBox>
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                            </telerik:RadPageView>
                        </telerik:RadMultiPage>
                        <telerik:RadFormDecorator runat="server" ID="RadFormDecorator1" DecoratedControls="Textarea" />
                    </td>
                </tr>
            </table>
        </div>
    </asp:Content>
    -------------------------------
    Cs code behind

    using System;
    using System.Web.UI.WebControls;
    using Telerik.Web.UI;
    using System.Data;
    using System.Linq;
    using System.Collections;
    using System.Xml.Serialization;
    using System.Globalization;
    using System.Configuration;
    using System.Data.SqlClient;
    using System.Web.UI;

    namespace Sampleproject
    {
        public partial class frmsample : System.Web.UI.Page
        {
            private int columcount = 1;
            private int rowcount = 5;
            public static int recsaffect;
            public static string hello;
            public static string projcode;
            public static string usercode;
            public static string compcode;
            public static string QuationNo;
            public static string ReviseNo;
            public Boolean cn;
            public static string ReviseMode;
            public static DateTime currentdate;
            public static string Clientcode;
            public static string MaincontractorCode;
            public static string WorkDescSelect;
            SqlConnection Con;
            SqlCommand Com;
            SqlDataAdapter da1;
            string connstr;

            protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack)
                {
                    currentdate = DateTime.Now;
                    lbcaption.Text = "ADD";
                    tabledata1 = null;
                    this.RadGrid1.DataSource = tabledata1;
                    this.RadGrid1.DataBind();
                    projcode = Convert.ToString(Session["projcode"]);
                    usercode = Convert.ToString(Session["usercode"]);
                    compcode = Convert.ToString(Session["compcode"]);
                    ProCode.Text = projcode;
                    txt_QuotationDate.SelectedDate = DateTime.Now.Date;
                }
            }
            #region TABLE DATA ASSIGN & RAD GRID FUNCTION

            private DataTable tabledata1
            {
                get
                {
                    DataTable dt = (DataTable)Session["QuotationAdd"];

                    if (dt == null)
                    {
                        dt = new DataTable();
                        object[] emptyrow = new object[columcount];
                        dt.Columns.Add("Sno", typeof(string));
                        dt.Columns.Add("workdescription", typeof(string));
                        dt.Columns.Add("Radcombo_Unit", typeof(string));
                        dt.Columns.Add("Quantity", typeof(string));
                        dt.Columns.Add("Rate", typeof(string));
                        dt.Columns.Add("Amount", typeof(string));
                        dt.Columns.Add("Fees", typeof(string));
                        dt.Columns.Add("Total", typeof(string));

                        for (int i = 1; i < rowcount + 1; i++)
                        {
                            emptyrow[0] = i.ToString();
                            dt.Rows.Add(emptyrow);
                        }
                        tabledata1 = dt;
                    }
                    return dt;
                }
                set
                {
                    Session["QuotationAdd"] = value;
                }
            }

            private void assigndt2(DataTable dt)
            {
                RadComboBox r1;
                RadNumericTextBox rn1;

                for (int i = 0; i <= RadGrid1.Items.Count - 1; i++)
                {
                    if (dt.Rows.Count - 1 < i)
                    {
                        object[] emptyRow = new object[columcount];
                        dt.Rows.Add(emptyRow);
                    }

                    r1 = (RadComboBox)RadGrid1.Items[i].FindControl("Workdesc");
                    dt.Rows[i]["workdescription"] = r1.SelectedValue;
                    r1 = (RadComboBox)RadGrid1.Items[i].FindControl("Radcombo_Unit");
                    dt.Rows[i]["Radcombo_Unit"] = r1.Text;
                    rn1 = (RadNumericTextBox)RadGrid1.Items[i].FindControl("Quantity");
                    dt.Rows[i]["Quantity"] = rn1.Text;
                    rn1 = (RadNumericTextBox)RadGrid1.Items[i].FindControl("Rate");
                    dt.Rows[i]["Rate"] = rn1.Text;
                    rn1 = (RadNumericTextBox)RadGrid1.Items[i].FindControl("Amount");
                    dt.Rows[i]["Amount"] = rn1.Text;
                    rn1 = (RadNumericTextBox)RadGrid1.Items[i].FindControl("Fees");
                    dt.Rows[i]["Fees"] = rn1.Text;
                    rn1 = (RadNumericTextBox)RadGrid1.Items[i].FindControl("Total");
                    dt.Rows[i]["Total"] = rn1.Text;

                }

            }

            protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
            {
                int i = RadGrid1.Items.Count + 1;
                if (e.Item is GridDataItem)// gets the row collection  
                {
                    GridDataItem item = (GridDataItem)e.Item;
                    Label sno = (Label)item["TemplateColumn"].FindControl("Sno");
                    sno.Text = Convert.ToString(i);
                }
                if (e.Item is GridDataItem || e.Item.IsInEditMode)
                {
                    GridDataItem item = (GridDataItem)e.Item;
                    RadComboBox Workdesc = item.FindControl("Workdesc") as RadComboBox;
                    RadNumericTextBox Quantity = item.FindControl("Quantity") as RadNumericTextBox;
                    RadNumericTextBox Rate = item.FindControl("Rate") as RadNumericTextBox;
                    RadNumericTextBox Amount = item.FindControl("Amount") as RadNumericTextBox;
                    RadNumericTextBox Fees = item.FindControl("Fees") as RadNumericTextBox;
                    RadNumericTextBox Total = item.FindControl("Total") as RadNumericTextBox;

                    Quantity.Attributes.Add("onkeyup", "return AmountCalculation('" + RadGrid1.ClientID + "','" + Quantity.ClientID + "','" + Rate.ClientID + "','" + Amount.ClientID + "',''" + NetAmount.ClientID + ")");
                    Rate.Attributes.Add("onkeyup", "return AmountCalculation('" + RadGrid1.ClientID + "','" + Quantity.ClientID + "','" + Rate.ClientID + "','" + Amount.ClientID + "')");
                    //Fees.Attributes.Add("onkeyup", "return TotalCalculation('" + RadGrid1.ClientID + "','" + Amount.ClientID + "','" + Fees.ClientID + "','" + Total.ClientID + "','" + 1 + "')");
                    chk_discount.Attributes.Add("onClick", "return CheckCalulation('" + RadGrid1.ClientID + "')");
                }
            }

            protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
            {
                if (e.Item is GridDataItem || e.Item.IsInEditMode)
                {
                    GridDataItem item = (GridDataItem)e.Item;
                    RadComboBox UnitName = (RadComboBox)item.FindControl("Radcombo_Unit");
                    RadComboBox Workdesc1 = (RadComboBox)item.FindControl("Workdesc");

                    //using (var db = new DoskContractServicesDataContext(Globals.strCon))
                    //{

                    //    string orgreqfinal = ("select distinct unit from dsprojectwork " +
                    //                        "where status <> 'del'");

                    //    UnitName.DataSource = oDBClientADO.GetDataTable(orgreqfinal);
                    //    UnitName.DataValueField = "unit";
                    //    UnitName.DataTextField = "unit";

                    //    var workdesc = (from a in db.dsprojectworks
                    //                    where a.projtype == "LC" && a.status != "DEL" && a.projectcode == projcode && a.compcode == compcode
                    //                    select new { a.workdescription }).ToList();
                    //    Workdesc1.DataSource = workdesc;
                    //    Workdesc1.DataValueField = "workdescription";
                    //    Workdesc1.DataTextField = "workdescription";
                    //}
                }
            }

            protected void btnaddrow_Click(object sender, EventArgs e)
            {
                DataTable dt = (DataTable)Session["QuotationAdd"];
                int finalrow = dt.Rows.Count + 1;
                object[] emptyrow = new object[columcount];
                //Add empty Row
                emptyrow[0] = finalrow.ToString();
                dt.Rows.Add(emptyrow);

                assigndt2(dt);

                tabledata1 = dt;
                RadGrid1.DataSource = tabledata1;
                RadGrid1.Rebind();

                //for (int i = 0; i <= RadGrid1.Items.Count - 1; i++)
                //{
                //    RadComboBox Workdesc = (RadComboBox)RadGrid1.Items[i].FindControl("Workdesc");

                //    string orgreqfinal = ("select workdescription from dsprojectwork " +
                //                            "where status <> 'del' and projtype = 'LC' and compcode = '" + compcode + "' and projectcode = '" + projcode + "'");

                //    Workdesc.DataSource = oDBClientADO.GetDataTable(orgreqfinal);// UnitName.DataSource = orgreqfinal;
                //    Workdesc.DataValueField = "workdescription";
                //    Workdesc.DataTextField = "workdescription";
                //}
                //for (int i = 0; i < dt.Rows.Count; i++)
                //{
                //    RadComboBox Workdesc = (RadComboBox)RadGrid1.Items[i].FindControl("Workdesc");

                //    if (dt.Rows.Count > i)
                //    {
                //        if (dt.Rows[i]["workdescription"].ToString() != "")
                //        {
                //            Workdesc.SelectedValue = dt.Rows[i]["workdescription"].ToString();
                //            Workdesc.DataBind();
                //            RadGrid1.Rebind();
                //        }
                //        else
                //        {
                //            break;
                //        }
                //    }
                //    else
                //    {
                //        break;
                //    }
                //}
            }

            private void addrow(int currow)//int currow
            {
                object[] emptyRow = new object[columcount];
                tabledata1 = null;
                DataTable dt = tabledata1;
                assigndt2(dt);
                dt.Rows.Add(emptyRow);
                RadGrid1.DataSource = dt;
                RadGrid1.DataBind();
            }
            #endregion

            #region ASSIGN FUNCTION

            private void cleargrid()
            {
                for (int i = 0; i <= RadGrid1.MasterTableView.Items.Count - 1; i++)
                {
                    RadComboBox Workdesc = (RadComboBox)RadGrid1.MasterTableView.Items[i].FindControl("Workdesc");
                    RadComboBox Radcombo_Unit = (RadComboBox)RadGrid1.MasterTableView.Items[i].FindControl("Radcombo_Unit");
                    RadNumericTextBox Quantity = (RadNumericTextBox)RadGrid1.MasterTableView.Items[i].FindControl("Quantity");
                    RadNumericTextBox Rate = (RadNumericTextBox)RadGrid1.MasterTableView.Items[i].FindControl("Rate");
                    RadNumericTextBox Amount = (RadNumericTextBox)RadGrid1.MasterTableView.Items[i].FindControl("Amount");
                    RadNumericTextBox Fees = (RadNumericTextBox)RadGrid1.MasterTableView.Items[i].FindControl("Fees");
                    RadNumericTextBox Total = (RadNumericTextBox)RadGrid1.MasterTableView.Items[i].FindControl("Total");

                    Workdesc.Text = "";
                    Quantity.Text = "";
                    Rate.Text = "";
                    Amount.Text = "";
                    Fees.Text = "";
                    Total.Text = "";
                }
            }

            //private static DataTable GetData(string text)
            //{
            //    SqlDataAdapter adapter = new SqlDataAdapter("SELECT * from Customers WHERE CompanyName LIKE @text + '%'",
            //        ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString);
            //    adapter.SelectCommand.Parameters.AddWithValue("@text", text);

            //    DataTable data = new DataTable();
            //    adapter.Fill(data);

            //    return data;
            //}

            protected void Workdesc_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
            {
                RadComboBox combo = (RadComboBox)sender;
                string value1 = combo.SelectedValue;

                for (int i = 0; i <= RadGrid1.MasterTableView.Items.Count - 1; i++)
                {
                    RadComboBox Item = (RadComboBox)this.RadGrid1.Items[i].FindControl("ItemCode");
                    RadComboBox Description = (RadComboBox)this.RadGrid1.Items[i].FindControl("Workdesc");
                    RadNumericTextBox Rate = (RadNumericTextBox)this.RadGrid1.Items[i].FindControl("Rate");
                    RadNumericTextBox Quantity = (RadNumericTextBox)this.RadGrid1.Items[i].FindControl("Quantity");
                    RadComboBox Radcombo_Unit = (RadComboBox)this.RadGrid1.Items[i].FindControl("Radcombo_Unit");
                    if (Description.SelectedValue != "")
                    {
                        //using (var db = new DoskContractServicesDataContext(Globals.strCon))
                        //{
                        //    var itemnoassign = (from a in db.dsprojectworks
                        //                        where a.status != "DEL" && a.workdescription == Description.SelectedValue && a.projtype == "LC" && a.compcode == compcode && a.projectcode == projcode
                        //                        select new { a.itemno, a.workdescription, a.unit, a.price }).ToList();

                        //    Int32 itmassign = itemnoassign.Count();
                        //    if (itmassign > 0)
                        //    {
                        //        for (int k = 0; k <= RadGrid1.Items.Count - 1; k++)
                        //        {
                        //            RadComboBox workDesc = (RadComboBox)this.RadGrid1.Items[k].FindControl("Workdesc");

                        //            if (workDesc.SelectedValue != value1)
                        //            {
                        //                Description.SelectedValue = itemnoassign[0].workdescription.ToString();
                        //                Radcombo_Unit.SelectedValue = itemnoassign[0].unit.ToString();
                        //                Quantity.Focus();
                        //            }
                        //            else
                        //            {
                        //            }
                        //        }
                        //    }
                        //    else
                        //    {
                        //        Description.SelectedValue = "";
                        //        Rate.Text = "";
                        //        Description.Focus();
                        //    }
                        //}
                    }
                }
            }

            #endregion
        }
    }

    Thanks
    Ansari
     


  7. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 05 Feb 2013 Link to this post

    Hi Ansari,

    To clear value of the first 4 combos in Description column you can try the following:

    • In RadGrid1_ItemCreated event add data attribute to the combos. This attribute will has different value for every combo. This will allow us to find easily the combo we need based on the attribute's value.
    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
          {
              if (e.Item is GridDataItem || e.Item.IsInEditMode)
              {
                  GridDataItem item = (GridDataItem)e.Item;
                  RadComboBox UnitName = (RadComboBox)item.FindControl("Radcombo_Unit");
                  RadComboBox Workdesc1 = (RadComboBox)item.FindControl("Workdesc");
                  Workdesc1.Attributes.Add("data-row", e.Item.RowIndex.ToString());

    • Handle OnClientSelectedIndexChanged event of the Description combo:
      <telerik:GridTemplateColumn HeaderText="Description">
                                                              <ItemTemplate>
                                                                  <%--DataSourceID="SqlDataSource1" DataTextField="CompanyName" DataValueField="CompanyName"--%>
                                                                  <telerik:RadComboBox ID="Workdesc" runat="server" Width="250px" ShowToggleImage="false"
                                                                      EnableAutomaticLoadOnDemand="True" ItemsPerRequest="10" ToolTip="Item ComboBox"
                                                                      ShowMoreResultsBox="true" EnableVirtualScrolling="true" Skin="Simple" AccessKey="T"
                                                                      TabIndex="1" MarkFirstMatch="true" OnSelectedIndexChanged="Workdesc_SelectedIndexChanged"
                                                                      OnClientSelectedIndexChanged="Workdesc_OnClientSelectedIndexChanged"
                                                                      OnClientSelectedIndexChanging="Workdesc_OnClientSelectedIndexChanging"
                                                                      AutoPostBack="true">
                                                                  </telerik:RadComboBox>
                                                              </ItemTemplate>
    and clear the selection of the other 4 combos:
    function Workdesc_OnClientSelectedIndexChanged(sender, args) {
        //Check if the selected combo is the fifth
        if (sender.get_element().getAttribute("data-row") == 10) {
            //Get first four combos
            var comboRow1 = $find(document.querySelector('[data-row="2"]').id);                               
            var comboRow2 = $find(document.querySelector('[data-row="4"]').id);                               
            var comboRow3 = $find(document.querySelector('[data-row="6"]').id);                               
            var comboRow4 = $find(document.querySelector('[data-row="8"]').id);   
             
            //Clear selection
            comboRow1.clearSelection();
            comboRow2.clearSelection();
            comboRow3.clearSelection();
            comboRow4.clearSelection();
        }
    }

    For your other issue you may handle Workdesc_OnClientSelectedIndexChanging and check the value of the selected item with other items.
    function Workdesc_OnClientSelectedIndexChanging(sender, args) {
        var comboRow1 = $find(document.querySelector('[data-row="2"]').id);                               
        var comboRow2 = $find(document.querySelector('[data-row="4"]').id);                               
        var comboRow3 = $find(document.querySelector('[data-row="6"]').id);                               
        var comboRow4 = $find(document.querySelector('[data-row="8"]').id);
     
        if (args.get_item().get_text() == comboRow1.get_text() ||
            args.get_item().get_text() == comboRow2.get_text() ||
            args.get_item().get_text() == comboRow3.get_text() ||
            args.get_item().get_text() == comboRow4.get_text()) {
                 
            alert('Duplicate');
        }
    }

    I'm attaching a runnable sample based on the code you provided me with. Note that the dll files are removed due to file upload limit.

    All the best,

    Hristo Valyavicharski
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  8. Tamim
    Tamim avatar
    64 posts
    Member since:
    May 2011

    Posted 08 Feb 2013 Link to this post

    Thanks for ur answer Hristo Valyavicharski .

    Second problem over.
    First one four row combo value do not clear. Row create when last row description selected next one row added in grid. Pls help us...

    Regards&Thanks
    Ansari

  9. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 13 Feb 2013 Link to this post

    Hello Ansari,

    In the provided sample, the RadComboBoxes in the first four rows are cleared when you select item from the combo in the fifth row. You can see how does it work on this video. If I understand you correctly you want to clear items in the same way as this screenshot. Please confirm that.

    Regards,
    Hristo Valyavicharski
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  10. Tamim
    Tamim avatar
    64 posts
    Member since:
    May 2011

    Posted 17 Feb 2013 Link to this post

    Thanks for ur reply Hristo Valyavicharski

     In Radgrid set 5 rows in default. when 5th row select value previous four rows values cleared how to store these 4 rows value. 
    more than 5 rows added.
    5th row select value i have called addrow() function this time only first four rows value do not clear.

    Thanks & Regards,
    Ansari
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017