Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
484 views

Greetings, if I want to augment the functionality of one of the Telerik javascript "classes", is there a proper way to override a function such that my change will be applied after the initial Telerik js declarations/file references, but before the $create() function calls which use the classes that are being modified?

For instance, I'd like to tweak the "initialize" function in the WebServiceRenderingManager class. So at some point after WebServiceRenderingManager is declared by the Telerik js script I want to update the prototype for it: 

$(function () {
    var $tsr = Telerik.Web.UI.Scheduler.Rendering;
    var $wsrm = $TSR.WebServiceRenderingManager;
    $wsrm.prototype.initialize = function () {
        // my custom code would go here
        $tsr.WebServiceRenderingManager.callBaseMethod(this, 'initialize');
    };
});

Is there a standard way/place to include my code above so that it will run after the initial WebServiceRenderingManager prototype is defined, but before the client-side code executes that initializes the control instances ($create(Telerik.Web.UI.RadScheduler, {...});)? Is there a best practice for this? 

Btw, I only need to do this for a particular aspx page, not globally for my entire site.

Thanks in advance!

 

Plamen
Telerik team
 answered on 25 Sep 2015
2 answers
42 views

hi

how  Get valor of RowSelected
example in gridview (traditional)

 

Protected Sub GridView1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles gvUsuario.SelectedIndexChanged

 'Here Code!!!!!!!

        Dim x as String

        Dim row As GridViewRow
        row = gvUsuario.SelectedRow
        ​x = gvUsuario.SelectedRow.Cells(1).Text
        MsgBox(x)

    End Sub

 

with RadGrid1 how would it be?

 

sorry my english

 

 

Nagiza
Top achievements
Rank 1
 answered on 25 Sep 2015
3 answers
250 views

Dear Telerik team I request you to please help me in resolving below issue as I am not much familiar with Telerik and Sharepoint environment. I posted my issue in other forums too but did not got any solution.

There is a "RadGrid" inside which there is a "RadComboBox" and a "asp:Button" next to it.
This RadGrid is NOT ​​inside "RadAjaxPanel" due to some reason.
When user key-in any text in RadComboBox and click on Button, only then the searching (related to key-in text) is started in RadComboBox and displayed in a DropDownList.

Now, when user type/key-in any text in RadComboBox and click on Button, then the related data binds to DropDownList of RadcomboBox but the DropDownList appears to stick at the bottom of the page and the whole page scroll shifts to half of the page.
and When I click outside of DropDownList then page becomes normal & DropDownList get closed. 

Please let me know why is this happening when I DONOT put RadGrid inside RadAjaxPanel ?

Below is the code I am using so far:

