Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
225 views
I'm using client-side binding to a WebMethod, and I need to intercept the AJAX response object. I can get the row objects that are children of the response in the OnRowDataBound through args.get_dataItem(); how to do I get the return object from the WebMethod (either before or after the grid is bound at client-side)?
Antonio Stoilkov
Telerik team
 answered on 02 Apr 2012
1 answer
754 views
Hello,

I am having trouble adding "OnChecked" events to my GridTemplateColumns I am creating programmatically.

Here is the code I am using to create my columns (and the new column "RoleColumn"):
               public void DefineGridStructure()
            {
                var templateColumn = new GridTemplateColumn();
                templateColumn.UniqueName = "myColumn" + i;
                templateColumn.ItemTemplate = new RoleColumn("myColumn" + i);
  
                 // add the dynamically created columns to the grid
                dgLoginRequest.MasterTableView.Columns.AddAt(COLUMN_START_POS - 1, templateColumn);
            }
  
  
    public class RoleColumn : ITemplate
    {
  
        protected CheckBox roleCheckbox;
        private string _columnName;
  
        public RoleColumn(string columnName)
        {
            _columnName = columnName;
        }
  
        public void InstantiateIn(Control container)
        {
            roleCheckbox = new CheckBox { ID = "cbx" + _columnName };
            roleCheckbox.AutoPostBack = true;
            roleCheckbox.DataBinding += new EventHandler(roleCheckbox_DataBinding);
            container.Controls.Add(roleCheckbox);
        }
  
        private void roleCheckbox_DataBinding(object sender, EventArgs e)
        {
            var cBox = (CheckBox)sender;
            var container = (GridDataItem)cBox.NamingContainer;
            cBox.Checked = ((EntityUserRole)container.DataItem).Roles[0][_columnName];
        }
  
    }


Now when I call the DefineGridStructure routine I then bind a data source to my grid (the datasource is an ArrayList type which holds "Role" objects):

           public void BindDataGrid()
        {
            try
            {
                DefineGridStructure();
                dgLoginRequest.DataSource = DataSource;
                dgLoginRequest.DataBind();
            }
            catch (Exception ex)
            {
                throw;
            }
        }

    public

 

 

interface IRole

 

    {

 

 

        Int16 RoleID { get; set; }

 

 

 

        string RoleName { get; set; }

 

 

 

        Int16 OrderID { get; set; }

 

    }



I then capture the OnItemDataBoundEvent and add my event handler at this point;
            protected void dgLoginRequest_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            { 

                    var i = 0;
                foreach (Role role in Roles)
                {
                    var checkbox = (e.Item as GridDataItem)["myColumn" + i].Controls[0] as CheckBox;
                    checkbox.CheckedChanged += new EventHandler(cbxReader_CheckedChanged); 
                            i++;
                }
                  
            }
        }

However, when I click my checkboxes they do not fire the event (cbx_CheckedChanged).

What am I missing?

All I want to do is create a checkbox column for each role that I have in my Arraylist (currently 4).  And I want to be able to handle the "OnCheckedChanged" event in code whenever any of these checkboxes are checked.

Please help.  I have went through the documenation already - that's how i got this far.  A sample application would be appreciated.

Thanks,
Antonio Stoilkov
Telerik team
 answered on 02 Apr 2012
4 answers
271 views
Trying to use the Radgrid to do server-side data filtering.  

I'm binding a dataset to a RadGrid, and setting the AutoPostBackOnFilter='true' for each column.  Clicking on the filter button throws this unhandled exception.


Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
   Telerik.Web.UI.RadGrid.RaisePostBackEvent(String eventArgument) +11025
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +176
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
Milena
Telerik team
 answered on 02 Apr 2012
4 answers
108 views

If I use DataBinding to create my menuitems, and use the OnClientItemClicked event to call a javascript which calls a radwindow (popup), the called radwindow does not popup, rather it loads into the target pane.
(well it pops up briefly, then exits and reloads in the Target Pane)

However, when I Create the MenuItems in HTML, the call to the OnClientItemClicked javascript , does popup the radwindow correctly.

My workaround for this was "AppendDataBoundItems" and retain a menu item from HTML, such that my popup radwindow pops up correctly...Happiness,..BUT

It is AppendDataBoundItems,...and I really want PrePend,..i.e. I would like my MenuItem with Popup to appear at the end of the Menu, not the beginning.

Any help,..ideas ? (for either).

Code is: 

RadMenu AdminAuthMenu = this.NavPane.FindControl("RadMenu1") as RadMenu;
AdminAuthMenu.DataSource = SiteMap.GetdbMenuItems();   //Just class with db sql to get MenuItems
AdminAuthMenu.DataBind();

protected void RadMenu1_OnItemDataBound(object sender, RadMenuEventArgs e)
{

    RadMenuItem ei = e.Item as RadMenuItem;

    ei.Target = "ContentPane";
}

Markup is:

 

telerik:RadMenu ID="RadMenu1"  runat="server" Width="100%" Height="31px" Skin="Black"

 OnClientItemClicked="MenuItemItemClicked"

 DataFieldID="ScreenId"

 DataNavigateUrlField="Screen"

 DataTextField="Title"

 DataValueField="ScreenId"

 OnItemDataBound="RadMenu1_OnItemDataBound"

 AppendDataBoundItems="True">

 <DefaultGroupSettings Flow="Horizontal" />

 <Items >
      <telerik:RadMenuItem runat="server" Text="Login" value="Login"

                  BackColor="Transparent" ForeColor="#FFFFC0"></telerik:RadMenuItem>

</Items>

 

Neal
Top achievements
Rank 1
 answered on 02 Apr 2012
4 answers
176 views
Hi,
I have update newer version of telerik to 2012.1.215.40. After update the new version i am getting error on my almost all page
before updating the version it was working fine but i don't know what happened after update the newer version. Please help

