Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
98 views
I am having trouble trying to do a crosspage postback when a user double clicks on a grid row. Using the example found at

http://www.telerik.com/support/kb/aspnet-ajax/grid/performing-postback-from-grid-client-events.aspx I did the following for my aspx page. I think the issue is using the ajax manager with the grid. I want the ajax manage for all the other events such as paging, sorting, etc., but not for the client double click which I want to do a full postback with a the postback url being another page.

   <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">  
        <script type="text/javascript">  
            function refreshGrid(arg) {  
                if (!arg) {  
                    $find("<%= ramCustomerProfileList.ClientID %>").ajaxRequest("Rebind");  
                }  
                else {  
                    $find("<%= ramCustomerProfileList.ClientID %>").ajaxRequest("RebindAndNavigate");  
                }  
            }  
 
            function rowDblClick(sender, eventArgs) {  
                aspnetForm.action = "CustomerProfile.aspx";  
                __doPostBack("<%= rgCustomerProfileList_CustomerProfiles.UniqueID %>", "RowDblClicked:" + eventArgs.get_itemIndexHierarchical());  
            }  
              
        </script> 
    </telerik:RadCodeBlock>   
 
<telerik:RadAjaxManager ID="ramCustomerProfileList" runat="server" OnAjaxRequest="ramCustomerProfileList_AjaxRequest">  
    <AjaxSettings> 
        <telerik:AjaxSetting AjaxControlID="rgCustomerProfileList_CustomerProfiles">  
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="rgCustomerProfileList_CustomerProfiles" LoadingPanelID="ralpCustomerProfileList_LoadingPanel" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting>   
    </AjaxSettings> 
</telerik:RadAjaxManager> 
 
        <telerik:RadAjaxLoadingPanel ID="ralpCustomerProfileList_LoadingPanel" runat="server">  
        </telerik:RadAjaxLoadingPanel> 
    <telerik:RadGrid ID="rgCustomerProfileList_CustomerProfiles" runat="server"   
        AllowFilteringByColumn="True"   
        AllowPaging="True"   
        AllowSorting="True"   
        AutoGenerateColumns="False"   
        GridLines="None"   
        ShowGroupPanel="True" 
        OnNeedDataSource="rgCustomerProfileList_CustomerProfiles_NeedDataSource" 
        > 
<MasterTableView  
        DataKeyNames="CustomerId"   
        ClientDataKeyNames="CustomerId" 
        CommandItemDisplay="Top" 
        CommandItemSettings-ShowExportToCsvButton="true" 
        PageSize="20" 
        > 
<RowIndicatorColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</RowIndicatorColumn> 
 
<ExpandCollapseColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</ExpandCollapseColumn> 
 
<CommandItemSettings ShowExportToCsvButton="True"></CommandItemSettings> 
    <Columns> 
        <telerik:GridBoundColumn DataField="AccountName" HeaderText="Account Name"   
            UniqueName="AccountName">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn HeaderText="Parent Company" UniqueName="ParentCompany" DataField="ParentCompany.Name">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="AccountManagerName"   
            HeaderText="Account Manager" UniqueName="AccountManagerName">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="City" HeaderText="City" UniqueName="City">  
        </telerik:GridBoundColumn> 
    </Columns> 
   <CommandItemTemplate> 
    <asp:LinkButton ID="btnAddNewRecord" runat="server"   
           onclick="btnAddNewRecord_Click" PostBackUrl="~/CustomerProfile/CustomerProfile.aspx">&nbsp;<img src="../images/icons/add-16x20.gif" border="0" />&nbsp;Add New Record&nbsp;</a></asp:LinkButton>   
   </CommandItemTemplate> 
    <NoRecordsTemplate> 
    No Records      
    </NoRecordsTemplate> 