<telerik:RadMultiPage ID="RadMultiPage6" runat="server" SelectedIndex="0" Width="100%">
    <telerik:RadPageView ID="RadPageView5" runat="server" Width="100%">                                                                            
    <%--<telerik:RadAjaxPanel ID="RadAjaxPanel5" runat="server">--%>
        <telerik:RadGrid ID="RGGSTAcCode" runat="server" AutoGenerateColumns="false" 
           ShowFooter="True" GroupingEnabled="False" ShowStatusBar="true"        
           AllowAutomaticInserts="False" AllowAutomaticUpdates="False" AllowAutomaticDeletes="true"
           OnNeedDataSource= "rggstAcCode_NeedDataSource" OnItemDataBound="rggstAcCode_ItemDataBound"                   
           OnInsertCommand="rggstAcCode_InsertCommand" OnDeleteCommand="rggstAcCode_DeleteCommand"
           OnUpdateCommand="rggstAcCode_UpdateCommand" EnableEmbeddedSkins="true" Skin="Outlook">
 
        <mastertableview commanditemdisplay="Top" autogeneratecolumns="false" datakeynames="AccountCodeID"
           insertitempageindexaction="ShowItemOnCurrentPage" ShowFooter="True" ShowHeadersWhenNoRecords="true">
 
           <CommandItemSettings AddNewRecordText="New" />
             <Columns>
                <telerik:GridEditCommandColumn UniqueName="imagebutton1" ButtonType="ImageButton"></telerik:GridEditCommandColumn>
 
                <telerik:GridTemplateColumn UniqueName="AccountCode" HeaderText="Account Code">
                  <ItemTemplate>
                     <asp:Label ID="lblAcCode" Text='<%# Eval("AccountCode") %>' runat="server"></asp:Label>
                  </ItemTemplate>
                  <EditItemTemplate>
                     <asp:Label ID="lblAcCode2" runat="server" Text='<%# Eval("AccountCode") + " - " + Eval("AccountDescription")%>' Visible="false"></asp:Label>
 
                     <telerik:RadComboBox ID="ddlAccountCode" runat="server" Height="200" Width="260" DropDownWidth="310"      
                       EnableLoadOnDemand="True" OnItemsRequested="ddlAccountCode_ItemsRequested" EnableItemCaching="true" 
                       ShowMoreResultsBox="True" EnableVirtualScrolling="true" AllowCustomText="true" MarkFirstMatch="true"
                       Filter="Contains" HighlightTemplatedItems="true" CausesValidation="true" AppendDataBoundItems="true"
                       DataTextField="AccountDescription" DataValueField="AccountCodeID"
                       ShowDropDownOnTextboxClick="false"
                       OnClientDropDownOpening="OnClientDropDownOpening" OnClientItemsRequested="OnClientItemsRequested">                                   
                     </telerik:RadComboBox>             
 
                     <asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click" OnClientClick="ButtonClicked()" UseSubmitBehavior="true" /> 
                  </EditItemTemplate>
                </telerik:GridTemplateColumn>
                //Other columns
             </Columns>
 
             <EditFormSettings>
                <EditColumn ButtonType="ImageButton" />
             </EditFormSettings>
             <PagerStyle AlwaysVisible="True" PageSizeControlType="RadComboBox" />
        </mastertableview>
        </telerik:RadGrid>
    <%--</telerik:RadAjaxPanel>--%>
    </telerik:RadPageView>                                                                        
    </telerik:RadMultiPage>

 

<script>
//disable opening of RadCombo dropdown when click on left image of dropdown
function OnClientDropDownOpening(sender, args) {
if (sender.get_items().get_count() == 0 || sender.get_text() == "") {
    args.set_cancel(true);
    }
}
//hide RadCombo dropdown If the text area is blank
function OnClientItemsRequested(sender, eventArgs) {
if (sender.get_items().get_count() < 1 || sender.get_text() == "")
    sender.hideDropDown();
}
</script>​

 

protected void ddlAccountCode_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
    {
        Session["Text"] = e.Text;
        Session["NumberOfItems"] = e.NumberOfItems;
 
        RadComboBox combo = (RadComboBox)sender;
        combo.ShowDropDownOnTextboxClick = false;
        combo.Items.Clear();
        combo.HighlightTemplatedItems = true;
    }
 
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        try
        {
            GridEditableItem editedItem = (sender as Button).NamingContainer as GridEditableItem;
 
            RadComboBox combo = (RadComboBox)editedItem.FindControl("ddlAccountCode");
            //clear the previous items on every new search
            combo.Items.Clear();
            combo.OpenDropDownOnLoad = true; // opens dropdown of RadComboBox on button click
            combo.HighlightTemplatedItems = true; // to highlight the searched text
 
            //Code related to search in RadComboBox
            combo.DataBind();
        }
        catch (Exception ex)
        {
        }
    }

 Please note that I am using Sharepoint in my application.

I tried all possible ways to solve this issue like: 

1.  MaintainScrollPositionOnPostback="true"

2. Setting the RadGrid scroll position in ClientSettings tag

3. used few javascript code 

but nothing worked in my scenario. Please somebody help me, I am facing this issue since long and I have to complete it at the soonest.

Thanks in advance.

 

 

Priyanka
Top achievements
Rank 1
 answered on 25 Sep 2015
5 answers
125 views

Hi All,

Let me start off by saying I am a noob when it comes to using asp.net and telerik. With that being said I am having an issue updating the headers of the rad grid. When I run the application in Visual Studio the headers are correct, however when I build the solution and run the application on the internet the headers still reflect the old text (before the text change).The  application in question was built by someone else using asp.net, c#, javascript, ajax, etc. I am pretty sure the version of telerik used originally is much older than the version I am using today which is the most current version as of 9/15/15 . I should also mention there are two versions of the application one being used now by employees and one I am working on a development sever. The header text that should be changed should be both the Approval and Status text.

