Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
193 views
For my internship I have to work with Telerik which is going great since the forums is up to date and I can find many tutorials.
I started to combine tricks etc for the better effect.

For the project I have to do, I have to change the values in a dropdownlist whenever the values of the other dropdownlist is changed.
Not that difficult normally.

However I am trying to do this when both dropdownlists are in the editmode(batch) of a radgrid, which is in a radpanel. I can't figure out how to acces the changeselectedvalue event

Now my question is, is it possible to trigger this event while the dropdownlists is in a Radgrid in editmode batch?
In the first attachment is a part of my code with both the columns selected.
In the second is how my page looks right now (all data from 'Eenheid'). I wanna change the databound of 'Eenheid' whenever I change the value of 'Vector'


Jeffrey
Angel Petrov
Telerik team
 answered on 18 Mar 2014
1 answer
256 views
My requirement is that when the user clicks the edit command on the parent row, all rows in the child table should be put into edit mode. I tried the following in the grid's itemcommand event, but it didn't work:

                   Dim dataitem As GridDataItem = DirectCast(e.CommandSource, GridDataItem)
                   For Each editItem As GridDataItem In dataitem.ChildItem.NestedTableViews(0).Items
                        editItem.Edit = True
                   Next
Jayesh Goyani
Top achievements
Rank 2
 answered on 18 Mar 2014
2 answers
758 views

Hello, I have a RadGrid with an EditFormType set to 'Template'. I can't figure out how to access form elements inside this FormTemplate from the code behind. I'm trying to make one drop down change its options when another one is selected.

When I try to compile this code, it tells me "The name 'drpEditTarget' does not exists in the current context.". If I move that drop-down outside of the RadGrid, it's suddenly accessible again. I guess my two questions are...
--1) How can I access this element from the code behind?
--2) What's the difference between elements outside and inside the Grid? Why can I access the former but not the latter? (the answer to this might be a more broad asp.net question)

Default.aspx

<Telerik:RadGrid ID="RequestsGrid"runat="server" OnNeedDataSource="RequestsGrid_NeedDataSource" OnCancelCommand="RequestGrid_CancelCommand" OnDeleteCommand="RequestsGrid_DeleteCommand" OnItemCommand="RequestGrid_ItemCommand" OnItemDataBound="RequestsGrid_ItemDataBound" AllowAutomaticDeletes="false" AllowAutomaticInserts="false" AllowAutomaticUpdates="true" DataSourceID="requests">
    <MasterTableView AutoGenerateColumns="false" DataKeyNames="id,requester,output,notes" DataSourceID="requests" CommandItemDisplay="Bottom">
        <EditFormSettings EditFormType="Template">
            <EditColumn UniqueName="EditColumn"></EditColumn>
            <FormTemplate>
                        <b>First Target:</b>
                        <asp:DropDownList runat="server" SelectedValue='<%# Eval("target") %>' ID="drpEditTarget" AutoPostBack="true" DataSource='<%# getPossibleTargets( (string)Eval("output") ) %>' OnSelectedIndexChanged="drpEditTarget_SelectedIndexChanged"></asp:DropDownList>
                        <b>Second Target:</b></td>
                        <asp:DropDownList runat="server" ID="drpEditSecondTarget"></asp:DropDownList>
                <asp:Button ID="btnUpdate" CommandName="Update" Text="Update" runat="server" />
                <asp:Button ID="btnCancel" CommandName="Cancel" Text="Cancel" runat="server" />
            </FormTemplate>
        </EditFormSettings>
        <Columns>
            <telerik:GridEditCommandColumn UniqueName="EditButton" Visible="false" ItemStyle-CssClass="skinny"/>
            <telerik:GridButtonColumn Text="Delete" UniqueName="DeleteButton" CommandName="Delete"></telerik:GridButtonColumn>
            <telerik:GridBoundColumn DataField="id" HeaderText="ID" UniqueName="id"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="requester" HeaderText="Requester" UniqueName="requester"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="output" HeaderText="Output" UniqueName="output"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="notes" HeaderText="Notes" UniqueName="notes"></telerik:GridBoundColumn>
            <telerik:GridButtonColumn Text="Approve" UniqueName="ApproveButton" CommandName="Approve"></telerik:GridButtonColumn>
            <telerik:GridButtonColumn Text="Deny" UniqueName="DenyButton" CommandName="Deny"></telerik:GridButtonColumn>
        </Columns>
    </MasterTableView>
</Telerik:RadGrid>