Following javascript error getting on button click(javascirpt error on Mozilla firefox)

Error: Sys.WebForms.PageRequestManagerServerErrorException: Text property cannot be set. String was not recognized as a valid DateTime.
Source File: http://localhost:1932/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl00_RSMAccountsTrak_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d4.0.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3a89093640-ae6b-44c3-b8ea-010c934f8924%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%2c+Version%3d2012.1.215.40%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3aen-US%3ab29b07e8-2c1e-44e5-9e1b-59bb6459fb01%3a16e4e7cd%3a874f8ea2%3af7645509%3a24ee1bba%3a19620875%3af46195d3%3a490a9d4e%3abd8f85e4%3a2003d0b8%3a1e771326%3aaa288e2d%3aed16cbdc%3ae330518b%3a8e6f0d33%3a7c926187%3a8674cba1%3ab7778d6c%3ac08e9f8a%3a59462f1%3aa51ee93e%3ae085fe68
Line: 15Webpage error details


Please help it break my all applications.

Thanks
Manish
Vasil
Telerik team
 answered on 02 Apr 2012
6 answers
325 views
I have a maskedTextbox with 2 events, onblur client side and OnTextChanged in server side.
My on blur method are returning true or false, if my return is true, i wanna enter in server side and do OnTextChanged, if return is false doesnt enter on server side and show a alert. 
My problem is, my return can be true or false, doesnt make anything different, always enter in server side.

function verificarCPF() {
    var contador;
    var valorCPF = $telerik.findMaskedTextBox("txtBuscaCpf").get_value();
    var numeroCPF = valorCPF.substr(0, 9);
    var digitoCPF = valorCPF.substr(9, 2);
    var d1 = 0;
 
    for (contador = 0; contador < 9; contador++) {
        d1 += numeroCPF.charAt(contador) * (10 - contador);
    }
    if (d1 == 0) {
        radalert("CPF Inválido!",350,140,"Mensagem",null,null);
        return false;
    }
    d1 = 11 - (d1 % 11);
    if (d1 > 9) d1 = 0;
    if (digitoCPF.charAt(0) != d1) {
        radalert("CPF Inválido!", 350, 140, "Mensagem", null, null);
        return false;
    }
 
    d1 *= 2;
    for (contador = 0; contador < 9; contador++) {
        d1 += numeroCPF.charAt(contador) * (11 - contador);
    }
    d1 = 11 - (d1 % 11);
    if (d1 > 9) d1 = 0;
    if (digitoCPF.charAt(1) != d1) {
        radalert("CPF Inválido!", 350, 140, "Mensagem", null, null);
        return false;
    }
    return true;
    //radalert("CPF Válido!", 350, 140, "Mensagem", null, null);
}

<telerik:RadMaskedTextBox ID="txtBuscaCpf" ClientEvents-OnBlur="verificarCPF" AutoPostBack="true" runat="server" Mask="###.###.###-##"
    Width="100" OnTextChanged="txtBuscaCpf_TextChanged" />

Thankz in advance!
Vasil
Telerik team
 answered on 02 Apr 2012
0 answers
186 views
Hi..

Gridview enterkey is not working ..plz resolve this.

Design Code:

<head runat="server">
    <script type="text/javascript">

        function controlEnter(obj, event) {

            var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;

            if (keyCode == 13) {

                document.getElementById(obj).focus();

                return false;
            }

            else {
                return true;
            }
        }



    </script>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h3>
            Gridview with Enter Key sample</h3>
    </div>
    <div>
        <asp:GridView ID="Grid_EnterKey" runat="server" AutoGenerateColumns="false"
           OnRowDataBound="Grid_EnterKey_RowDataBound"
           >
            <Columns>
                <asp:TemplateField HeaderText="ID">
                    <ItemTemplate>
                        <asp:Label ID="lbl_emp_id" runat="server" Visible="true" Text='<%# Bind("ID") %>'></asp:Label>
                        <%--<asp:TextBox ID="txt0" ReadOnly="false" runat="server" Text='<%# Bind("ID") %>'></asp:TextBox>--%>
                    </ItemTemplate>
                    <%--<EditItemTemplate>
                        <asp:TextBox ID="txt00" ReadOnly="false" runat="server" Text='<%# Bind("ID") %>'></asp:TextBox>
                    </EditItemTemplate>--%>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="FIRST NAME">
                    <ItemTemplate>
                        <%--<asp:Label ID="lbl_emp_fname" Visible="false" runat="server" Text='<%# Bind("FIRST_NAME") %>'></asp:Label>--%>
                        <asp:TextBox ID="txt1" ReadOnly="false" runat="server" Text='<%# Bind("FIRST_NAME") %>'></asp:TextBox>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="txt01" ReadOnly="false" BorderStyle="Dotted" runat="server" Text='<%# Bind("FIRST_NAME") %>'></asp:TextBox>
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="MAIL ID">
                    <ItemTemplate>
                        <asp:Label ID="lbl_mail" runat="server" Visible="true" Text='<%# Bind("MAIL_ID") %>'></asp:Label>
                        <%--<asp:TextBox ID="txt2" ReadOnly="false" runat="server" Text='<%# Bind("MAIL_ID") %>'></asp:TextBox>--%>
                    </ItemTemplate>
                    <%-- <EditItemTemplate>
                        <asp:TextBox ID="txt02" ReadOnly="false" runat="server" Text='<%# Bind("MAIL_ID") %>'></asp:TextBox>
                    </EditItemTemplate>--%>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="MOBILE NO">
                    <ItemTemplate>
                        <%--<asp:Label ID="lbl_emp_mobileno" runat="server" Visible="true" Text='<%# Bind("EMP_MOBILE") %>'></asp:Label>--%>
                        <asp:TextBox ID="txt3" ReadOnly="false" runat="server" Text='<%# Bind("EMP_MOBILE") %>'></asp:TextBox>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="txt03" ReadOnly="false" runat="server" Text='<%# Bind("EMP_MOBILE") %>'></asp:TextBox>
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="SALARY">
                    <ItemTemplate>
                        <asp:TextBox ID="txt4" runat="server" Text='<%# Bind("EMP_SALARY") %>'></asp:TextBox>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="txt04" runat="server" Text='<%# Bind("EMP_SALARY") %>'></asp:TextBox>
                    </EditItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <br />
        &nbsp;
    </div>
    </form>
