Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
81 views

Hi Telerik,

 

We have a grid with an ItemTemplate code that contains a RadComboBox

<telerik:RadComboBox runat="server" ID="RadComboBoxEventNotAttending" Width="155px" CheckBoxes="true" DropDownAutoWidth="Enabled" AutoPostBack="true" EmptyMessage="Select Not Attending" EnableCheckAllItemsCheckBox="true"
    OnItemChecked="RadComboBoxEventNotAttending_ItemChecked" OnCheckAllCheck="RadComboBoxEventNotAttending_CheckAllCheck" OnDataBinding="RadComboBoxEventNotAttending_DataBinding"
    Label='<%# Eval("EventSubId")%>' LabelCssClass="myLabelHide" >
    <Localization AllItemsCheckedString="Family not attending" CheckAllString="Select All" ItemsCheckedString="Member(s) not attending" />
    <CollapseAnimation Type="InExpo" />
    <ExpandAnimation Type="OutExpo" />
    <HeaderTemplate>
        <asp:Label runat="server" Font-Size="8" Text="Not Attending" />
    </HeaderTemplate>
</telerik:RadComboBox>
 

Every Item for the grid could have different drop down items and checks for their respective repeating RadComboBoxes depending on the scenario, which is all handled fine with the OnDataBinding for each record in the grid datasource. When the user checks an item in the dropdown it does a whole postback for the grid. We would like it to only do a postback for the RadComboBox and show a LoadingPanel around the RadComboBox itself instead of showing around the grid.

Our grid is wrapped in a ASP Panel and is used in the RadAjaxManager. The RadComboBox could be wrapped in a ASP Panel and used the same way. We are not sure this is possible for it to be used inside a grid like this.

Could you supply some information or some code snippet for this type of situation?

Thanks!!!

 

Konstantin Dikov
Telerik team
 answered on 23 Sep 2015
1 answer
111 views

HI I have created a Radgrid and added a textbox as a template coloumn, 

When the user presses the ok button i want any values that have been entered into the textbox to be returned

I believe i have code correct on the event of the ok button but i am always returned a Null value. I have looked at a sample of code found here http://kandydeol.blogspot.co.uk/2013/09/fetching-telerik-radgrid-column-and.html

and as far as I can see all is correct,

aspx code :-

 <telerik:RadGrid ID="GRD_OTCOrder" runat="server" AutoGenerateColumns="False" OnItemDataBound="GRD_OTCOrder_ItemDataBound" Culture="en-GB" OnNeedDataSource="GRD_OTCOrder_NeedDataSource" GroupPanelPosition="Top" Width="1173px">
        <MasterTableView TableLayout="Auto">
            <Columns>
                <telerik:GridBoundColumn DataField="TxtName" HeaderText="OTC Name / Type"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Packsize" HeaderText="Pack size" ItemStyle-Width="100px">
                    <ItemStyle Width="100px"></ItemStyle>
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Units" ItemStyle-Width="100px">
                    <ItemStyle Width="100px"></ItemStyle>
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumn HeaderText="Qty Required">
                    <ItemTemplate>
                        <asp:TextBox ID="TB_QTYOrder" runat="server" Width="50px"></asp:TextBox>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn>
                    <ItemTemplate>
                        <telerik:RadComboBox ID="DDL_Reason" runat="server"></telerik:RadComboBox>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn Visible="false">
                    <ItemTemplate>
                        <asp:Label ID="LAB_OTCID" runat="server"></asp:Label>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>

            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
    <telerik:RadButton ID="BTN_Order" runat="server" Text="Place Order" OnClick="BTN_Order_Click"></telerik:RadButton>
    <telerik:RadComboBox ID="DDL_House" runat="server" ></telerik:RadComboBox>

 

and the cs code attached to the ok button

 

protected void BTN_Order_Click(object sender, EventArgs e)
        {

            foreach (GridDataItem data in GRD_OTCOrder.Items)
            {
                //find controls in Grid
                RadComboBox reason = (RadComboBox)data.FindControl("DDL_Reason");
                TextBox qtyre = (TextBox)data.FindControl("TB_QTYOrder");
                Label otc = (Label)data.FindControl("LAB_OTCID");

                //create new OTC Object in memory 
                OTCOrders temp = new OTCOrders();
                temp.House = Convert.ToInt64(DDL_House.SelectedValue);
                temp.OrderBy = Websession.sessionuser.UserID;
                temp.OTCType = Convert.ToInt32(otc.Text);
                if (!string.IsNullOrEmpty(qtyre.Text))
                {
                    temp.QTY = Convert.ToInt32(qtyre.Text);
                }

                temp.BolSent = false;
                temp.BolRec = false;
                temp.SentBy = 0;
                temp.RecBy = 0;
                temp.DteSent = DateTime.Now;
                temp.dterec = DateTime.Now;
                temp.House = Convert.ToInt64(DDL_House.SelectedValue);
                temp.Reason = reason.SelectedValue;
                temp.DteOrdered = DateTime.Now;
                //Save object to database
                    temp.SaveOrder();
                
            }

        }

 