I added two images below to show you what the app looks like in visual studio vs what it looks when run on the internet.

 Code ASCX:

<telerik:RadGrid ID="HistoryCard" runat="server" OnNeedDataSource="HistoryCard_NeedDataSource" OnItemDataBound="HistoryCard_ItemDataBound">
 
        <MasterTableView AutoGenerateColumns="false">
                    <Columns>
                        <telerik:GridBoundColumn HeaderText="Due Date" DataField="due_date" DataFormatString="{0:MM/dd/yyyy}" />
                        <telerik:GridBoundColumn HeaderText="Inspection Dates" DataField="inspection_date" DataFormatString="{0:MM/dd/yyyy}" />
            <telerik:GridTemplateColumn HeaderText="Status" UniqueName="Status">
                            <ItemTemplate>
                                <%# Common.EquipmentStatus.GetLabel(Eval("current_use")) %>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn HeaderText="Approval" UniqueName="Approval">
                            <ItemTemplate>
                                <%# Common.HistoryStatus.GetLabel(Eval("status")) %>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn HeaderText="Adjusted">
                            <ItemTemplate>
                                <%# GiTools.DataTypes.Bool.Format(Eval("adjusted"), "Yes", "No") %>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn HeaderText="Remarks:" DataField="remarks" ItemStyle-CssClass="history_card_links" />
                        <telerik:GridTemplateColumn HeaderText="Inspector">
                            <ItemTemplate>
                                <%# GiTools.Mail.MailHelper.MakeMailToLink(null, null, Eval("email"), Eval("name")) %>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
             
 
 
                    </Columns>
                </MasterTableView>
 
       
            </telerik:RadGrid>

James
Top achievements
Rank 1
 answered on 24 Sep 2015
3 answers
129 views

Hi community,

I have a several RadDatePicker and one RadMonthYearPicker control on a simple page.

I was trying to hide some of them by condition through client side event only, so I write a handler and try to use client object methods to hide them.

 My handler looks like:

function handler(){
    alert("before");
    $find("<%= RadDatePicker1.ClientID %>").set_visible(false);
    $find("<%= RadMonthYearPicker1.ClientID %>").set_visible(false);
    alert("after");
}

Both alert message pop up without any javascripts error, but none of the control is hidden...

This is my first trial, then I try to work around with get_textBox() and hide the text box rendered.

 

function handler2(){
    alert("before");
    $($find("<%= RadDatePicker1.ClientID %>").get_textBox()).hide();
    $($find("<%= RadMonthYearPicker1.ClientID %>").get_textBox()).hide();
    alert("after");
}

Now the DatePicker is hidden but not the MonthYearPicker...

What have I do wrong and how can I achieve such easy tasks?

I am using Telerik Ajax 2012.1.411, and my browser is Chrome & IE8+

Thanks!

Viktor Tachev
Telerik team
 answered on 24 Sep 2015
1 answer
81 views

I can find no way to properly format my source code samples here on this forum. The painbrush icon (Format Code Block) simply doesn't work, and never has. Begging everyone's pardon, could you please see my question on Stack, which formats code samples nicely. If anyone can tell me how to properly format my code blocks here on this forum, I am happy to learn.

 

http://stackoverflow.com/questions/32737055/telerik-radgrid-codebehind-doesnt-recognize-rows-added-via-javascript

 

Thanks very much.​

Viktor Tachev
Telerik team
 answered on 24 Sep 2015
6 answers
175 views

I have a RadGrid with that works correctly outside of the RadPanelBar.  When I put it inside of a RadPanelBar the OnCheckedChanged="ToggleRowSelection" does not fire.  Does "protected void ToggleRowSelection(object sender, EventArgs e)" need to be defined differently?  It looks like the auto post back works because the check mark disappears.  If I remove ToggleRowSelection in the c# section I get a compile error indicating that there is no definition for ToggleRowSelection so I think it is all correct. 

 Thanks,

 Scott