Default.aspx.cs
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        populateGrid();
  
        if (!Page.IsPostBack)
        {
            setFilterOptions();
            RequestsGrid.Rebind();
        }
    }
      
    protected void drpEditTarget_SelectedIndexChanged(object sender, EventArgs e)
    {
        drpEditSecondTarget.DataSource = getPossibleDestinations( drpEditTarget.SelectedValue.ToString() );
        drpEditSecondTarget.DataBind();
    }
}
Jay
Top achievements
Rank 1
 answered on 18 Mar 2014
4 answers
89 views
 I have a column named Rate and another Named LaborHours

The rate column can be two values:  REGULAR and OVERTIME

I want the to totals in the footer:  REGULAR 5,  OVERTIME 10

The code below works in my MS DataGrid, cannot figure out how to get it to work under RadGrid

You help is much appreciated!

If e.Row.RowType = DataControlRowType.DataRow Then
   Dim MilesOrHours As String
   MilesOrHours = (DataBinder.Eval(e.Row.DataItem, "Rate"))

   If MilesOrHours = "MI" Then
     Dim HourTotal As Decimal
     HourTotal = (DataBinder.Eval(e.Row.DataItem, "LaborHours"))
     grdMilesTotal = grdMilesTotal + HourTotal
     Session("grandMilesTotal") = Session("grandMilesTotal") + grdMilesTotal

  Else

     Dim HourTotal As Decimal
     HourTotal = (DataBinder.Eval(e.Row.DataItem, "LaborHours"))
     grdHoursTotal = grdHoursTotal + HourTotal
     Session("grandHoursTotal") = Session("grandHoursTotal") + grdHoursTotal

   End If

End If



If e.Row.RowType = DataControlRowType.Footer Then
    Me.txtHrs.Text = Session("grandHourstotal")
    Me.txtMiles.Text = Session("grandMilesTotal")

    Session("grandMilestotal") = "0"
    Session("grandHourstotal") = "0"
End If

Jayesh Goyani
Top achievements
Rank 2
 answered on 18 Mar 2014
5 answers
398 views
I am using AutoGeneratedColumns for checkbox but I can only use integer for datasource. help me to find right way to convert int value(as 1 or 0) to checkbox column and also how to enable that  AutoGenerated checkbox column.
Shinu
Top achievements
Rank 2
 answered on 18 Mar 2014
5 answers
829 views
I upgraded to new Telerik version 2013.1.220.35 from 2010.3.1109.35. and compatibility issues started...

 

<telerik:RadGrid runat="server" ID="FileListView" AutoGenerateColumns="false" Skin="Windows7" 

Width="100%" OnDeleteCommand="FileListView_DeleteCommand">

<MasterTableView>

<Columns>

<telerik:GridButtonColumn UniqueName="DeleteColumn" ButtonType="ImageButton" CommandName="Delete"

ConfirmTitle="Confirm" ConfirmText="Continue deleting file?" /> <telerik:GridBoundColumn UniqueName="file" DataField="file" Visible="false" ReadOnly="true" />

 <telerik:GridBoundColumn UniqueName="Attachedfiles" DataField="Attached files" HeaderText="File" />

 <telerik:GridBoundColumn UniqueName="Attachedby" DataField="Editor" HeaderText="Attached by" />

 <telerik:GridBoundColumn UniqueName="Attachedat" DataField="Modified" HeaderText="Attached at" />

 </Columns>

 </MasterTableView>

 </telerik:RadGrid>

 