Many Thanks

 

 

Konstantin Dikov
Telerik team
 answered on 23 Sep 2015
8 answers
1.2K+ views
Having some problems.

I just want to add a css class to a text box, I see you guys expose an addCssClass method.
I use it but I think it seems the class isn't getting applied to the correct element?

I have an input called txtInput.

I grab the input in my javascript and add my css: $find('txtInput').addCssClass('invalid');

When I look in firebug or IE dev toolbar I see three elements that represent the input.

txtInput_text
txtInput
txtInput_Value


It looks like the middle one gets the class but that doesn't render the changes I have in my css Class. If I force the class on txtInput_text using firebug or IE dev toolbar I can see my styles properly rendered. What gives?

Edit: In Firefox I need to completely remove all css classes from the txtInput_text element and only apply mine else none of my styles will render...

Edit: And is there a way to ignore the hover over method that alters the css and gets rid of user added css classes?

Edit: Ideally I'd like to have this invalid class take over and apply to enabled, hovered and disabled states. If I use the addCssClass method it only applies to enabled until i hover over, then my class is lost. Is there a way to change disabled and hovered css classes dynamically in javascript? I see a _styles collection with disabled, hovered etc items but it seems to be private.

thanks


//matt

Kostadin
Telerik team
 answered on 23 Sep 2015
6 answers
1.0K+ views

Hello,

We have a in place editable grid with Template columns & with single save button outside the grid. Usually grid consist of monthly dates and I need to update/edit only few dates from it. 

I am looking to find out a way through which i can get only modified rows from grid in my save button handler. I know by default there is no IsDirty flag for RadGridRow so any thoughts around accomplishing this?

Thanks,

Chetan

systems
Top achievements
Rank 1
 answered on 23 Sep 2015
12 answers
516 views
Hi,

I have a rad grid that I am using in place editing/inserting.  In the grid I have a rad color picker.  When in edit mode, when I change the 
color in the rad color picker I change the background color of another column to the color selected.  I am using the OnClientColorChange event of the rad color picker to do this using the following script;
function ColorChangeEdit(sender, eventArgs) {
            var color = sender.get_selectedColor();
            var RadGrid = $find("rgvMainGrid");
            var MasterTable = RadGrid.get_masterTableView();
            var SelectedRows = RadGrid.get_selectedItems();
            if (SelectedRows.length > 0) {
                for (var i = 0; i < SelectedRows.length; i++) {
                    var row = SelectedRows[i];
                    var description = row.findElement("txtEditShortDescription");
                    description.style.backgroundColor = color;
                }
            }
        }

I am trying to implement the same functionality while in insert mode but am having a problem getting the correct reference to the field whose background color I want to change.  I have the following script but I keep getting the error message
Error: 'undefined' is null or not an object and it points to the line ...

var description = row.findElement("txtInsertShortDescription");

So my question is, how do I reference a particular cell from the insert record.

Thank you for your help.

Tracy




function ColorChangeInsert(sender, eventArgs) {
           var color = sender.get_selectedColor();
           var RadGrid = $find("<%= rgvMainGrid.ClientID %>");
           var MasterTable = RadGrid.get_masterTableView();
           var insertRow = MasterTable.get_insertItem();
           var row = insertRow[0];
           var description = row.findElement("txtInsertShortDescription");
           description.style.backgroundColor = color;
       }


Jayesh Goyani
Top achievements
Rank 2
 answered on 22 Sep 2015
1 answer
438 views

Hello,
I want to set the a navigation URL of  ​a GridHyperLinkColumn to a value with query string which is the date selected from a radatepicker

I tried using the embedded C# code method using <% %> but it didn't show me any love, it just posted the plain text in the URL including the <% %> enclosing marks

I would like to know if there's a way to set this in the code behind link in the onload event or something

Daniel
Telerik team
 answered on 22 Sep 2015
2 answers
370 views
Is it possible to individually align a filter textbox?  My grid has a numeric column that is right aligned for the items and all other columns are left aligned.  The filter box is left aligned and looks like it belongs to a different column.
I realise I can change the alignment of all filter boxes using the FilterItemStyle property but I only want to change the alignment of a single box.

Israel
Top achievements
Rank 1
 answered on 22 Sep 2015
1 answer
101 views

Hi

 

I'm working on a site that users use to capture schedules into a database. There is a page that contains the Scheduler control which the users can use to view all of these schedules. I'm trying to load them from the database and on the server side build the recurrences of these schedules using the RecurrencePattern class.

 