</body>

**************************************************************************************************************************

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

public partial class WebForms_Enter_key_GV_Sample3_Sample3_GV_enterkey : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        GridBind();


        for (int i = 0; i < Grid_EnterKey.Rows.Count; i++)
        {
            string firstTextbox = "txt1";
            string NextTxtBx = "txt1";

            string FourthColumnTextbx = "txt3";
            string FifthColummnTextbx = "txt4";

            TextBox Txtbx1 = (TextBox)Grid_EnterKey.Rows[i].FindControl(firstTextbox);
            TextBox Txtbx2 = new TextBox();
            TextBox Txtbx3 = (TextBox)Grid_EnterKey.Rows[i].FindControl(FourthColumnTextbx);
            TextBox Txtbx4 = (TextBox)Grid_EnterKey.Rows[i].FindControl(FifthColummnTextbx);

            if (Grid_EnterKey.Rows.Count - 1 != i)
            {
                Txtbx2 = (TextBox)Grid_EnterKey.Rows[i + 1].FindControl(NextTxtBx);
            }
            else
            {
                Txtbx2 = (TextBox)Grid_EnterKey.Rows[0].FindControl(NextTxtBx);
            }

            if (Txtbx1 != null && Txtbx2 != null && Txtbx3 != null && Txtbx4 != null)
            {

                Txtbx1.Attributes.Add("onkeypress", "return controlEnter('" + Txtbx3.ClientID + "', event)");
                Txtbx3.Attributes.Add("onkeypress", "return controlEnter('" + Txtbx4.ClientID + "',event)");
                Txtbx4.Attributes.Add("onkeypress", "return controlEnter('" + Txtbx2.ClientID + "',event)");
            }
        }

        TextBox Txtbxfirst = (TextBox)Grid_EnterKey.Rows[0].FindControl("txt1");
        Txtbxfirst.Focus();
    }

    protected void Grid_EnterKey_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        DataRowView drv = e.Row.DataItem as DataRowView;

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            int iEmpID = Convert.ToInt32(drv["ID"]);
            int currentrow = Convert.ToInt16(e.Row.RowIndex);

            for (int i = 1; i <= Grid_EnterKey.Rows.Count; i++)
            {
                Grid_EnterKey.Attributes.Add("onkeypress", "return controlEnter('" + e.Row.ClientID + "', event)");

            }
        }
    }

    protected DataSet GridBind()
    {

        string strSQLconn = @"Data Source=PRO1; Initial Catalog=AllTestExample_queries; UId=sa;password=mcl@123; Integrated Security=true;";
        SqlConnection SQLconn = new SqlConnection(strSQLconn);
        SQLconn.Open();

        SqlCommand cmd = new SqlCommand();
        string strQuery = @"SELECT [EMP_id] AS ID,[EMP_fname] AS FIRST_NAME,[EMP_email] AS MAIL_ID,[EMP_mobileno] AS EMP_MOBILE,[EMP_Salaery] AS EMP_SALARY FROM [DataKeys_exm]";
        cmd.Connection = SQLconn;
        cmd.CommandText = Convert.ToString(strQuery);
        cmd.CommandType = CommandType.Text;
        cmd.ExecuteNonQuery();

        SqlDataAdapter da = new SqlDataAdapter(cmd);
        DataSet ds = new DataSet();
        da.Fill(ds);

        Grid_EnterKey.DataSource = ds.Tables[0];
        Grid_EnterKey.DataBind();

        return ds;
    }

**************************************************************************************************************************

Thanks ,
PRABAKARAN G
PRABAKAR
Top achievements
Rank 1
 asked on 02 Apr 2012
1 answer
85 views

Hi

Iam placed one table inside the EditFormSetting .i want to calculate the days in between twodates of datepickers .
how can i get the value of datepickerconcrol when i selected the date for writing the javascript function .
please help me .Thank u in advance.

 <EditFormSettings EditFormType="Template">
</FormTemplate>
---datepicker1---
---datepicker2---
---ddl----price*days
--txtbox---result bind to this textbox

</formTemplate>
</EditFormSettings>    



