Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
1.0K+ views

    Hi,

Wondering if you could help. I'm struggling to get a value from a ComboBox. I have the following ComboBox set up:

<sq8:ComboBox runat="server" ID="cboAgree" OnClientSelectedIndexChanged="onSelectedIndexChanged"><Items>
<sq8:ComboBoxItem runat="server" Text="Agree" Value="Agree"></sq8:ComboBoxItem>
<sq8:ComboBoxItem runat="server" Text="Disagree" Value="Disagree"></sq8:ComboBoxItem>
</Items>
</sq8:ComboBox>
<sq:BindableControl runat="server" TargetControlID="cboAgree" DataField="Agreement"></sq:BindableControl>

And the following JavaScript to get the value:

<script type="text/javascript">
   
Sys.Application.add_load(FormLoad) 
 
 function FormLoad()
  {
    onSelectedIndexChanged(true);
  
   
  function onSelectedIndexChanged(sender, eventArgs)
{
   
      var commentsGrid = document.getElementById("comms");
   
            commentsGrid.style.display = "none";
   
    var item = eventArgs.get_item();
 
    if (item == "Disagree") {
        commentsGrid.style.display = "block";
    } else {
        commentsGrid.style.display = "none";
    }
}
    
  
</script>

 

I get back the following error - "Uncaught TypeError: Cannot read property 'get_item' of undefined"

I have looked at the threads about getting ComboBox values on this forum but just can't seem to get this working.

When the value "Disagree" is selected from the combobox (id of the ComboBox is cboAgree) i want the grid to show. And when Agree is selected, i want the grid to disappear.

 

Could anyone steer me in the right direction? Thanks!

Rumen
Telerik team
 answered on 31 May 2019
14 answers
682 views
Telerik RadGrid is populated from ObjectDataSource. RadGrid is in BatchEdit mode. Need to prevent a row from editing if a readonly checkbox column is checked.

<telerik:radgrid id="RadGridTest" runat="server" allowsorting="True" allowpaging="True"
    allowautomaticupdates="True" allowautomaticdeletes="True" allowautomaticinserts="True"
    gridlines="None" pagesize="10" cellspacing="0"
    datasourceid="RadGridTestSource">
    <filtermenu enableimagesprites="False" />
    <pagerstyle mode="NumericPages" />
    <mastertableview width="100%" commanditemdisplay="Top" datasourceid="RadGridTestSource"
        horizontalalign="NotSet" editmode="Batch" autogeneratecolumns="False" datakeynames="TestId"
        overridedatasourcecontrolsorting="true">
    <BatchEditingSettings EditType="Cell" />
     <SortExpressions>
        <telerik:GridSortExpression FieldName="TestId" SortOrder="Descending" />
    </SortExpressions>
    <Columns>                   
        <telerik:GridBoundColumn DataField="TestId" HeaderText="TestId" SortExpression="TestId"
             UniqueName="TestId" Visible="false">
        </telerik:GridBoundColumn>                                     
        <telerik:GridCheckBoxColumn DataField="EditKey" HeaderStyle-Width="80px" HeaderText="Edit Key"    SortExpression="EditKey" UniqueName="EditKey" ReadOnly="true" >
                </telerik:GridCheckBoxColumn>                            
    </Columns>         
</mastertableview>
</telerik:radgrid>


 protected void RadGridTest_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem dataItem = e.Item as GridDataItem;          
            if (((PROJ.Object)(((Telerik.Web.UI.GridItem)(dataItem)).DataItem)).EditKey == true)
            {
                dataItem.Edit = false;
            }          
        }
    }

David
Top achievements
Rank 1
Iron
Iron
Veteran
 answered on 31 May 2019
3 answers
79 views

Hi 

             The string contain "<k" in between "FQH<k$/[3:9DxL+!" in when i show this name  in rad gird but it only show  first three letter after the "<k" dose not show. the screen shot show below.

http://prntscr.com/nsa4du

               If give space  between "<k" like this "FQH < k$/[3:9DxL+!"  it show in fully as show in the screen shot

http://prntscr.com/nsa7m0

 

 

Peter Milchev
Telerik team
 answered on 31 May 2019
1 answer
125 views

Hi

I am using RadHtmlChart with Line series which contains YAxes and AdditionalYAxes.

I want to change the title of AdditionalYAxes in C# Code Behind.

 

Pls share some sample code.

 

Thanks.

Vessy
Telerik team
 answered on 31 May 2019
3 answers
238 views
Hi
I have 2 buttons in .aspx page ,one for pdf export and other for excel export.Pdf works okay.But on excel export, i get  error "RegisterRequiresControlState can only be called before and during PreRender. "
 I am using dynamically loaded user controls and the grid DataBind() is in the Page_Load of the user control.
The below is the Code in user control. What do I need to do to get rid of this error? I did see the forum answers where it says "Calling Rebind not after PreRender is not supported " .But I am not doing anything on PreRender knowingly.