My problem that I'm facing is that the site's own scheduling page closely follows Windows Task Scheduler, in the sense that you can create a schedule that run for any specified months on any selected day of the month. I have cone over the Telerik Scheduler documentation and it seems to me that you can only specify a recurrence to run on one day of the month.

 

Is there anyway to get around this or am I just missing something?

 

Thanks!

Plamen
Telerik team
 answered on 22 Sep 2015
1 answer
78 views

aspx page-
 
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <telerik:RadAjaxLoadingPanel runat="server" ID="LoadingPanel1" Skin="MetroTouch">
        </telerik:RadAjaxLoadingPanel>
        <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" >
            <AjaxSettings>
                 <telerik:AjaxSetting AjaxControlID="rdComboFrameworklist">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Panel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="RadTabStrip2">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadTabStrip2"></telerik:AjaxUpdatedControl>
                        <telerik:AjaxUpdatedControl ControlID="Panel1" ></telerik:AjaxUpdatedControl>
                    </UpdatedControls>
                </telerik:AjaxSetting>
                
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <%--<script type="text/javascript">
            /* <![CDATA[ */
            function onTabSelecting(sender, args) {
 
                if (args.get_tab().get_pageViewID()) {
                    args.get_tab().set_postBack(false);
                }
            }
            /* ]]> */
        </script>--%>
        <div id="example" style="width:98%; margin:0 auto;">
            <div class="demo-content">
       <%-- <telerik:RadTabStrip OnClientTabSelecting="onTabSelecting" ID="RadTabStrip1" SelectedIndex="0"
            runat="server" MultiPageID="RadMultiPage1" Skin="MetroTouch" Width="100%" Align="Justify"
            OnTabClick="RadTabStrip1_TabClick">
        </telerik:RadTabStrip>
        <telerik:RadMultiPage ID="RadMultiPage1" CssClass="RadMultiPage" runat="server" SelectedIndex="0" OnPageViewCreated="RadMultiPage1_PageViewCreated">
        </telerik:RadMultiPage>--%>
                  <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1"  CssClass="div-container no-bg" LoadingPanelID="RadAjaxLoadingPanel1">
 
     <telerik:RadTabStrip ID="RadTabStrip2" Width="100%"   Orientation="HorizontalTop" CssClass="RadTabStrip_SkinSlik" OnTabClick="RadTabStrip2_TabClick"  runat="server" AutoPostBack="True" >
 <Tabs>
   
        <telerik:RadTab runat="server" Value="0" Text="Perspective Weightings"  Selected="true" />
        <telerik:RadTab runat="server"  Value="1" Text="Rating Model"  />
        
     </Tabs>
    
</telerik:RadTabStrip>
     <asp:Panel ID="Panel1" runat="server" CssClass="multiPage"    Width="100%">
        </asp:Panel>
                      </telerik:RadAjaxPanel>
 </div>
            </div>
</asp:Content>
 
 
aspx.cs
 
 protected void Page_Load(object sender, EventArgs e)
        {
            
            String ctrlStr = "";
             
                //Load a control on each page load
                if (ViewState["LoadedControl"] == null)
                {
                    Control control = LoadControl("~/UserControls/PerspectiveWeightingsControl.ascx");
                    ctrlStr = "~/UserControls/PerspectiveWeightingsControl.ascx";
                    //It's important to set it an ID!
                    control.ID = ctrlStr;
                    Panel1.Controls.Add(control);
                    
                }
                else
                {
                    
                    ctrlStr = ViewState["LoadedControl"].ToString();
                    Control control = LoadControl(ViewState["LoadedControl"].ToString());
                    //It's important to set it an ID!
                    control.ID = ctrlStr;
                    Panel1.Controls.Add(control);
                }
                    
                
 
                 
             
         
        }
 
        protected void RadTabStrip2_TabClick(object sender, RadTabStripEventArgs e)
        {
            String ctrlID = null;
 
            switch (e.Tab.Value)
            {
                case "0":
                    ctrlID = "~/UserControls/PerspectiveWeightingsControl.ascx";
                    break;
 
                case "1":
                    ctrlID = "~/UserControls/SurveyRatingModelControl.ascx";
 
                    //The timer is going to start ticking, once its control is loaded
                    //Session["Ticks"] = 0;
                    break;
            }
 
            //Load the corresponding control
            UserControl control = (UserControl)LoadControl(ctrlID);
 
            //It's important to set it an ID!
            control.ID = ctrlID.Replace('/', '_');
 
            //Clear panel controls and add the newly loaded control
            Panel1.Controls.Clear();
            Panel1.Controls.Add(control);
 
            //Save which control is loaded
            ViewState["LoadedControl"] = ctrlID;
        }
 
         
    }
}
 