protected void FileListView_DeleteCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)

 {
GridEditableItem editedItem = e.Item as GridEditableItem;

 string filename = editedItem["file"].Text;
logic continues...

but in the above code filename has &nbsp as the value. means filename contains empty space as it value instead of actual file name

Please suggest. 

Shinu
Top achievements
Rank 2
 answered on 18 Mar 2014
3 answers
131 views
Hello Team,

I needed to select RadCombox1 and disable using javascript but I found $find with RadCombox returns null.Is there any work around for this because I am currently blocked on this?
 
1.<telerik:RadComboBox ID="RadCombox1" runat="server" >
2.     <Items>
3.         <telerik:RadComboBoxItem Text="Aba" Value="1" />
4.         <telerik:RadComboBoxItem Text="Enugu" Value="2" />
5.     </Items>
6. </telerik:RadComboBox>
7. 
8. var badRad = $find("<%= RadCombox1.ClientID %>");

the value of badRad  is null. Can someone help?

Thanks,
Nsi.
Shinu
Top achievements
Rank 2
 answered on 18 Mar 2014
0 answers
103 views
Hi, I'm using 2013 Q1 SP1 controls and AjaxControlsToolKit 4.5, I have a RadComboBox and a ModalPopupExtender with a panel, In the Site.Master I'm put the ToolKitScriptManager. When I run locally the application run good! But when I publish on Azure (http://test1bam.azurewebsites.net/webform1.aspx) both controls don't work, the radcombox dont show the list of items and the panel show the content, dont show any error. I attach two images  where locally work fine, my web.config, the webform1.aspx, and the site1.master.


[WebForm1.aspx]
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="testRadControl.WebForm1" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <telerik:RadComboBox ID="RadComboBox1" runat="server" DataSourceID="SqlDataSource1" DataTextField="descripcion" DataValueField="id"></telerik:RadComboBox>
&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:Button ID="Button1" runat="server" Text="Abrir Modal" />
    <br />
    <br />
    <asp:Panel ID="Panel1" runat="server">
        hola<asp:Button ID="Button2" runat="server" Text="Cerrar Modal" />
    </asp:Panel>
    <asp:ModalPopupExtender ID="Panel1_ModalPopupExtender" runat="server"  Enabled="True" PopupControlID="Panel1" TargetControlID="Button1">
    </asp:ModalPopupExtender>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DefaultConnection %>" SelectCommand="SELECT [descripcion], [id] FROM [producto]"></asp:SqlDataSource>
</asp:Content>


[Site1.Master]
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="testRadControl.Site1" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
       <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
            </asp:ToolkitScriptManager>
    <div>
        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">    
            
        
        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>



[web.config]
<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <connectionStrings>
    <add name="DefaultConnection" connectionString="Server=tcp:e9jnq1pavz.database.windows.net,1433;Database=xx;User ID=xx;Password=xx.;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;" providerName="System.Data.SqlClient" />
  </connectionStrings>
  <system.web>
    <customErrors mode="Off" />
    <compilation debug="true" targetFramework="4.5">
      <assemblies>
        <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
        <add assembly="System.Speech, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      </assemblies>
    </compilation>
    <httpRuntime targetFramework="4.5" />
    <httpHandlers>
      <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
    </httpHandlers>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
      <add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" />
    </handlers>
  </system.webServer>
</configuration>
Omar
Top achievements
Rank 1
 asked on 17 Mar 2014
2 answers
95 views
Hello. I have a form that pops ups from a SubMenu item click. I'd like to know how to detect whether or not the 'save' button was clicked when the popup is closed. I've tried using OnBeforeUnload but since the popup html is actually part of the calling page, that does not work.

My requirement is to have a popup asking if the user is sure that they want to actually close the popup and it doesn't actually matter whether or not 'save' was clicked.

Does anyone have any ideas?
Andrew
Top achievements
Rank 1
 answered on 17 Mar 2014
2 answers
143 views
Greetings,

A validation has to be performed, when the column is visible. Based on the column visibility the records read from cell (index) changes. I am having issues when I am trying to read the column visibility, it says 'undefined'. 

 var grdSitePlant = document.getElementById("ctl00_ContentPlaceHolder1_ucSitePlant_grdETASitesPlants").control.get_masterTableView();
 var unitVisible = false;
 ///Get Column COunt 
 var columnCount = grdSitePlant.get_columns().length;
                for (var i = 0; i < columnCount; i++) {
                    if (grdSitePlant.get_columns()[i].get_uniqueName() == "UNIT") { //Unable to understand, why this condition would be true even is column is hidden
                        unitVisible = true;
                    }
                }

  ///Read the row values
                for (var row = 0; row < grdSitePlant.get_dataItems().length; row++) {
                    var totqty = null;
                    var ship = null;
                    var scrap = null;

                    if (unitVisible) {
                        totqty = grdSitePlant.get_dataItems()[row]._element.cells[4].childNodes[0].innerText;
                        ship = grdSitePlant.get_dataItems()[row]._element.cells[5].childNodes[0].innerText;
                        scrap = grdSitePlant.get_dataItems()[row]._element.cells[6].childNodes[0].innerText;
                    } else {
                        totqty = grdSitePlant.get_dataItems()[row]._element.cells[3].childNodes[0].innerText;
                        ship = grdSitePlant.get_dataItems()[row]._element.cells[4].childNodes[0].innerText;
                        scrap = grdSitePlant.get_dataItems()[row]._element.cells[5].childNodes[0].innerText;
                    }
 }

Thanks,
Aman
Top achievements
Rank 1
 answered on 17 Mar 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?