<telerik:RadPanelBar ID="RadPanelBar1" Runat="server" Width="774px">
       <Items>
           <telerik:RadPanelItem runat="server" Text="Web Servers">
                   <ContentTemplate>
                       <telerik:RadGrid ID="WebServerRadGrid" runat="server" AllowPaging="True" PageSize="5" Skin="Silk" AllowMultiRowSelection="true">
                          <MasterTableView>
                              <Columns>
                                <telerik:GridTemplateColumn UniqueName="CheckBoxTemplateColumn">
                                 <ItemTemplate>
                                    <asp:CheckBox ID="CheckBox1" runat="server" OnCheckedChanged="ToggleRowSelection" AutoPostBack="True" />
                                 </ItemTemplate>
                              </telerik:GridTemplateColumn>
                            </Columns>
                          </MasterTableView>
                       </telerik:RadGrid>
                   </ContentTemplate>
           </telerik:RadPanelItem>
        </Items>
   </telerik:RadPanelBar>

 

 

protected void ToggleRowSelection(object sender, EventArgs e)
  {
      ((sender as CheckBox).NamingContainer as GridItem).Selected = (sender as CheckBox).Checked;
      bool checkHeader = true;
      foreach (GridDataItem dataItem in WebServerRadGrid.MasterTableView.Items)
      {
          if (!(dataItem.FindControl("CheckBox1") as CheckBox).Checked)
          {
              checkHeader = false;
              break;
          }
      }
      GridHeaderItem headerItem = WebServerRadGrid.MasterTableView.GetItems(GridItemType.Header)[0] as GridHeaderItem;
      (headerItem.FindControl("headerChkbox") as CheckBox).Checked = checkHeader;
  }

Ivan Danchev
Telerik team
 answered on 24 Sep 2015
3 answers
369 views

 Grid is not refreshed after ItemCommand event

 

 

Protected Sub Parts_ItemCommand(sender As Object, e As GridCommandEventArgs) Handles Parts.ItemCommand
If e.CommandName = "DeleteInventory" Then
Dim filename As String = _uploadSystemPath & "tree.xml"
Dim XMLDoc As XDocument = XDocument.Load(_uploadSystemPath & "tree.xml")
XMLDoc.Root.Elements("Node")(e.Item.ItemIndex).Remove()
XMLDoc.Save(filename)
XMLBookBuilderSource.DataFile = _uploadSystemPath & "tree.xml"
Parts.DataSource = XMLBookBuilderSource
Parts.DataBind()
End If
End Sub

Viktor Tachev
Telerik team
 answered on 24 Sep 2015
2 answers
425 views
Hi Team,

I am Using RadCombobox and List box and a button in a page. Radcombobox has selected index changed event. Filling listbox in this event . I am checking some items (not all) from code behind file after clicking button then Select index change event is firing before button click event. If i select all the elements from the code behind file then it is going well(button click event only fires). please give suggestion/solution as soon as possible for selectedindexchanged event occurring UN eventually.

Thanks,
Prasad.
Hari
Top achievements
Rank 1
 answered on 24 Sep 2015
1 answer
407 views

UI for ASP.NET AJAX version: 2015.1.225

I'm trying to grab information from the radgrid when the user selects a row.  The Javascript function fires as expected, but I can't seem to get the right syntax to grab the cell information.

    <script type="text/javascript">
        function launchDetails(sender, eventArgs) {

        }
    </script>

If I use 'sender.MasterTableView.getColumnByUniqueName("caseName");' I get the column information as expected.
If I use 'parseInt(eventArgs.get_itemIndexHierarchical());' I get the selected row index as expected.

If I use 'sender.MasterTableView.getCellByColumnUniqueName(parseInt(eventArgs.get_itemIndexHierarchical()),"caseName");' I get the following error:
'Uncaught TypeError: a.get_element is not a function(…)' at 'Telerik.Web.UI.GridTableView.getCellByColumnUniqueName'

I've also tried this line of code without the 'parseInt', but obtain the same results.  How can I grab the "caseName" at the designated clicked row?

Viktor Tachev
Telerik team
 answered on 24 Sep 2015
Narrow your results
Selected tags
Tags
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?