------------
user control - perspectiveweighting
 
<telerik:RadGrid ID="gridPerspectiveWeighting" AllowPaging="True"  PageSize="10" OnNeedDataSource="gridPerspectiveWeighting_NeedDataSource" OnItemCommand="gridPerspectiveWeighting_ItemCommand" OnItemCreated="gridPerspectiveWeighting_ItemCreated" OnDeleteCommand="gridPerspectiveWeighting_DeleteCommand" OnInsertCommand="gridPerspectiveWeighting_InsertCommand" OnUpdateCommand="gridPerspectiveWeighting_UpdateCommand" OnItemDataBound="gridPerspectiveWeighting_ItemDataBound" AllowSorting="true" runat="server">
  <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
             <ExportSettings ExportOnlyData="true" HideStructureColumns="true" OpenInNewWindow="true" IgnorePaging="true"></ExportSettings>
            <MasterTableView EditMode="InPlace"  CommandItemDisplay="Top" CommandItemSettings-ShowRefreshButton="false" DataKeyNames="Id"  AutoGenerateColumns="false" InsertItemDisplay="Top"
                InsertItemPageIndexAction="ShowItemOnFirstPage" >
                 <CommandItemSettings ShowExportToCsvButton="true" ShowExportToExcelButton="true" ShowExportToPdfButton="true" ShowExportToWordButton="true" />
    <Columns>
      <telerik:GridBoundColumn HeaderText="ID" DataField="Id" ReadOnly="True"
        UniqueName="Id" Display="False">
      </telerik:GridBoundColumn>
 
        <telerik:GridBoundColumn HeaderText="PerspectiveCategoryId" DataField="PerspectiveCategoryId" ReadOnly="True"
        UniqueName="PerspectiveCategoryId" Display="False">
      </telerik:GridBoundColumn>
          
        <telerik:GridTemplateColumn UniqueName="PerspectiveCategoryId" HeaderText="Perspective Category">
            <HeaderStyle Width="160px"  />
            <ItemStyle  Width="160px" />
             
                <ItemTemplate>
                    <asp:Label  ID="lblPerspectiveCategory" runat="server"
                        Text='<%# DataBinder.Eval(Container.DataItem, "PerspectiveCategoryName") %>'>
                    </asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <telerik:RadDropDownList ID="ddlPerspectiveCategory" ListTextField="PCName"  ListValueField="ID" runat="server"></telerik:RadDropDownList>
                     <asp:Label ID="lbleditPerspectiveCategory" runat="server" Text='<%# Eval("PerspectiveCategoryId")%>' Visible="false"></asp:Label>
                </EditItemTemplate>
            </telerik:GridTemplateColumn>
         
     <%-- <telerik:GridBoundColumn HeaderText="Perspective"   ItemStyle-Width="150px"   DataField="PerspectiveName" UniqueName="PerspectiveName">
           <HeaderStyle Width="150px" />
      </telerik:GridBoundColumn>--%>
         <telerik:GridTemplateColumn HeaderText="Perspective"  HeaderStyle-Width="150px" ItemStyle-Width="150px" UniqueName="PerspectiveName" SortExpression="PerspectiveName" DataField="PerspectiveName">
                     
                        
                        <ItemTemplate>
                        
                            <%# Eval("PerspectiveName") %>
                        </ItemTemplate>
                        <EditItemTemplate>
                           <telerik:RadTextBox ID="txtEditPerspectiveName" runat="server" Width="150px" TextMode="SingleLine" Text=<%# Eval("PerspectiveName") %>></telerik:RadTextBox>
                        </EditItemTemplate>
             <InsertItemTemplate>
                           <telerik:RadTextBox ID="txtPerspectiveName" runat="server" Width="150px" TextMode="SingleLine" ></telerik:RadTextBox>
 
             </InsertItemTemplate>
                    </telerik:GridTemplateColumn>
         <%--  <telerik:GridBoundColumn HeaderText="Perspective Type" ItemStyle-Width="150px"  DataField="PerspectiveType" UniqueName="PerspectiveType">
           <HeaderStyle Width="150px" />
      </telerik:GridBoundColumn>--%>
 
           <telerik:GridTemplateColumn HeaderText="Perspective Code"  HeaderStyle-Width="150px" ItemStyle-Width="150px" UniqueName="PerspectiveType" SortExpression="PerspectiveType" DataField="PerspectiveType">
                     
                        
                        <ItemTemplate>
                        
                            <%# Eval("PerspectiveType") %>
                        </ItemTemplate>
                        <EditItemTemplate>
                           <telerik:RadTextBox ID="txtEditPerspectiveType" runat="server" Width="150px" TextMode="SingleLine" Text=<%# Eval("PerspectiveType") %>></telerik:RadTextBox>
                        </EditItemTemplate>
             <InsertItemTemplate>
                           <telerik:RadTextBox ID="txtPerspectiveType" runat="server" Width="150px" TextMode="SingleLine" ></telerik:RadTextBox>
 
             </InsertItemTemplate>
                    </telerik:GridTemplateColumn>
   <telerik:GridNumericColumn DataField="Weight" DataFormatString="{0:0}" HtmlEncode="false" HeaderText="Weight" SortExpression="Weight"
                        UniqueName="Weight">
                        <HeaderStyle Width="150px" />
         
                    </telerik:GridNumericColumn>
 <%--<telerik:GridTemplateColumn UniqueName="Weight" HeaderText="Weight">
        <HeaderStyle Width="150px"  />
            <ItemStyle  Width="150px" />
      <ItemTemplate>
                    <asp:Label ID="lblWeight" runat="server"
                        Text='<%# DataBinder.Eval(Container.DataItem, "Weight") %>'>
                    </asp:Label>
                </ItemTemplate>
     <EditItemTemplate>
         <telerik:RadNumericTextBox runat="server" ID="txtWeight" DisplayText='<%# DataBinder.Eval(Container.DataItem, "Weight") %>'  DataField="Weight" DataFormatString="{0:0}" HtmlEncode="false" HeaderText="Weight" SortExpression="Weight"
                        UniqueName="Weight"></telerik:RadNumericTextBox>
           <asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="Invalid input"
  ControlToValidate="txtWeight" OnServerValidate="CustomValidator1_ServerValidate">