</MasterTableView> 
        <ClientSettings AllowDragToGroup="True" Resizing-AllowColumnResize="true">  
            <Selecting AllowRowSelect="True" /> 
            <Scrolling AllowScroll="True"   
            UseStaticHeaders="True" /> 
            <ClientEvents OnRowDblClick="rowDblClick" /> 
        </ClientSettings> 
      
      
    </telerik:RadGrid> 

 

Iana Tsolova
Telerik team
 answered on 06 Apr 2010
10 answers
247 views
Hi there

I have a grid which is bound client-side. The table contains about 10 columns of which some are fixed width and others aren't.
When I page through the grid everything works as expected until I reach the last page. Then the scrollbar disapears the headers are misaligned with the table content.
I found that calling grid.repaint() from the client when the data is bound fixes this problem for Internet Explorer 7 (haven't tried other versions), however, Firefox doesn't seem to care and the grid is misaligned until the scrollbar reapears (pushing the content back to place). The problem is a bit different in Google Chrome, but it's still an issue.

Is there any way to realign the headers programatically through script whenever a scrollbar (re)apears?
Nikolay Rusev
Telerik team
 answered on 06 Apr 2010
1 answer
152 views
Hi,

I have a load-on-demand combo box but have a problem where you can type something in the text field and even if what is typed does not match an item in the combobox, if you tab out, or click out of the control, the page posts back, the selected index changes and what was typed remains in the combobox text field.

I would like the behaviour of the control to not post back if what someone types does not match an item, but does post back if the item matches. I presume this is a client-side event I need to handle for this, but I would appreciate some help.

Thanks
Tom

Control:

<telerik:RadComboBox ID="ddlStudents" EnableViewState="false" runat="server" EnableVirtualScrolling="true"
                      ShowMoreResultsBox="true" EnableLoadOnDemand="true" OnItemsRequested="ddlStudents_ItemsRequested"
                       OnClientDropDownOpening="OnClientDropDownOpening" AutoPostBack="true" EnableItemCaching="true" HighlightTemplatedItems="true" EmptyMessage="Select a student or start typing their name" ExpandAnimation-Duration="150"
                       MarkFirstMatch="true" EnableTextSelection="true" IsCaseSensitive="false" CollapseAnimation-Duration="9" Skin="Default" DataValueField="StudentId"
                        DataTextField="CombinedName" ToolTip="Select a student from the drop down list or start typing their name/ID to return only those students matching your criteria."
                        OnSelectedIndexChanged="ddlStudents_SelectedIndexChanged" MaxHeight="250px" Width="100%">
Kalina
Telerik team
 answered on 06 Apr 2010
2 answers
133 views
Hi,

By now I'm grouping by expressions programmatically, what I want to do is to change the text displayed on the group header, I mean, I'm doing this:

Dim expression As GridGroupByExpression = GridGroupByExpression.Parse("PROJECT[Project ID] Group by PROJECT"

so the result in the grid is like this: "Project ID: Project1" (being Project1 the field in the database), but what happen if the field of the database, PROJECT, is empty? the result will be: "Project ID: "; is there a way to write "Empty" instead of " "(blank)???...I don't want to modify the database.

Thanks in advance!
Dany V
Top achievements
Rank 1
 answered on 06 Apr 2010
2 answers
96 views
I have a radEditor on a web page. Unfortunately, the way the text is saved and interpreted by another site (beyond my control), requires a css class to control each of the the bullet types. So what I have done is created a custom function every time the ordered and unordered lists are created. The problem now is, when I hit the bullet button twice, it no longer takes away the list item, it adds another list.

            Telerik.Web.UI.Editor.CommandList["InsertUnorderedList"] = function(commandName, editor, args) { 
                var selection = editor.getSelection(); 
                var selectedHTML = selection.getHtml(); 
 
                editor.pasteHtml("<ul class=ulolProdDesc><li>" + selectedHTML + "</li></ul>"); 
            } 


Is there any way to grab the line of text the cursor is on when you hit the button on the tool bar? Or is there a better way to do this (maybe like limiting the amount of list items a list can have?). When I try to use createRestorePoint() I get an undefined error, even though I'm not sure I can use it anyway. Thanks for the help.
Alex
Top achievements
Rank 2
 answered on 06 Apr 2010
2 answers
200 views
Basically it appears that WebKit browsers like Chrome and Safari are triggering requests when they shouldn't (IE and Firefox appear unaffected).This example has a simple RadTextBox with a button which calls an onclick event for a hidden button. Clicking the textbox's button works fine, calling the onlick of the hidden button works fine, but pressing ENTER inside the textbox to issue an ajax request via the hidden button fails to show the loading panel, in fact it does show it, but it immediately hides it due to a back to back requests and responses. After the first ENTER, subsequent ENTERS cause mulitple responses that do not match the number of requests, however the textbox's button will show the loading panel despite having an incorrect number of responses? Can anyone help explain/fix this?

Here is a very simple sample: (Q2-2009 RadAjax.NET Controls)
ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="WebKitTest.aspx.cs" Inherits="WebKitTest" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml">  
  <head runat="server">  
    <title>WebKitTest</title> 
    <telerik:RadStyleSheetManager id="RadStyleSheetManager" runat="server" /> 
  </head> 
  <body> 
    <form id="frmWebKit" runat="server">  
      
        <telerik:RadScriptManager ID="RadScriptManager" runat="server">  
            <Scripts> 
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" /> 
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" /> 
            </Scripts> 
        </telerik:RadScriptManager> 
          
        <telerik:RadAjaxManager ID="RadAjaxManager" runat="server" ClientEvents-OnRequestStart="Ajax_OnRequestStart" ClientEvents-OnResponseEnd="Ajax_OnResponseEnd">  
        <AjaxSettings> 
          <telerik:AjaxSetting AjaxControlID="btnHidden">  
            <UpdatedControls> 
              <telerik:AjaxUpdatedControl ControlID="pnlWebKit" LoadingPanelID="RadAjaxLoadingPanel" UpdatePanelRenderMode="Inline" /> 
            </UpdatedControls> 
          </telerik:AjaxSetting> 
        </AjaxSettings> 
        </telerik:RadAjaxManager> 
 
      <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel" runat="server" Skin="Default">  
      </telerik:RadAjaxLoadingPanel>   
 
      <telerik:RadScriptBlock runat="server" ID="RadScriptBlock">  
        <script type="text/javascript">  
          function Ajax_OnRequestStart(sender, args) {  
            var log = document.getElementById('divLog');  
            loglog.innerHTML = log.innerHTML + '<br />Start Request; ID:' + args.get_eventTargetElement().id;  
          }  
 
          function Ajax_OnResponseEnd(sender, args) {  
            var log = document.getElementById('divLog');  
            loglog.innerHTML = log.innerHTML + '<br />End Request; ID:' + args.get_eventTargetElement().id;  
          }  
 
          function txtWebKit_OnKeyDown(event) {  
            if (event.keyCode == 13) {  
              txtWebKit_OnClick();  
            }  
          }  
 
          function txtWebKit_OnClick(sender, args) {  
            var log = document.getElementById('divLog');  
            loglog.innerHTML = log.innerHTML + '<br />';            
            $get('<%= btnHidden.ClientID%>').click();  
          }  
       </script> 
      </telerik:RadScriptBlock> 
              
        <asp:Panel ID="pnlWebKit" runat="server" Width="190px" Height="25px" BorderStyle="Solid" BorderWidth="1px">  
          &nbsp;  
          <telerik:RadTextBox ID="txtWebKit" runat="server" Width="180px" ShowButton="true" onkeydown="txtWebKit_OnKeyDown(event);" > 
          <ClientEvents OnButtonClick="txtWebKit_OnClick" /> 
        </telerik:RadTextBox> 
        </asp:Panel> 
 
      <div style="display:none;">  
        <asp:Button ID="btnHidden" runat="server" Text="HiddenButton" OnClick="btnHidden_Click" /> 
      </div> 
 
      <div id="divLog" runat="server" style="display:block" >    
      </div> 
    
      </form> 
  </body> 
</html> 
 

C#
using System;  
using System.Web;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
 
using System.Data;  
using System.Configuration;  
using System.Web.Security;  
using System.Web.UI.WebControls.WebParts;  
using System.Web.UI.HtmlControls;  
using Telerik.Web.UI;  
 
public partial class WebKitTest : System.Web.UI.Page  {  
 
  protected void Page_Load(object sender, EventArgs e) {  
  }  
 
  protected void btnHidden_Click(object sender, EventArgs e) {  
    System.Threading.Thread.Sleep(5000);  
    txtWebKit.Text = "Response Complete";  
  }  
 
}  
 
Iana Tsolova
Telerik team
 answered on 06 Apr 2010
10 answers
558 views

Hi there,

Is it possible to localize this control?

Thank you.

EDIT: Never mind ... I thougt that there will be some .resx called FileExplorer. I found what I needed.

Hamdy
Top achievements
Rank 1
 answered on 06 Apr 2010
9 answers
237 views
Hi,

I need to know how to make it possible to reorder the rows in a single rad data grid using grid drag and drop functionality.

I went through live examples as well as few posts in here, yet, couldn't find the solution. all what I'm looking for is to allow users to drag and drop rows to perform reordering and to show the new ordering as well.

It's highly appreciated if you can provide code sample that demonstrate the above scenario, and please don't ask me to view live examples because I already did and couldn't find the solution!

Thanks for your help and assistance in advance :-)

Regards,
Yavor
Telerik team
 answered on 06 Apr 2010
3 answers
280 views
Hi,
     guys i am creating a web control and in this web control,  i am creating a dynamic rad grid But Update command event  is not fire.
    and neither any other command is not working in edit row.
 
     i want to tell you ,  i  am create a object of rad grid and add template fields in a grid on Init event of this webcontrol. edit command is working  fine but update command is not working . and choose  EditMode = InPlace , i am Binding this grid in !Page.Ispostback
and i am also use NeedDataSource event handler.

     Please help me this is urgent .
     Thanks

 override protected void OnInit(EventArgs e)
        {
            radGrid = new RadGrid();

            radGrid.EditCommand += new GridCommandEventHandler(radGrid_EditCommand);
            radGrid.UpdateCommand += new GridCommandEventHandler(radGrid_UpdateCommand);
            radGrid.CancelCommand += new GridCommandEventHandler(radGrid_CancelCommand);
            radGrid.NeedDataSource += new GridNeedDataSourceEventHandler(radGrid_NeedDataSource);
            radGrid.ItemDataBound += new GridItemEventHandler(radGrid_ItemDataBound);
            radGrid.ItemCommand += new GridCommandEventHandler(radGrid_ItemCommand);

            populatePropertyOfGrid();
        }
          public void  populatePropertyOfGrid()
        {
            radGrid.ID = "radGrid";
            radGrid.Skin = this.Skin;
            radGrid.EnableEmbeddedSkins = this.EnableEmbeddedSkins;
            radGrid.Width = Unit.Percentage(100);
            radGrid.AutoGenerateColumns = false;
            radGrid.MasterTableView.EditMode = GridEditMode.InPlace;

            string[] DataKeys = new string[5];
            DataKeys[0] = "PageConfigId";
            DataKeys[1] = "IdDetailSearch";
            DataKeys[2] = "IdSearchSearch";
            DataKeys[3] = "DataflowId";
            DataKeys[4] = "IsMandatoryForExport";

            radGrid.MasterTableView.DataKeyNames = DataKeys;

            GridTemplateColumn gridTemplateEditLink = new GridTemplateColumn();
            gridTemplateEditLink.ItemTemplate = new FeildsGridTemplate(ListItemType.Item, "LinkButton", "linkEdit", Skin, "edit", "Edit", null);
            gridTemplateEditLink.EditItemTemplate = new FeildsGridTemplate(ListItemType.EditItem, "LinkButton", "linkUpdate", Skin, "update", "Update", null);
            gridTemplateEditLink.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
            gridTemplateEditLink.HeaderStyle.VerticalAlign = VerticalAlign.Middle;
            gridTemplateEditLink.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
            gridTemplateEditLink.ItemStyle.VerticalAlign = VerticalAlign.Middle;
            radGrid.MasterTableView.Columns.Add(gridTemplateEditLink);

            GridTemplateColumn gridTemplateDataElement = new GridTemplateColumn();

            gridTemplateDataElement.ItemTemplate=new FeildsGridTemplate(ListItemType.Item, "Label", "lblDataElement", Skin, "DataElement", "", null);
            gridTemplateDataElement.EditItemTemplate = new FeildsGridTemplate(ListItemType.EditItem , "Label", "lblEditDataElement", Skin, "DataElement", "", null);
            gridTemplateDataElement.HeaderText = "Data Element";
           // gridTemplateDataElement.SortExpression = "DataElement";
            gridTemplateDataElement.DataField = "DataElement";
            gridTemplateDataElement.HeaderStyle.Width = Unit.Pixel(120);
            gridTemplateDataElement.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
            gridTemplateDataElement.HeaderStyle.VerticalAlign = VerticalAlign.Middle;

            gridTemplateDataElement.ItemStyle.Width = Unit.Pixel(120);
            gridTemplateDataElement.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
            gridTemplateDataElement.ItemStyle.VerticalAlign = VerticalAlign.Middle;

            radGrid.MasterTableView.Columns.Add(gridTemplateDataElement);



            GridTemplateColumn gridTemplateAvail = new GridTemplateColumn();

            gridTemplateAvail.ItemTemplate = new FeildsGridTemplate(ListItemType.Item, "CheckBox", "chkItemAvailable", Skin, "IsAvailable", "", null);
            gridTemplateAvail.EditItemTemplate = new FeildsGridTemplate(ListItemType.EditItem, "CheckBox", "chkEditAvailable", Skin, "IsAvailable", "", null);

            gridTemplateAvail.HeaderText = "Avail.";
           // gridTemplateAvail.SortExpression = "IsAvailable";
            gridTemplateAvail.DataField = "IsAvailable";
            gridTemplateAvail.HeaderStyle.Width = Unit.Pixel(20);
            gridTemplateAvail.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
            gridTemplateAvail.HeaderStyle.VerticalAlign = VerticalAlign.Middle;

            gridTemplateAvail.ItemStyle.Width = Unit.Pixel(20);
            gridTemplateAvail.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
            gridTemplateAvail.ItemStyle.VerticalAlign = VerticalAlign.Middle;

            radGrid.MasterTableView.Columns.Add(gridTemplateAvail);


}



   public class FeildsGridTemplate : IBindableTemplate    // IBindableTemplate
    {
        ListItemType templateType;
        string addedControlType;
        string controlId;
        string commandName;
        string Skin;
        string columnName;

        object ControlInput;

        public System.Collections.Specialized.IOrderedDictionary ExtractValues(System.Web.UI.Control container)
        {
            OrderedDictionary od = new OrderedDictionary();
            // od.Add("ProviderName", ((TextBox)(((GridEditFormItem)(container)).FindControl("MyTextBox"))).Text);
            return od;
        }



        /// <summary>
        /// This Contructor for populate Item,Footer,Edit Property
        /// </summary>
        /// <param name="type"></param>
        /// <param name="pr_ControlType"></param>
        /// <param name="pr_controlId"></param>
        /// <param name="pr_GridId"></param>
        /// <param name="pr_columnName"></param>
        public FeildsGridTemplate(ListItemType type, string pr_ControlType, string pr_controlId, string pr_Skin, string pr_columnName, string pr_commandName, object pr_ControlInput)
        {
            templateType = type;
            addedControlType = pr_ControlType;
            controlId = pr_controlId;
            Skin = pr_Skin;
            columnName = pr_columnName;
            commandName = pr_commandName;
            ControlInput = pr_ControlInput;
        }


        public void InstantiateIn(System.Web.UI.Control container)
        {
            CheckBox chkBox = new CheckBox();
            LinkButton lnkBtn = new LinkButton();
            //CustomizeTextBox txtBox = new CustomizeTextBox();
            TextBox txtBox = new TextBox();
            Label lbl = new Label();
           // DropDownControl dropDownControl = new DropDownControl();
            System.Web.UI.WebControls.DropDownList dropDownControl = new System.Web.UI.WebControls.DropDownList();


            switch (templateType)
            {
                case ListItemType.EditItem:
                    #region EditItem
                    if (addedControlType == "CheckBox")
                    {
                        chkBox.ID = controlId;
                        chkBox.Text = columnName;
                        container.Controls.Add(chkBox);
                        chkBox.DataBinding += new EventHandler(boolValueEdit_DataBinding); // This Event for bind this object

                    }
                    else if (addedControlType == "TextBox")
                    {
                        txtBox.Width = 150;
                      //  txtBox.Connectionstring = Skin; // This is connection string for dataBase connection
                        txtBox.ID = controlId;
                        txtBox.Text = columnName;
                      
                        txtBox.DataBinding += new EventHandler(txtBoxEditDataBinding);
                        container.Controls.Add(txtBox);
                    }
                    else if (addedControlType == "LinkButton")
                    {
                        HtmlTable table = new HtmlTable();
                        table.Attributes.Add("class", "select_bdr");
                      
                        table.CellPadding = 3;
                        table.CellSpacing = 3;

                        HtmlTableRow tr = new HtmlTableRow();
                        HtmlTableCell td1 = new HtmlTableCell();
                        td1.Style.Value = "border-style:none !important;";

                        HtmlTableCell td2 = new HtmlTableCell();
                        td2.Style.Value = "border-style:none !important;";

                        Label td1GapLeft = new Label();
                        Label td1GapRight = new Label();
                        Label td2GapLeft = new Label();
                        Label td2GapRight = new Label();

                        td1GapLeft.Text = "[";
                        td1GapLeft.Style.Value = "font-size: 10px ! important;color:#0000EE;";

                        td1GapRight.Text = "]";
                        td1GapRight.Style.Value = "font-size: 10px ! important;color:#0000EE;";

                        td2GapLeft.Text = "[";
                        td2GapLeft.Style.Value = "font-size: 10px ! important;color:#0000EE;";

                        td2GapRight.Text = "]";
                        td2GapRight.Style.Value = "font-size: 10px ! important;color:#0000EE;";

                        lnkBtn.ID = controlId;
                        lnkBtn.Text = columnName;
                        lnkBtn.Style.Value = "font-size: 10px ! important;color:#0000EE; margin-left:3px; margin-right:3px;";
                        lnkBtn.CommandName = "Update";

                        td1.Controls.Add(td1GapLeft);
                        td1.Controls.Add(lnkBtn);
                        td1.Controls.Add(td1GapRight);
                        tr.Controls.Add(td1);
                       

                        LinkButton linkCancel = new LinkButton();
                        linkCancel.ID = "linkCancel";
                        linkCancel.Text = "cancel";
                        linkCancel.Style.Value = "font-size: 10px ! important;color:#0000EE; margin-left:3px; margin-right:3px;";
                        linkCancel.CommandName = "Cancel";

                        td2.Controls.Add(td2GapLeft);
                        td2.Controls.Add(linkCancel);
                        td2.Controls.Add(td2GapRight);
                        tr.Controls.Add(td2);
                       
                      

                        table.Controls.Add(tr);
                        container.Controls.Add(table);
                    }
                    else if (addedControlType == "Label")
                    {
                        lbl.ID = controlId;
                        lbl.Text = columnName;
                        lbl.DataBinding += new EventHandler(lblEdit_DataBinding);
                        container.Controls.Add(lbl);
                    }
                   else if (addedControlType == "Dropdown")
                    {
                        dropDownControl.ID = controlId;
                        dropDownControl.SkinID = columnName;
                        DropdownPropertyClass dropdownPropertyClass = (DropdownPropertyClass)ControlInput;
                        if (Skin != "")
                        {
                          //  dropDownControl.DropDownListSkin = dropdownPropertyClass.Skin;
                          //  dropDownControl.EnableEmbeddedSkins = dropdownPropertyClass.EnableEmbeddedSkins;
                        }

                      //  dropDownControl.ConnectionString = dropdownPropertyClass.ConnectionString;

                     //  dropDownControl.MainTableCssClass = "select_bdr";

                       dropDownControl.DataTextField= dropdownPropertyClass.DataTextField;
                       dropDownControl.DataValueField = dropdownPropertyClass.DataValueField;

                    //  if (dropdownPropertyClass.DataSource != null)
                    //  {
                          //dropDownControl.DataSource = dropdownPropertyClass.DataSource;
                         // dropDownControl.DataBind();
                      
                    //  }


                     //   dropDownControl.DataBinding += new EventHandler(dropDownControlEdit_DataBinding);
                        container.Controls.Add(dropDownControl);
                    }
                    break;
                    #endregion
                case ListItemType.Item:
                    #region Item
                    if (addedControlType == "CheckBox")
                    {
                        chkBox.ID = controlId;
                        chkBox.Enabled = false;
                        chkBox.Text = columnName;
                        container.Controls.Add(chkBox);
                        chkBox.DataBinding += new EventHandler(boolValue_DataBinding); // This Event for bind this object

                    }
                    else if (addedControlType == "LinkButton")
                    {
                        HtmlTable table = new HtmlTable();
                        table.Attributes.Add("class","select_bdr");
                        
                        table.CellPadding =0;
                        table.CellSpacing =0;

                        HtmlTableRow tr = new HtmlTableRow();
                        HtmlTableCell td1 = new HtmlTableCell();
                        td1.Style.Value = "border-style:none !important;";
                        Label td1GapLeft = new Label();
                        Label td1GapRight = new Label();
                      

                        td1GapLeft.Text = "[";
                        td1GapLeft.Style.Value = "font-size: 10px ! important;color:#0000EE;";

                        td1GapRight.Text = "]";
                        td1GapRight.Style.Value = "font-size: 10px ! important;color:#0000EE;";

                      
                        lnkBtn.ID = controlId;
                        lnkBtn.Text = columnName;
                        lnkBtn.Style.Value = "font-size: 10px ! important;color:#0000EE; margin-left:3px; margin-right:3px;";
                        lnkBtn.CommandName = "Edit";

                        td1.Controls.Add(td1GapLeft);
                        td1.Controls.Add(lnkBtn);
                        td1.Controls.Add(td1GapRight);
                        tr.Controls.Add(td1);
                      

                     
                        table.Controls.Add(tr);
                        container.Controls.Add(table);

                    }
                    else if (addedControlType == "Label")
                    {
                        lbl.ID = controlId;
                        lbl.Text = columnName;
                        lbl.DataBinding += new EventHandler(lbl_DataBinding);
                        container.Controls.Add(lbl);
                    }
                 
                    #endregion
                    break;
            }

        }


        /// <summary>
        /// This Event for populating Label Text Template Item
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lbl_DataBinding(object sender, EventArgs e)
        {
            Label lbl = (Label)sender;
            string id = lbl.ID;
            GridDataItem container = (GridDataItem)lbl.NamingContainer;
            if (lbl != null && lbl.Text != "")
            {
                try  // User Don't want to Bind this object, then dataColumn is not found in dataSource then runtime exception occur
                {
                    lbl.Text = Convert.ToString(((DataRowView)container.DataItem)[lbl.Text]);
                }
                catch (Exception ex)
                {

                }
            }
        }


        /// <summary>
        /// This checkbox event of item template
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void boolValue_DataBinding(object sender, EventArgs e)
        {
            CheckBox cBox = (CheckBox)sender;
            GridDataItem container = (GridDataItem)cBox.NamingContainer;
            if (cBox.Text != "")
            {
                try  // User Don't want to Bind this object, then dataColumn is not found in dataSource then runtime exception occur
                {
                    cBox.Checked = (bool)((DataRowView)container.DataItem)[cBox.Text];
                }
                catch (Exception ex)
                {

                }
                cBox.Text = "";
            }

            // cBox.Text = "";
        }

        /// <summary>
        /// This Event to Populate Template Edit Dropdown
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void dropDownControlEdit_DataBinding(object sender, EventArgs e)
        {
            RadComboBox dropDownControl = (RadComboBox)sender;
            GridEditableItem container = (GridEditableItem)dropDownControl.NamingContainer;
            if (dropDownControl != null && dropDownControl.SkinID != "")
            {
                try
                {
                    dropDownControl.SelectedItem.Text = Convert.ToString(((DataRowView)container.DataItem)[dropDownControl.SkinID]);
                }
                catch (Exception ex)
                {

                }
            }
        }

        /// <summary>
        /// This checkbox event of Edit template
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void boolValueEdit_DataBinding(object sender, EventArgs e)
        {
            CheckBox cBox = (CheckBox)sender;
            GridEditableItem container = (GridEditableItem)cBox.NamingContainer;
            if (cBox.Text != "")
            {
                try  // User Don't want to Bind this object, then dataColumn is not found in dataSource then runtime exception occur
                {
                    cBox.Checked = (bool)((DataRowView)container.DataItem)[cBox.Text];
                }
                catch (Exception ex)
                {

                }
                cBox.Text = "";
            }

            // cBox.Text = "";
        }


        /// <summary>
        /// This Event for populating Label Text Template Edit
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lblEdit_DataBinding(object sender, EventArgs e)
        {
            Label lbl = (Label)sender;
            GridEditableItem container = (GridEditableItem)lbl.NamingContainer;
            if (lbl != null && lbl.Text != "")
            {
                try  // User Don't want to Bind this object, then dataColumn is not found in dataSource then runtime exception occur
                {
                    lbl.Text = Convert.ToString(((DataRowView)container.DataItem)[lbl.Text]);
                }
                catch (Exception ex)
                {

                }
            }
        }


        /// <summary>
        /// This event For Binding edit TextBox
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void txtBoxEditDataBinding(object sender, EventArgs e)
        {
            //CustomizeTextBox txtBoxItem = (CustomizeTextBox)sender;
            TextBox txtBoxItem = (TextBox)sender;
            GridEditableItem container = (GridEditableItem)txtBoxItem.NamingContainer;
            if (txtBoxItem != null && txtBoxItem.Text != "")
            {
                try  // User Don't want to Bind this object, then dataColumn is not found in dataSource then runtime exception occur
                {
                    txtBoxItem.Text = Convert.ToString(((DataRowView)container.DataItem)[txtBoxItem.Text]);
                }
                catch (Exception ex)
                {

                }
            }

        }

    }

    [Serializable()]
    public class DropdownDataSource
    {
        public string PageConfigId = "";
        public DataTable DataSource = null;
   

    }

}



Iana Tsolova
Telerik team
 answered on 06 Apr 2010
3 answers
128 views
Can someone tell me Is it a bug or something else? In the picture, the top value is just output by response.write(radtextbox.ClientID) which is different to ie rendered clientid
Dimo
Telerik team
 answered on 06 Apr 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?