<
table cellpadding="1" cellspacing="1" width="98%" align="center">
     <tr>
        <!--#include file="../Menus/MenuPage.aspx"--> 
        </tr>
        <tr>
        <td align="center">
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate >
            <table align="center">
            <tr>
            <td style="text-align: center">
                    <asp:LinkButton ID="LinkButton1" runat="server" Font-Bold="true" 
                        Font-Names="verdana" Font-Size="12pt" ForeColor="SteelBlue"> Bill Details </asp:LinkButton>
                </td>
            </tr>
            <tr>
            <td> </td>
            </tr>
            <tr>
            <td align="center">
            <table align="center" cellpadding="1" cellspacing="1" style="margin:2px">
            <tr>
            <td align="left"  style="width:100px">
                <asp:Label ID="Label1" runat="server" Text="RefNo" Font-Names="Verdana" 
                    Font-Size="8.5pt" ForeColor="Maroon"></asp:Label></td>
            <td align="left" style="width:150px">
                <asp:TextBox ID="txtRefno" runat="server" BorderColor="#999999" 
                    BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="8.5pt" 
                    ForeColor="Black"></asp:TextBox>
                <telerik:RadComboBox ID="ddlRefno" runat="server" AllowCustomText="True" AutoPostBack="True" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" DropDownCssClass="RadComboBox_Sunset" EmptyMessage="Select a RefNo" EnableEmbeddedSkins="False" EnableLoadOnDemand="True" EnableViewState="false" EnableVirtualScrolling="True" Font-Names="verdana" Font-Size="8.5pt" MarkFirstMatch="True" ShowMoreResultsBox="True" Skin="Sunset" style="color:Black;background-color:White;font-family:Verdana;font-size:8pt;" TabIndex="1">
                </telerik:RadComboBox>
            </td>
            <td align="left" style="width:100px" >
                 <asp:Label ID="Label2" runat="server" Text="Date" Font-Names="Verdana" 
                     Font-Size="8.5pt" ForeColor="Maroon"></asp:Label></td>
            <td align="left" style="width:150px"><asp:TextBox ID="txtDate" runat="server" BorderColor="#999999" 
                    BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="8.5pt"></asp:TextBox></td>
            </tr>
            <tr>
            <td align="left"  style="width:100px">
                <asp:Label ID="Label3" runat="server" Text="Patient Id" Font-Names="Verdana" 
                    Font-Size="8.5pt" ForeColor="Maroon"></asp:Label></td>
            <td align="left" style="width:150px">
                <telerik:RadComboBox ID="ddlPatientno" runat="server"
                 AutoPostBack="True" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" 
                                    DropDownCssClass="RadComboBox_Sunset" EmptyMessage="Select a Patient No/Name" 
                                    EnableEmbeddedSkins="False" EnableLoadOnDemand="True" EnableViewState="false" 
                                    EnableVirtualScrolling="True" Font-Names="verdana" Font-Size="8.5pt" 
                                    MarkFirstMatch="True" ShowMoreResultsBox="True" Skin="Sunset" 
                                    style="color:Black;background-color:White;font-family:Verdana;font-size:8pt;" 
                                    TabIndex="2" Width="230">
                </telerik:RadComboBox>
              </td>
            <td align="left" style="width:100px" >
             <asp:Label ID="Label4" runat="server" Text="Patient Name" Font-Names="Verdana" 
                    Font-Size="8.5pt" ForeColor="Maroon"></asp:Label>
                 </td>
            <td align="left" style="width:200px">
             <asp:TextBox ID="txtPatientname" runat="server" BorderColor="#999999" 
                    BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Width="200" Font-Size="8.5pt"></asp:TextBox>
           </td>
            </tr>
            <tr>
            <td align="left"  style="width:100px">
                <asp:Label ID="Label5" runat="server" Text="Ward" Font-Names="Verdana" 
                    Font-Size="8.5pt" ForeColor="Maroon"></asp:Label></td>
            <td align="left" style="width:150px">
                <asp:TextBox ID="txtWard" runat="server" BorderColor="#999999" 
                    BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="8.5pt"></asp:TextBox>
              </td>
            <td align="left" style="width:100px" >
             <asp:Label ID="Label6" runat="server" Text="Room No" Font-Names="Verdana" 
                    Font-Size="8.5pt" ForeColor="Maroon"></asp:Label>
                 </td>
            <td align="left" style="width:150px">
             <asp:TextBox ID="txtRoomno" runat="server" BorderColor="#999999" 
                    BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="8.5pt"></asp:TextBox>
           </td>
            </tr>
            <tr>
            <td align="left"  style="width:100px">
                <asp:Label ID="Label7" runat="server" Text="Bed No" Font-Names="Verdana" 
                    Font-Size="8.5pt" ForeColor="Maroon"></asp:Label></td>
            <td align="left" style="width:150px">
                <asp:TextBox ID="txtBedno" runat="server" BorderColor="#999999" 
                    BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="8.5pt"></asp:TextBox>
              </td>
            <td align="left" style="width:100px" >
                 </td>
            <td align="left" style="width:150px">
                 </td>
            </tr>
            <tr>
            <td align="left" colspan="4">
              <asp:Panel ID="Panel1" runat="server" Font-Names="Verdana" Font-Size="8.5pt"  ForeColor="Maroon" HorizontalAlign="Left">
                                <fieldset >
                                <legend ><b style="color:Maroon">Equipment Bill</b></legend>
                                  
                                <table width="98%" cellpadding="0" cellspacing="0">
                                <tr>
                                <td align="left" style="font-size: 8.5pt; font-family: Verdana;color:Maroon">
                                  
                                </td>
                                </tr>
                                    <tr>
                                        <td align="left" style="font-size: 8.5pt; font-family: Verdana;color:Maroon">
                                             </td>
                                    </tr>
                                <tr>