protected void Page_Load(object sender, EventArgs e)
  {
      List<ReportDto> reportlt = BuildReport<ReportDto>();
      ReportGrid.DataSource = reportlt;
      ReportGrid.DataBind();
  }
Code in .ascx is
<telerik:RadGrid runat="server" SkinID="main" style="outline: none;" id="ReportGrid">
    <ExportSettings>
         <Pdf AllowAdd="false" AllowCopy="True" AllowModify="false" AllowPrinting="true" Author="RadTech"
              Keywords="None" PageBottomMargin=".1in" PageLeftMargin=".1in" PageRightMargin=".1in"
              PageTopMargin="1in" PaperSize="Letter" PageHeight="8.5in" PageWidth="11.69in" Title="Client QA -Case       Report" />
         <Excel Format="ExcelML" />
    </ExportSettings>
    
    <MasterTableView>
        <NoRecordsTemplate>
            There are no records to display
        </NoRecordsTemplate>
        <Columns>
       ....
....
...
            </Columns>
    </MasterTableView>
</telerik:RadGrid>


code in aspx.cs page is:
protected void BtnExportToExcel_Click(object sender,EventArgs e)
   {
       try
       {
           TrySearch();
       
        catch
        {
        }
           UserControl usr = new UserControl();
       usr = ReportHolder.FindControl("CaseReport") as UserControl;
       if (usr != null)
       {
           RadGrid grdExcel = usr.FindControl("ReportGrid") as RadGrid;
           grdExcel.ExportSettings.OpenInNewWindow = true;
           grdExcel.ExportSettings.ExportOnlyData = true;
           grdExcel.ExportSettings.IgnorePaging = true;
           grdExcel.MasterTableView.ExportToExcel();
       }
   }
Vessy
Telerik team
 answered on 31 May 2019
4 answers
410 views

  I have a Radgrid with a RadNumericTextBox in a template column. The OnValueChanged event passes the value to the Javascript function. How do I also pass the value of the Price column of the same row in the same OnValueChanged event?

 

 

<script type="text/javascript">

function Total(sender, eventArgs) {

var total = $find('<%=tbTotal.ClientID %>');

var OldTotal = total.get_value();

var i = eventArgs.get_newValue();

var i2 = eventArgs.get_oldValue();

total.set_value(i + OldTotal - i2);

}

<script type="text/javascript">

<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" >

 

<MasterTableView datakeynames="Item"

datasourceid="SqlDataSource1" ClientDataKeyNames="Quantity,Price" >

<Columns>

<telerik:GridBoundColumn DataField="Item"

UniqueName="Item">

</telerik:GridBoundColumn>

 

<telerik:GridTemplateColumn UniqueName="TemplateColumn" >

 

<ItemTemplate>

<telerik:RadNumericTextBox ID="tbQuantity" Runat="server"

ShowSpinButtons = "true"

dbValue='<%#Bind("Quantity") %>' >

<ClientEvents OnValueChanged="Total" />

</telerik:RadNumericTextBox>

</ItemTemplate>

</telerik:GridTemplateColumn>

<telerik:GridBoundColumn DataField="Price"

UniqueName="Price">

</telerik:GridBoundColumn>

</Columns>

MasterTableView>

</telerik:RadGrid>

Attila Antal
Telerik team
 answered on 30 May 2019
3 answers
147 views

Hello, I have a database with a numeric field (State) that has the following values: 0, 1, 2, 3 and 4. In the Template Filter I have associated a combobox with the text associated with each value.

I want to see the text both in the field and in the filter, but I do not get it. You can help me see what I have wrong. Thank you

<telerik:GridTemplateColumn DataField="Estado" HeaderText="Estado" UniqueName="Estado" DataType ="System.String"    SortExpression="Estado" GroupByExpression="Estado Group by Estado" ReadOnly "true"><br>                               
<ItemTemplate><br>                               
<asp:Label runat="server"<br>                                   
ID="Estado" <br>  Text= '<%# DataBinder.Eval(Container.DataItem, "Estado") %>'><br>                                </asp:Label> <br>
</ItemTemplate><br>
<FilterTemplate><br>                                   
<telerik:RadComboBox RenderMode="Lightweight" ID="RcEstado" Width="90px" <br>                                        SelectedValue='<%# CType(Container, GridItem).OwnerTableView.GetColumn("Estado").CurrentFilterValue %>'       runat="server" OnClientSelectedIndexChanged="Estado_SelectedIndexChanged"><br>                                        <Items><br>
<telerik:RadComboBoxItem Text="Todo" Value="" Selected="True" /> <br>                                            <telerik:RadComboBoxItem Text="Sin incidencia" Value="0" /><br>                                            <telerik:RadComboBoxItem Text="El código de farmacia no existe en la base datos."Value="1"/><br>
<telerik:RadComboBoxItem Text="La clave de acceso no coincide" Value="2" />                                    <telerik:RadComboBoxItem Text="No se ha encontrado ninguna clave de acceso que no esté caducada." Value="3"
<telerik:RadComboBoxItem Text="La clave está caducada." Value="4" /><br>                                        </Items>
</telerik:RadComboBox><br>                                   
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server"><br>                                       
<script type="text/javascript">
function Estado_SelectedIndexChanged(sender, args) {<br>                                           
var tableView = $find("<%# TryCast(Container, GridItem).OwnerTableView.ClientID %>");
tableView.filter("Estado", args.get_item().get_value(), "EqualTo");<br>                                                                                  </script><br>                                   
</telerik:RadScriptBlock><br>                               
</FilterTemplate><br>                           
<EditItemTemplate><br>                           
<telerik:RadDropDownList ID="DropDownList4" runat="server" AutoPostBack="true" DataValueField="Activa" SelectedValue='<%#Bind("PingSrv") %>' OnSelectedIndexChanged="DropDownList4_selectedindexchanged"><br>                                <Items><br>
<telerik:DropDownListItem Text="El código de farmacia no existe en la base de datos." Value="1"
<telerik:DropDownListItem Text="La clave de acceso no coincide" Value="2" /><br>                                    <telerik:DropDownListItem Text="No se ha encontrado ninguna clave de acceso que no esté caducada." Value="3"
<telerik:DropDownListItem Text="La clave está caducada." Value="4" /><br>                            
</Items><br>
</telerik:RadDropDownList><br>                       
</EditItemTemplate><br>                         </telerik:GridTemplateColumn>
Attila Antal
Telerik team
 answered on 30 May 2019
9 answers
462 views

I'm sure the answer is something simple. I am trying to set my chart's legend cursor (mouse pointer) to "default" after the chart has already been created. I can't seem to figure out the correct syntax. Your help will be greatly appreciated.Thanks in advance.

var radHtmlChartObject = $find("<%=RadHtmlChart1.ClientID %>"); //the standard control object
var kendoChart = radHtmlChartObject.get_kendoWidget(); //the Kendo widget

//Examples that work correctly

kendoChart.options.legend.position = "top";
kendoChart.options.legend.labels.background = "green";

//None of these work for me:
kendoChart.options.legend.item.cursor = "default";
kendoChart.options.legend.item.cursor.style = "default";
kendoChart.options.legend.item[0].cursor = "default";
kendoChart.options.legend.item[0].cursor.style = "default";
kendoChart.options.legend.items.cursor = "default";
kendoChart.options.legend.items.cursor.style = "default";

 

Rumen
Telerik team
 answered on 30 May 2019
2 answers
144 views

I am using RadFilter to filter results in a RadGrid. For whatever reason, it will not filter my results in the rad grid. If I used the asp Grid option though, it does work. Is there a setting I am missing? Pictures attatched show that I should be getting results when I filter for cartoon, using the RadGrid and RadFilter, but nothing comes up. 

 

My code is as follows: (didn't give filter or grid ID names, I am just trying to get it to work at the moment.) 

 

<telerik:RadFilter ID="RadFilter1" runat="server" FilterContainerID="RadGrid1">
    </telerik:RadFilter>
    <br />
    <br />
 
    <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="ListViewFilter" Height="80px">
<GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>
        <MasterTableView AutoGenerateColumns="False" DataSourceID="ListViewFilter">

            <Columns>
                <telerik:GridBoundColumn DataField="EE" FilterControlAltText="Filter EE column" HeaderText="EE" SortExpression="EE" UniqueName="EE">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Interest" FilterControlAltText="Filter Interest column" HeaderText="Interest" SortExpression="Interest" UniqueName="Interest">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Like_or_Dislike" FilterControlAltText="Filter Like_or_Dislike column" HeaderText="Like_or_Dislike" ReadOnly="True" SortExpression="Like_or_Dislike" UniqueName="Like_or_Dislike">
                </telerik:GridBoundColumn>
            </Columns>

        </MasterTableView>
    </telerik:RadGrid>
    <asp:SqlDataSource ID="ListViewFilter" runat="server" ConnectionString="<%$ ConnectionStrings:Interests.My.MySettings.dbInterests %>" SelectCommand="FilterList" SelectCommandType="StoredProcedure"></asp:SqlDataSource>

 

 

Calin
Top achievements
Rank 1
 answered on 29 May 2019
1 answer
522 views
Hello,

on my pages where i use RadAjaxPanel, RadAjaxLoadingPanel, RadGrid, RadPanelBar, RadComboBox, RadMenu and RadScriptManager sometimes i got the following script error:

Sys.ScriptLoadFailedException: The script '/Telerik.Web.UI.WebRessource.axd?_TSM_HiddenField_=ctl00_ScriptManager1_HiddenField&compress=1 .......... could not be loaded.

I'am using ASP .NET 2.0 and RadControls for ASP.NET AJAX 2009.2.701.20. I read about this problem in an other thread but it was for an much older version of the RadControls. So what should i do to solve this problem?
Rumen
Telerik team
 answered on 29 May 2019
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?