</asp:CustomValidator>
         </EditItemTemplate>
 </telerik:GridTemplateColumn>--%>
        <telerik:GridEditCommandColumn UniqueName="EditColumn" ButtonType="ImageButton" HeaderText="Edit">
                        <HeaderStyle Width="70px" />
                    </telerik:GridEditCommandColumn>
         <telerik:GridButtonColumn ConfirmText="Delete this Item?" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"  UniqueName="DeleteColumn" HeaderText="Delete">
                        <HeaderStyle Width="70px" />
                    </telerik:GridButtonColumn>
    </Columns>
  </MasterTableView>
</telerik:RadGrid>
        <table style="height:30px;">
              <tr id="trAlert" runat="server">
             <td><span runat="server" id="spAlert" class="blink_me" style="color:red;text-align:right;font-weight:bold"><asp:Label ID="lblerror" runat="server"></asp:Label></span></td>
              
         </tr>
        </table>
       <%-- </telerik:RadAjaxPanel>--%>
    <%--<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function onRequestStart(sender, args) {
                if (args.get_eventTarget().indexOf("Button") >= 0) {
                    args.set_enableAjax(false);
                }
            }
        </script>
    </telerik:RadCodeBlock>--%>
    </div>
 
 
---------------
SurveyRatingModel.ascx
 
 
<div style="padding:0px 10px 10px;">
    <div style="text-align:center;font-family:Arial;font-weight:bold;">
        <h5>Rating Model</h5>
    </div>
    
    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
  <script type="text/javascript">
      var popUp;
      function PopUpShowing(sender, eventArgs) {
          popUp = eventArgs.get_popUp();
          var gridWidth = sender.get_element().offsetWidth;
          var gridHeight = sender.get_element().offsetHeight;
          var popUpWidth = popUp.style.width.substr(0, popUp.style.width.indexOf("px"));
          var popUpHeight = popUp.style.height.substr(0, popUp.style.height.indexOf("px"));
          popUp.style.left = ((gridWidth - popUpWidth) / 2 + sender.get_element().offsetLeft).toString() + "px";
          popUp.style.top = ((gridHeight - popUpHeight) / 2 + sender.get_element().offsetTop).toString() + "px";
      }
  </script>
 
</telerik:RadScriptBlock>
  <telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">
        <script type="text/javascript">
            function RowDblClick(sender, eventArgs) {
                sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
            }
        </script>
    </telerik:RadScriptBlock>
   
          <telerik:RadWindowManager ID="RadWindowManager1" runat="server" ></telerik:RadWindowManager>
 <%-- <telerik:RadAjaxManagerProxy ID="AjaxManagerProxySurvey"  runat="server">
      <AjaxSettings>
      <telerik:AjaxSetting AjaxControlID="gridRatingModel" >
            <UpdatedControls>
                
                      <telerik:AjaxUpdatedControl ControlID="gridRatingModel"/>
                  
            </UpdatedControls>
        </telerik:AjaxSetting>
           </AjaxSettings>