<td align="center" >
      
    <telerik:RadGrid ID="grvEquipDetails" runat="server" AllowSorting="True" AutoGenerateColumns="False"  CellSpacing="0" GridLines="None" Skin="Outlook"  ShowStatusBar="True" Width="700px" TabIndex="3" >
                                     <ClientSettings EnableRowHoverStyle="true">
                                        </ClientSettings>
                                        <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Outlook">
                                        </HeaderContextMenu>
                                        <MasterTableView  CommandItemDisplay="Top" DataKeyNames="doctorid">
                                          
                                     
                                          
                                          
                                            <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
  
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
  
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
                                            <Columns>
                                                <telerik:GridTemplateColumn FilterControlAltText="Filter column column" 
                                                    HeaderText="S.NO" UniqueName="column">
                                                    <EditItemTemplate>
                                                       <%# Container.DataSetIndex+1  %>
                                                    </EditItemTemplate>
                                                    <ItemTemplate>
                                                         <%# Container.DataSetIndex+1  %>
                                                 </ItemTemplate>
                                                </telerik:GridTemplateColumn>
                                                <telerik:GridBoundColumn DataField="Fdate" 
                                                    FilterControlAltText="Filter Fdate column" HeaderText="FROM DATE" UniqueName="fdate">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="Tdate" 
                                                    FilterControlAltText="Filter Tdate column" HeaderText="TO DATE" 
                                                    UniqueName="tdate">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="Ecode" 
                                                    FilterControlAltText="Filter Ecode column" HeaderText="EQUIPMENT NAME" 
                                                    UniqueName="Ecode">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="Days" 
                                                    FilterControlAltText="Filter Days column" HeaderText="DAYS" 
                                                    UniqueName="Days">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridBoundColumn DataField="Amount" 
                                                    FilterControlAltText="Filter Amount column" HeaderText="AMOUNT" 
                                                    UniqueName="Amount">
                                                </telerik:GridBoundColumn>
                                                <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" ButtonType="ImageButton">
                                                <ItemStyle Width="50px" />
                                            </telerik:GridEditCommandColumn>
                                            <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete"  ConfirmText="Delete this Doctor Name ?" Text="Delete"  UniqueName="DeleteColumn1">
                                                <HeaderStyle Width="20px" />
                                                <ItemStyle CssClass="MyImageButton" HorizontalAlign="Center" />
                                            </telerik:GridButtonColumn>
                                            </Columns>
                                              
                                       <EditFormSettings EditFormType="Template">
<EditColumn UniqueName="EditCommandColumn1" FilterControlAltText="Filter EditCommandColumn1 column"></EditColumn>
<FormTemplate>
 <table id="tblDesi" cellspacing="2" cellpadding="1" width="100%" border="1" rules="none" style="border-collapse: collapse; background: white;">
                        <tr class="EditFormHeader">
                            <td colspan="2" style="font-size: small; font-family: Verdana;color:Maroon" >
                                <b>Equipment Bill:</b>
                            </td>
                        </tr>
                        <tr>
                            <td align="center">
                                 <table id="Table3" cellspacing="1" cellpadding="1" width="250" border="0">
                    <tr>
                        <td> </td>
                        <td> </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <asp:Label ID="label7" Text="From Date:" runat="server" Font-Names="verdana" Font-Size="8.5pt" ForeColor="Maroon" Width="110"></asp:Label>
                        </td>
                        <td align="left">
                        <telerik:RadDatePicker ID="txtFromdate" runat="server"  Culture="English (United States)" onkeypress="return CharOnly()"  onkeydown="return noNumbers(event)" MinDate="1900-01-01" Font-Size="8.5pt" Font-Names="verdana" Width="100">
                        <Calendar ID="Calendar2" runat="server" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" ViewSelectorText="x"></Calendar><DatePopupButton ImageUrl="" HoverImageUrl="" ToolTip="Calendar"></DatePopupButton>
                        <DateInput ID="DateInput2" runat="server" DisplayDateFormat="dd/MM/yyyy" DateFormat="dd/MM/yyyy" ></DateInput>
                    
                                    </telerik:RadDatePicker><span style="font-size: 8pt; color: maroon">*</span>
                        </td>
                       <%-- <td>
                              <asp:DropDownList ID="ddlDoc" AppendDataBoundItems="true" runat="server" Width="222px" TabIndex="1" Font-Names="verdana" Font-Size="8.5pt" DataTextField='<%# Bind("doctorid") %>' DataValueField='<%# Bind("doctorid") %>'></asp:DropDownList><span style="font-size: 8pt; color: maroon">*</span>
                        </td>--%>
                         
                    </tr>
                    <tr>
                    <td align="left">
                      <asp:Label ID="label9" Text="To Date:" runat="server" Font-Names="verdana" Font-Size="8.5pt" ForeColor="Maroon" Width="110"></asp:Label>
                    </td>
                    <td align="left">
                     <telerik:RadDatePicker ID="txtToDate" runat="server"  Culture="English (United States)" onkeypress="return CharOnly()"  onkeydown="return noNumbers(event)" 
                    Font-Size="8.5pt" Font-Names="verdana" Width="100">
                     <Calendar ID="Calendar1" runat="server" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" ViewSelectorText="x"></Calendar>
                     <DatePopupButton ImageUrl="" HoverImageUrl="" ToolTip="Calendar"></DatePopupButton>
                        <DateInput ID="DateInput1" runat="server" DisplayDateFormat="dd/MM/yyyy"  DateFormat="dd/MM/yyyy" ></DateInput>
         
                          
                         </telerik:RadDatePicker><span style="font-size: 8pt; color: maroon">*</span>
                     
                    </td>
                    </tr>
                    <tr>
                    <td align="left">
                     <asp:Label ID="label10" Text="Equipment Name:" runat="server" Font-Names="verdana" Font-Size="8.5pt" ForeColor="Maroon" Width="110"></asp:Label>
                    </td>
                    <td align="left">
                    <telerik:RadComboBox ID="ddlEuipment" runat="server"
                   AutoPostBack="True" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" 
                                    DropDownCssClass="RadComboBox_Sunset" EmptyMessage="Select a EquipmentName" 
                                    EnableEmbeddedSkins="False" EnableLoadOnDemand="True" EnableViewState="false" 
                                    EnableVirtualScrolling="True" Font-Names="verdana" Font-Size="8.5pt" 
                                    MarkFirstMatch="True" ShowMoreResultsBox="True" Skin="Sunset" 
                                    style="color:Black;background-color:White;font-family:Verdana;font-size:8pt;" 
                                    TabIndex="2" Width="230">
                </telerik:RadComboBox></td>
                    </tr>
                    <tr>
                    <td align="left">
                     <asp:Label ID="label11" Text="Days:" runat="server" Font-Names="verdana" Font-Size="8.5pt" ForeColor="Maroon" Width="110"></asp:Label>
                    </td>
                    <td align="left">
                     <asp:TextBox ID="txtDays" runat="server" Font-Names="verdana" Font-Size="8.5pt" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px"></asp:TextBox>
                    </td>
                    </tr>
                    <tr>
                    <td align="left">
                      <asp:Label ID="label12" Text="Amount:" runat="server" Font-Names="verdana" Font-Size="8.5pt" ForeColor="Maroon" Width="110"></asp:Label>
                    </td>
                    <td align="left">
                    <asp:TextBox ID="txtAmount" runat="server" Font-Names="verdana" Font-Size="8.5pt" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px"></asp:TextBox></td>
                    </tr>
                </table>
                 </td>
                </tr>
                        <%--<tr>
                            <td align="right" colspan="2">
                                <asp:Button ID="btnUpdate1" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>' Style="color: White; background-color: SteelBlue; font-family: Verdana; font-size: 8pt; width: 87px;" runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>' OnClientClick="return ValidName()" CausesValidation="true" AccessKey="I" ToolTip="Alt+i" TabIndex="7">
                                </asp:Button> 
                                  <asp:Button ID="btnCancel1" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel" Style="color: White; background-color: SteelBlue; font-family: Verdana; font-size: 8pt; width: 87px;" AccessKey="C" ToolTip="Alt+c" TabIndex="8"></asp:Button>
                            </td>
                        </tr>--%>
                        <tr>
                         <td colspan="2" align="center" style="padding-left:65px" >
                            <asp:ImageButton ID="btnUpdate1" AccessKey="S" ToolTip="Save" runat="server"  Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update" ) %>' ImageUrl="~/Images/save.jpg"  CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>' OnClientClick="OnClientClick(); return false;" />    
                            <asp:ImageButton ID="btnCancel1" runat="server" CausesValidation="false" CommandName="Cancel" ImageUrl="~/Images/cancelbtn.jpg" ToolTip="Cancel"/>
                         </td>
                         </tr>
                    </table>
  
</FormTemplate>
  
</EditFormSettings>     
                                              
                                             
                                        </MasterTableView>
                                        <FilterMenu EnableImageSprites="False">
                                        </FilterMenu>
                                    </telerik:RadGrid>
</td>
                                </tr>
                                <tr>
                                <td> </td>
                                </tr>
                                </table>
                                </fieldset></asp:Panel>
            </td>
            </tr>
            </table>
            </td>
            </tr>
            <tr>
            <td align="center">
              <asp:Button ID="btnAdd" runat="server" Text="Add" AccessKey="A" ToolTip="Alt+a" 
               style="color:White;background-color:SteelBlue;font-family:Verdana;font-size:8.5pt;"  Width="80px" /> 
              <asp:Button ID="btnEdit" runat="server" Text="Edit"  AccessKey="E" ToolTip="Alt+e" 
               style="color:White;background-color:SteelBlue;font-family:Verdana;font-size:8.5pt;"  Width="80px"  /> 
              <asp:Button ID="btnSave" runat="server" Text="Save"  AccessKey="S" ToolTip="Alt+s" 
               style="color:White;background-color:SteelBlue;font-family:Verdana;font-size:8.5pt;"  Width="80px"  /> 
              <asp:Button ID="btnDel" runat="server" Text="Delete"  AccessKey="D" ToolTip="Alt+d" 
               style="color:White;background-color:SteelBlue;font-family:Verdana;font-size:8.5pt;"  Width="80px"  /> 
              <asp:Button ID="btnClear" runat="server" Text="Clear"  AccessKey="C" ToolTip="Alt+c" 
               style="color:White;background-color:SteelBlue;font-family:Verdana;font-size:8.5pt;"  Width="80px"  /> 
              <asp:Button ID="btnPrint" runat="server" Text="Print"  AccessKey="P" ToolTip="Alt+p" 
               style="color:White;background-color:SteelBlue;font-family:Verdana;font-size:8.5pt;"  Width="80px"  />
            </td>
            </tr>
              <tr>
                            <td align="center">
                                <asp:Label ID="lblResult" runat="server" Font-Bold="True" Font-Names="Verdana" Font-Size="8.5pt"
                                    ForeColor="Maroon" Width="448px"></asp:Label>
                                <asp:TextBox ID="txtSpeNo" runat="server" BorderStyle="None" ForeColor="White" Height="10px"
                                    Width="100px"></asp:TextBox>
                                    <asp:TextBox ID="txtGrid" runat="server" BorderStyle="None" ForeColor="White" Height="10px"
                                    Width="100px"></asp:TextBox>
                                    </td>
                        </tr>
               
            </table>
            </ContentTemplate>
            </asp:UpdatePanel>
          
        </td>
        </tr>
  
  
   </table>
Princy
Top achievements
Rank 2
 answered on 02 Apr 2012
2 answers
182 views
I have radgrid which I am binding with a Webservice on the client side.

This is what I want to do:
I want to create a GridTemplateColumn or a GridButtonColumn, when clicked should show a RadConfirm and when clicked "YES/OK" on radconfirm should call another javascript function without doing a postback(or page refresh). Other wise should not do anything.

This is what I have done:
Mark up for the grid template column.
<telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn column"
                        UniqueName="DeleteColumn" HeaderText="Delete">
                        <ItemTemplate>
                            <asp:ImageButton ID="btTrash" ImageUrl="/BSS/Admin/resources/Trash.png" runat="server" OnClientClick="DeleteEntry" ></asp:ImageButton>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>