</telerik:RadAjaxManagerProxy>--%>
   <%-- <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"></telerik:RadAjaxLoadingPanel>--%>
    <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1"  CssClass="div-container no-bg" >
       
     <telerik:RadGrid ID="gridRatingModel" AllowPaging="True" PageSize="5"  OnNeedDataSource="gridRatingModel_NeedDataSource" OnItemCommand="gridRatingModel_ItemCommand" OnItemCreated="gridRatingModel_ItemCreated" OnDeleteCommand="gridRatingModel_DeleteCommand" OnInsertCommand="gridRatingModel_InsertCommand" OnUpdateCommand="gridRatingModel_UpdateCommand" OnItemDataBound="gridRatingModel_ItemDataBound" AllowSorting="true" runat="server">
            <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
            <ClientSettings>
                <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true" FrozenColumnsCount="2"></Scrolling>
                 
            </ClientSettings>
             <ClientSettings>
                <ClientEvents OnRowDblClick="RowDblClick"></ClientEvents>
            </ClientSettings>
           
            <ExportSettings ExportOnlyData="true" HideStructureColumns="true" OpenInNewWindow="true" IgnorePaging="true"></ExportSettings>
            <MasterTableView EditMode="EditForms" CommandItemDisplay="Top" CommandItemSettings-ShowRefreshButton="false" DataKeyNames="ID" AutoGenerateColumns="false" InsertItemDisplay="Top"
                InsertItemPageIndexAction="ShowItemOnFirstPage" >
                <CommandItemSettings ShowExportToCsvButton="true" ShowExportToExcelButton="true" ShowExportToPdfButton="true" ShowExportToWordButton="true" />
          
                <Columns>
                      
                     
                    <telerik:GridBoundColumn HeaderText="ID" DataField="ID"  ReadOnly="True"
                        UniqueName="ID" Display="False">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn HeaderText="SubPerspectiveID"  DataField="SubPerspectiveID" ReadOnly="True"
                        UniqueName="SubPerspectiveID" Display="false">
                    </telerik:GridBoundColumn>
 
 
   <telerik:GridBoundColumn HeaderText="Perspective Category" ItemStyle-Width="100px"  DataField="ModelType" UniqueName="ModelType">
                        <HeaderStyle Width="100px" />
                    </telerik:GridBoundColumn>
 
      <telerik:GridBoundColumn HeaderText="Perspective" ItemStyle-Width="100px" DataField="PerpectiveClass" UniqueName="PerpectiveClass">
                        <HeaderStyle Width="100px" />
                    </telerik:GridBoundColumn>
                   
                    <telerik:GridBoundColumn HeaderText="Sub Perspective"  DataField="HintSubPerspective" Display="false" UniqueName="HintExport">
                        <HeaderStyle Width="100px" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn HeaderText="Question"   DataField="Question" Display="false" UniqueName="QuestionExport">
                        <HeaderStyle Width="150px" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn HeaderText="Sub Perspective" ItemStyle-Width="100px"  DataField="HintSubPerspective" UniqueName="Hint">
                        <HeaderStyle Width="100px" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn HeaderText="Question" ItemStyle-Width="150px"  DataField="Question" UniqueName="Question">
                        <HeaderStyle Width="150px" />
                    </telerik:GridBoundColumn>
                     <telerik:GridBoundColumn HeaderText="DefaultComment" ItemStyle-Width="150px"  DataField="DefaultComment" UniqueName="DefaultComment">
                        <HeaderStyle Width="150px" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn HeaderText="Subperspective Type" Display="false"  DataField="SubperspectiveType" UniqueName="SubperspectiveType">
                    </telerik:GridBoundColumn>
                   
                          <telerik:GridBoundColumn HeaderText="Weighting" HeaderStyle-Width="100px"     DataField="Weighting" UniqueName="Weighting">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn HeaderText="Rating Factor 1" ItemStyle-Width="100px" DataField="RatingFactor1" UniqueName="RatingFactor1">
                        <HeaderStyle Width="70px" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn HeaderText="Rating Factor 2" ItemStyle-Width="150px" DataField="RatingFactor2" UniqueName="RatingFactor2">
                        <HeaderStyle Width="70px" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn HeaderText="Rating Factor 3" ItemStyle-Width="150px" DataField="RatingFactor3" UniqueName="RatingFactor3">
                        <HeaderStyle Width="70px" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn HeaderText="Rating Factor 4" ItemStyle-Width="150px" DataField="RatingFactor4" UniqueName="RatingFactor4">
                        <HeaderStyle Width="70px" />
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn HeaderText="Rating Factor 5" ItemStyle-Width="150px" DataField="RatingFactor5" UniqueName="RatingFactor5">
                        <HeaderStyle Width="70px" />
                    </telerik:GridBoundColumn>
                   
                      <telerik:GridEditCommandColumn UniqueName="EditColumn" ButtonType="ImageButton" HeaderText="Edit">
                        <HeaderStyle Width="70px" />
                    </telerik:GridEditCommandColumn>
                    <telerik:GridButtonColumn ConfirmText="Delete this Perspective?" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn" HeaderText="Delete">
                        <HeaderStyle Width="70px" />
                        <ItemStyle Width="70px" />
                    </telerik:GridButtonColumn>
                </Columns>
                <EditFormSettings EditFormType="Template">
                    <FormTemplate>
                        <table id="Table2" cellspacing="2" cellpadding="1" width="100%" border="0" rules="none"
                            style="border-collapse: collapse;">
                            <tr class="EditFormHeader">
                                  
          <td align="left"  >
                                    <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Save" : "Save" %>'
                                        runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'></asp:Button
                                    <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                        CommandName="Cancel"></asp:Button>
                                </td>
    
                                <td></td>
                                <td></td>
                            </tr>
                            <tr>
                                <td>
                                    <table id="Table3" width="400px" border="0" class="module">
                                       
                                        <tr style="height:40px">
                                            <td class="txtright">Perspective Category:
                                            </td>
                                            <td>
                                              
                                                <telerik:RadDropDownList ID="ddlPerspectiveCategory" runat="server" OnSelectedIndexChanged="ddlPerspectiveCategory_SelectedIndexChanged"  AutoPostBack="true"
                                                    
                                                     TabIndex="7"
                                                    />
                                                   <asp:HiddenField ID="hiddenPerspectiveCateory" runat="server" Value='<%# DataBinder.Eval(Container.DataItem, "ModelType") %>' />
                                            </td>
                                        </tr>
                                        <tr style="height:40px">
                                            <td class="txtright">Perspective:
                                            </td>
                                            <td>
                                                <telerik:RadDropDownList ID="ddlPerpectiveClass" runat="server"  OnSelectedIndexChanged="ddlPerpectiveClass_SelectedIndexChanged" AutoPostBack="true"
                                                    
                                                     TabIndex="8"
                                                   />
                                                <asp:HiddenField ID="hiddenPerspectiveClass" runat="server" Value='<%# Bind("PerpectiveClass") %>' />
                                            </td>
                                        </tr>
                                        <tr style="height:40px">
                                            <td class="txtright">Sub-Perspective:
                                            </td>
                                            <td>
                                                <telerik:RadTextBox  ID="txtHint" runat="server" Text='<%# Bind("Hint") %>' TextMode="MultiLine" TabIndex="2" Rows="2" Columns="40"></telerik:RadTextBox>
                                                 
                                            </td>
                                        </tr>
                                        <tr style="height:40px;">
                                            <td rowspan="2" class="txtright">Question:
                                            </td>
                                            <td rowspan="2" >
                                                  <telerik:RadTextBox  ID="TextBox5" Text='<%# Bind("Question") %>' runat="server" TextMode="MultiLine"
                                                    Rows="5" Columns="40" TabIndex="6">
                                                </telerik:RadTextBox>
                                                 <asp:HiddenField ID="SubPerspectiveID" runat="server" Value='<%# Bind("SubPerspectiveID") %>' />
                                            </td>
                                        </tr>
                                       
                                        
                                      
                                         <tr>
                                <td colspan="2"></td>
                            </tr>
                          
                            
                                    </table>
                                </td>
                                 
                                <td style="vertical-align: top">
 <table id="Table4" cellspacing="1" cellpadding="1" width="450px" border="0" class="module">
      
                                         <tr style="height:40px">
                                            <td class="txtright" >Weight:
                                            </td>
                                            <td>
                                                <telerik:RadNumericTextBox ID="txtWeighting" Text='<%# Bind( "Weighting") %>' runat="server" TabIndex="5" ></telerik:RadNumericTextBox>
                                              
                                            </td>
                                        </tr>
       <tr style="height:40px">
                                            <td class="txtright">Perspective Code:
                                            </td>
                                            <td>
                                                <telerik:RadTextBox ID="txtSubperspectiveType" Enabled="false" ReadOnly="true" Text='<%# Bind( "SubperspectiveType") %>' runat="server" TabIndex="9">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
 
       <tr style="height:40px">
                                            <td class="txtright">Sub-Perspective Code:
                                            </td>
                                            <td>
                                                <telerik:RadTextBox ID="txtSubperspectiveCode" Enabled="false" ReadOnly="true" Text='<%# Bind( "SubPerspectiveID") %>' runat="server" TabIndex="9">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
      <tr style="height:40px;">
                                            <td  class="txtright">Default Comment:
                                            </td>
                                            <td >
                                                  <telerik:RadTextBox  ID="RadTextBox1" Text='<%# Bind("DefaultComment") %>' runat="server" TextMode="MultiLine"
                                                    Rows="4" Columns="40" TabIndex="6">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                       
 
     </table>
                                </td>
                                <td style="vertical-align: top">
                                    <table id="Table1" cellspacing="1" cellpadding="1" width="350px" border="0" class="module">
                                        <tr style="height:40px">
                                            <td class="txtright">Rating 1:
                                            </td>
                                        
                                            <td>
                                                <telerik:RadTextBox ID="TextBox1" Text='<%# Bind("RatingFactor1") %>' runat="server" TextMode="MultiLine"
                                                    Rows="2" Columns="40" TabIndex="4">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                        <tr style="height:40px">
                                            <td class="txtright">Rating 2:
                                            </td>
                                        
                                            <td>
                                                <telerik:RadTextBox ID="TextBox6" Text='<%# Bind("RatingFactor2") %>' runat="server" TextMode="MultiLine"
                                                    Rows="2" Columns="40" TabIndex="3">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                        <tr style="height:40px">
                                            <td class="txtright">Rating 3:
                                            </td>
                                        
                                            <td>
                                                <telerik:RadTextBox ID="TextBox2" Text='<%# Bind("RatingFactor3") %>' runat="server" TextMode="MultiLine"
                                                    Rows="2" Columns="40" TabIndex="2">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                        <tr  style="height:40px">
                                            <td class="txtright">Rating 4:
                                            </td>
                                         
                                            <td>
                                                <telerik:RadTextBox ID="TextBox3" Text='<%# Bind("RatingFactor4") %>' runat="server" TextMode="MultiLine"
                                                    Rows="2" Columns="40" TabIndex="1">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                        <tr style="height:40px">
                                            <td class="txtright">Rating 5:
                                            </td>
                                        
                                            <td>
                                                <telerik:RadTextBox ID="TextBox4" Text='<%# Bind("RatingFactor5") %>' runat="server" TextMode="MultiLine"
                                                    Rows="2" Columns="40" TabIndex="10">
                                                </telerik:RadTextBox>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        
                        </table>
                    </FormTemplate>
                </EditFormSettings>
            </MasterTableView>
        </telerik:RadGrid>
         <table style="height:30px;">
              <tr id="trAlert" runat="server">
             <td colspan="4"><span runat="server" id="spAlert" class="blink_me" style="color:red;text-align:right;font-weight:bold"><asp:Label ID="lblerror" runat="server"></asp:Label></span></td>
              
         </tr>
        </table>
    </telerik:RadAjaxPanel>
    <%--<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function onRequestStart(sender, args) {
                if (args.get_eventTarget().indexOf("Button") >= 0) {
                    args.set_enableAjax(false);
                }
            }
        </script>
    </telerik:RadCodeBlock>--%>
          