Javascript on Row DataBound:
function rgUpdateConfigSummary_OnRowDataBound(sender, args) {
            //var dataItem = args.get_gridDataItem();
            var SiteID = glbl_SiteID;
            var prodID = args.get_dataItem().ProductID;
            var GenID = args.get_dataItem().GenerationID;
 
            var DeleteLink = args.get_item().get_cell("DeleteColumn").getElementsByTagName('input')[0];
 
            var attrib_href = document.createAttribute('href');
           attrib_href.value = '#';
            DeleteLink.setAttributeNode(attrib_href);
 
            DeleteLink.removeAttribute("onclick");
 
            var attrib_onClick = document.createAttribute('onclick');
          attrib_onClick.value = 'showDeleteConfirm(' + prodID + ',' + GenID + ',"' + SiteID + '"); ';
          DeleteLink.setAttributeNode(attrib_onClick);
 
        }

This is the showDeleteConfirm method:
function showDeleteConfirm(prodID, GenID, SiteID) {
            radconfirm('Client radconfirm: Are you sure?', function () { confirmDelete(prodID, GenID, SiteID); }, 330, 100, null, 'Client RadConfirm', imgUrl);
            return false;
        }
 
function confirmDelete(prodID, GenID, SiteID) {
            var service = new tempuri.org.ImyService();
            alert(prodID + GenID + SiteID);
            service.Delete(SiteID, prodID, GenID, rebindandclose);
 
            return false;
        }

But everytime I click on the button, it does a postback without calling the javascript function. Help will be appreciated :)

Thank you.
Jayesh Goyani
Top achievements
Rank 2
 answered on 02 Apr 2012
1 answer
230 views

Hi all,

Im using the latest telerik rad ajax controls (ASP.NET AJAX Q1 2012 version 12.1.215.0). I have a treelist which has a template column whereby I placed a combobox in it. What my page does is I allow the user to select options in the combobox and when they click the save button, my function will create 1 record per row which has a selected option in the comboboxes. Here is my code

<telerik:RadAjaxLoadingPanel ID="RadTreeAjax" runat="server" Skin="Windows7" EnableSkinTransparency="False" Transparency="30" />
    <telerik:RadTreeList ID="RadTreeList1" runat="server" AllowPaging="true" PageSize="15" Skin="Windows7" OnNeedDataSource="RadTreeList1_OnNeedDataSource" OnItemDataBound="RadTreeList1_OnItemDataBound"
        AutoGenerateColumns="false" AllowSorting="true" DataKeyNames="ParentId" ParentDataKeyNames="GoalId" Width="1070px" GridLines="None" >
        <Columns>
            <telerik:TreeListBoundColumn DataField="Id" UniqueName="Id" HeaderText="Id" Visible="false" />
            <telerik:TreeListBoundColumn DataField="ParentId" UniqueName="ParentId" HeaderText="ParentId" Visible="false" />
            <telerik:TreeListBoundColumn DataField="GoalId" UniqueName="GoalId" HeaderText="GoalId" Visible="false" />
            <telerik:TreeListBoundColumn DataField="InterventionId" UniqueName="InterventionId" HeaderText="InterventionId" Visible="false" />
            <telerik:TreeListBoundColumn DataField="Goal" UniqueName="Goal" HeaderText="Goal" ItemStyle-Width="320px" HeaderStyle-Width="320px" />
            <telerik:TreeListBoundColumn DataField="Intervention" UniqueName="Intervention" HeaderText="Intervention" ItemStyle-Width="495px" HeaderStyle-Width="495px" />
            <telerik:TreeListTemplateColumn UniqueName="GoalStatus" HeaderText="Status" ItemStyle-Width="100px" HeaderStyle-Width="100px" >
                <ItemTemplate>
                    <telerik:RadComboBox ID="ddlGoalStatus" Width="90px" Filter="StartsWith" AllowCustomText="true" EmptyMessage="" AutoPostBack="true" EnableViewState="true" runat="server" Skin="Windows7" CssClass="tabbar_tasklist_last" RegisterWithScriptManager="False">
                    </telerik:RadComboBox>
                </ItemTemplate>
            </telerik:TreeListTemplateColumn>
            <telerik:TreeListTemplateColumn UniqueName="InterventionStatus" ItemStyle-Width="105px" HeaderStyle-Width="105px" >
                <ItemTemplate>
                    <telerik:RadComboBox ID="ddlInterventionStatus" Width="95px" Filter="StartsWith" AllowCustomText="true" EmptyMessage="" AutoPostBack="true" runat="server" Skin="Windows7" CssClass="tabbar_tasklist_last" RegisterWithScriptManager="False">
                    </telerik:RadComboBox>
                </ItemTemplate>
            </telerik:TreeListTemplateColumn>
        </Columns>
    </telerik:RadTreeList>

protected void RadTreeList1_OnNeedDataSource(object sender, TreeListNeedDataSourceEventArgs e)
        {
            RadTreeList1.DataSource = GetGoalsAndInterventions();
        }
 
        protected void RadTreeList1_OnItemDataBound(object sender, Telerik.Web.UI.TreeListItemDataBoundEventArgs e)
        {
            if (e.Item is TreeListDataItem)
            {
                TreeListDataItem dataItem = e.Item as TreeListDataItem;
 
                RadComboBox ddlGoalStatus = (RadComboBox)e.Item.FindControl("ddlGoalStatus");
                RadComboBox ddlInterventionStatus = (RadComboBox)e.Item.FindControl("ddlInterventionStatus");
 
                ddlGoalStatus.DataSource = GetGoalStatusMaster();
                ddlGoalStatus.DataValueField = "GoalStatusId";
                ddlGoalStatus.DataTextField = "Value";
                ddlGoalStatus.DataBind();
                 
 
                ddlInterventionStatus.DataSource = GetInterventionStatusMaster();
                ddlInterventionStatus.DataValueField = "InterventionStatusId";
                ddlInterventionStatus.DataTextField = "Value";
                ddlInterventionStatus.DataBind();
 
                if (dataItem.ItemType == TreeListItemType.Item || dataItem.ItemType == TreeListItemType.AlternatingItem)
                {
                    TableCell cell = dataItem["ParentId"];
                    string value = cell.Text;
 
                    if (value != " ")
                    {
                        ddlInterventionStatus.Visible = false;
                        ddlGoalStatus.Visible = true;
                    }
 
                    TableCell cell2 = dataItem["InterventionId"];
                    string value2 = cell2.Text;
 
                    if (value2 != " ")
                    {
                        ddlGoalStatus.Visible = false;
                        ddlInterventionStatus.Visible = true;
                    }
                }
 
            }
        }

private void SaveGoalStatus()
        {
            // delete all goal status from database
            DeleteInterventionStatus();
            DeleteGoalStatus();
 
            foreach (TreeListDataItem item in RadTreeList1.Items)
            {
                string s1 = string.Empty;
                string s2 = string.Empty;
                 
                RadComboBox ddlInterventionStatus = (RadComboBox)item.FindControl("ddlInterventionStatus");
 
                if (item.ItemType == TreeListItemType.Item || item.ItemType == TreeListItemType.AlternatingItem)
                {
                    RadComboBox ddlGoalStatus = (RadComboBox)item.FindControl("ddlGoalStatus");
                    string s = ddlGoalStatus.SelectedItem.Text;
 
                    if (ddlGoalStatus.SelectedItem != null)
                    {
                        TableCell cell = item["Id"];
                        string ProblemGoalId = cell.Text;
             
 
                         
 
                        if (ProblemGoalId != " ")
                        {
                            try
                            {
                                CarePlan_GoalStatus oGoalStatus = new CarePlan_GoalStatus();
                                oGoalStatus.CarePlanId = this.CarePlanID;
                                oGoalStatus.ProblemGoalId = new Guid(ProblemGoalId);
                                oGoalStatus.GoalStatusId = GetGoalId(s);
                                oGoalStatus.CreatedBy = this.UserId;
                                oGoalStatus.ModifiedBy = this.UserId;
 
                                oGoalStatus = WCFSvcClient.CCITDataService.Insert(oGoalStatus) as CarePlan_GoalStatus;
                            }
                            catch (Exception ex)
                            {
                                lblMessage.Text = "Create Goal Status" + ex.Message;
                            }
                        }
                    }
                }
 
                if (ddlInterventionStatus.SelectedItem != null)
                {
                    if (item.ItemType == TreeListItemType.Item || item.ItemType == TreeListItemType.AlternatingItem)
                    {
                        TableCell cell = item["Id"];
                        string GoalInterventionId = cell.Text;
 
                        if (GoalInterventionId != " ")
                        {
                            try
                            {
                                CarePlan_InterventionStatus oInterventionStatus = new CarePlan_InterventionStatus();
                                oInterventionStatus.CarePlanId = this.CarePlanID;
                                oInterventionStatus.GoalInterventionId = new Guid(GoalInterventionId);
                                oInterventionStatus.InterventionStatusId = new Guid(ddlInterventionStatus.SelectedItem.Value);
                                oInterventionStatus.CreatedBy = this.UserId;
                                oInterventionStatus.ModifiedBy = this.UserId;
 
                                oInterventionStatus = WCFSvcClient.CCITDataService.Insert(oInterventionStatus) as CarePlan_InterventionStatus;
                            }
                            catch (Exception ex)
                            {
                                lblMessage.Text = "Create Intervention Status" + ex.Message;
                            }
                        }
                    }
 
                    #region Populate Info On Page
                    BindToViewState();
 
                    // call first to populate the ddlSection selection
                    DisplayCarePlanInfoOnPage();
 
                    // the values are originally populated on selected change of ddlSection but due to population of data on first load of page
                    // the page has no selected index change, this this has to be done manually
                    GetProblemBySection(ddlSection.SelectedItem.Value);
 
                    // call again to GET the selected value of ddlProblem
                    DisplayCarePlanInfoOnPage();
 
                    foreach (DataRow row in ProblemTable.Rows)
                    {
                        if (row["Value"].ToString() == ddlProblem.SelectedItem.Text)
                            txtProblemDescription.Text = row["Description"].ToString();
                    }
                    #endregion
                }
            }
        }

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="ddlSection">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="ddlSection" />
                    <telerik:AjaxUpdatedControl ControlID="ddlProblem" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="ddlProblem">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="ddlProblem" />
                    <telerik:AjaxUpdatedControl ControlID="txtProblemDescription" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadTreeList1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadTreeList1" LoadingPanelID="RadTreeAjax" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="cpTB">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="CarePlanPanel" LoadingPanelID="CarePlanAjax" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnSearch">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Panel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>


A little explanation bout my  page is onpageload if there is an existing data in the database I will populate the treelist and also bind the comboboxes in the treelist based on the value saved in the database (this works fine). But my problem now is when I select a different value and click the save button, it is supposed to create a row in my database table with the new combobox selection however it doesnt.

As you can see, I bind my comboboxes in the itemdatabound and in my Save function what I do is I clear my database table and then I reinsert new rows into the table based on rows in the treelist which has a selected value in the combobox. As for now I am only testing based on ddlGoalStatus combobox so please ignore the ddlInterventionStatus combobox. In my save function, I have a line which says "string s = ddlGoalStatus.SelectedItem.Text;" and the value I retrieved is ALWAYS the previous value and not the newly selected value. Am I doing anything wrong? 

Please help.

Thanks!

Antonio Stoilkov
Telerik team
 answered on 02 Apr 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?