</div>
I am using radtabstrip in aspx page.and using panel to load control in the tabstrip to avoid all tabs to be loaded everytime.

now, within each tab, i have grids (user controls) with add/edit/delete.

i am able to manage dynamic load of controls but when i click add/edit/delete, nothing happens until i click 3 times. i see its going in to code but only 3rd time it goes to itemdatabound and that time only i can do add/edit/delete. however, once i enter the data save it and then again i add/edit, i can do it with one click only.no need to click multiple times for the same tab. if i change the tab,again i have to click 3 times.

why? and how to fix it?

i am attaching the code as well as video. please help.

http://screencast.com/t/aY5tEcz1QUeT​

Konstantin Dikov
Telerik team
 answered on 22 Sep 2015
1 answer
159 views

Hi,

I have a RadGrid in my page with "EnableHeaderContextMenu" set to true. 

 

I want to change the texts for the columns in the HeaderContextMenu.

With an older telerik version the code snippet below the function was working, now with the latest Version 2015.2.826.45 it doesn't work anymore.  

 

this.GridView.HeaderContextMenu.ItemClick += this.pContextMenu_ItemClick;

 

void HeaderContextMenu_PreRender(object sender, EventArgs e)
        {
            // Correct the column names for Context Menue
            Telerik.Web.UI.GridHeaderContextMenu pContextMenue = sender as Telerik.Web.UI.GridHeaderContextMenu;
            Telerik.Web.UI.RadMenuItem pColumnsContextMenu = pContextMenue.FindChildByValue<Telerik.Web.UI.RadMenuItem>("ColumnsContainer", true);
 
            foreach (Telerik.Web.UI.RadMenuItem pItem in pColumnsContextMenu.Items)
            {
                pItem.Text = _Regex.Replace(pItem.Text, String.Empty);
            }
        }

 

Kindly help us in solving this issue.

Regards, 

Miriam

Konstantin Dikov
Telerik team
 answered on 22 Sep 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?