Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
466 views
Hi, I'm trying to bind a RadComboBox with an ObjectDataSource (odsFuenteEmisionAlcance) that returns a List of Objects like these:

List<FuenteEmisionAlcance>
 
public class FuenteEmisionAlcance
{
    private FuenteEmision m_FuenteEmision;
    private Alcance m_Alcance;
  
    public FuenteEmision FuenteEmision
    {
        get { return m_FuenteEmision; }
        set { m_FuenteEmision = value; }
    }
 
    public Alcance Alcance
    {
        get { return m_Alcance; }
        set { m_Alcance = value; }
    }
}

This is my ComboBox

<telerik:RadComboBox ID="rcbFuenteEmision" runat="server" AutoPostBack="True" DataSourceID="odsFuenteEmisionAlcance" DataTextField="FuenteEmision.Nombre" DataValueField="FuenteEmision.Id" ZIndex="100000" CausesValidation="False" OnSelectedIndexChanged="rcbFuenteEmision_SelectedIndexChanged" EmptyMessage="--Seleccione--" OnClientSelectedIndexChanged="OnClientSelectedIndexChanged" OnDataBinding="rcbFuenteEmision_DataBinding"></telerik:RadComboBox>

I'm trying to use the DataTextField and DataValueField values from the Property FuenteEmision, but somehow is not getting it, this is what I get:

[NotSupportedException: Object of type HUC.FuenteEmisionAlcance does not have a FuenteEmision.Nombre property.]


Like I show before the object FuenteEmisionAlcance does a have a FuenteEmision property, the combo is able to find it, i've tried using only DataTextField="FuenteEmision" and DataValueField="FuenteEmision" just to try and it does find it, but when it comes to find a property from the property it crashes, is this impossible? or there is another way I can acomplish this.


Shinu
Top achievements
Rank 2
 answered on 23 Jun 2014
1 answer
88 views
hello
I want to add GridTemplateColumn and Textbox as itemtemplate programatically.
I used the below code but it just generate the GridTemplate columns with blank rows without textbox as shown in attached image
Please help me to solve this problem.

Protected
Sub btnFurnaceAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnFurnaceAdd.Click
        num = gdFurnace.Items.Count + 1
        Dim dt As New DataTable()
       gdFurnace.DataSource = addBlankLines(dt, num)
       gdFurnace.Rebind()
                  For i = 0 To 8
               Dim col As New GridTemplateColumn
                col.HeaderText = "Column" + i.ToString
               col.UniqueName = i.ToString
               col.ItemTemplate = New MyTemplate(col.UniqueName)
               col.HeaderStyle.Font.Bold = True
               gdFurnace.MasterTableView.Columns.Add(col)
            Next
End Sub

​ Private Function addBlankLines(ByVal dt As DataTable, ByVal num As Integer) As DataTable
       
Dim count As Integer = 0
        If num <> 0 Then
            Dim drBlank As DataRow = Nothing
            For i As Integer = 0 To num - 1
                drBlank = dt.NewRow()
                dt.Rows.Add(drBlank)

       
     Next
        End If
        Return dt

    End Function


​Private Class MyTemplate
       
Implements ITemplate
        Protected lControl As LiteralControl
        Protected validatorTextBox As RequiredFieldValidator
        Protected searchGoogle As HyperLink
        Protected textBox As TextBox
        Protected boolValue As CheckBox
        Private colname As String

        Public Sub New(ByVal cName As String)
           
colname = cName
        End Sub
        Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) Implements ITemplate.InstantiateIn
           
lControl = New LiteralControl()
            lControl.ID = "lControl"
            AddHandler lControl.DataBinding, AddressOf lControl_DataBinding
            textBox = New TextBox()
            textBox.ID = "templateColumnTextBox"
            validatorTextBox = New RequiredFieldValidator()
            validatorTextBox.ControlToValidate = "templateColumnTextBox"
            validatorTextBox.ErrorMessage = "*"
            searchGoogle = New HyperLink()

           
searchGoogle.ID = "searchGoogle"
            AddHandler searchGoogle.DataBinding, _
                       AddressOf searchGoogle_DataBinding
            boolValue = New CheckBox()
            boolValue.ID = "boolValue"
            AddHandler boolValue.DataBinding, _
                       AddressOf boolValue_DataBinding
            boolValue.Enabled = False
            Dim table As New Table()

           
Dim row1 As New TableRow()
            Dim row2 As New TableRow()
            Dim cell11 As New TableCell()
            Dim cell12 As New TableCell()
            Dim cell21 As New TableCell()
            Dim cell22 As New TableCell()
            row1.Cells.Add(cell11)
            row1.Cells.Add(cell12)
            row2.Cells.Add(cell21)

           
row2.Cells.Add(cell22)
            table.Rows.Add(row1)
            table.Rows.Add(row2)
            cell11.Text = colname + ": "
            cell12.Controls.Add(lControl)
            cell21.Text = "Search Google for: "
            cell22.Controls.Add(searchGoogle)
            container.Controls.Add(textBox)
            container.Controls.Add(validatorTextBox)
            container.Controls.Add(table)

           
container.Controls.Add(New LiteralControl("<br />"))
            container.Controls.Add(boolValue)

        End Sub
        Sub boolValue_DataBinding(ByVal sender As Object, ByVal e As EventArgs)
           
Dim cBox As CheckBox = DirectCast(sender, CheckBox)
            Dim container As GridDataItem = DirectCast(cBox.NamingContainer, GridDataItem)
            cBox.Checked = DirectCast((DirectCast(container.DataItem, DataRowView))("Bool"), Boolean)

        End Sub
        Sub searchGoogle_DataBinding(ByVal sender As Object, ByVal e As EventArgs)
           
Dim link As HyperLink = DirectCast(sender, HyperLink)
            Dim container As GridDataItem = DirectCast(link.NamingContainer, GridDataItem)
            link.Text = (DirectCast(container.DataItem, DataRowView))(colname).ToString()
            link.NavigateUrl = "http://www.google.com/search?hl=en&q=" + _
                   (DirectCast(container.DataItem, DataRowView))("ContactName").ToString() + "&btnG=Google+Search"

        End Sub
        Public Sub lControl_DataBinding(ByVal sender As Object, ByVal e As EventArgs)
           
Dim l As LiteralControl = DirectCast(sender, LiteralControl)
            Dim container As GridDataItem = DirectCast(l.NamingContainer, GridDataItem)
            l.Text = (DirectCast(container.DataItem, DataRowView))(colname).ToString() + "<br />"

        End Sub
    End Class
Eyup
Telerik team
 answered on 23 Jun 2014
10 answers
760 views
Hi,

I am trying to access the selected row in my grid, but SelectedItems or SelectedIndexes is always empty. Anyone had this issue before?

And the event SelectedIndexChanged is never fired....
Christian
Top achievements
Rank 1
 answered on 23 Jun 2014
1 answer
137 views
Hi,
I am using this post http://www.telerik.com/forums/radgrid-rows-sorting-move-up-and-move-down-button#e2TZo8jWa0CwWCpvuifTow

to acheive the sorting functionality.

I would like to know how to hide the Up button when it reaches the first position as it cannot be moved up further.

Similarly to hide the down button when it reaches the last position as it cannot be moved down further

Please advise.
Radoslav
Telerik team
 answered on 23 Jun 2014
1 answer
78 views
Hello ,

I want that when the pressing enter key at the last of the heading tag then i want to add a <br/> at the last but the editor add the new <p> tag

For Example:

<h2>demo test</h2>
<p>Demo paragraph</p>

Then I pressing enter key at the last of the <h2> tag like after the :
"demo test "pressing enter key here" " 
then he editor will show the content like this:

<h2>demo test</h2>
<p></p>
<p>demo paragraph></p>

but i want the result like this:
<h2>demo test <br/></h2>
<p>demo paragraph></p>

Ianko
Telerik team
 answered on 23 Jun 2014
1 answer
159 views
I am having issues using the AsynUpload control and .ascx files.  It's almost like it doesn't work with them at all.  I try to use the clientside development and the server side development and either I get errors or it just doesn't fire.  What can I do to alleviate this issue?
Princy
Top achievements
Rank 2
 answered on 23 Jun 2014
1 answer
170 views
Morning.

I want to acces the data of a NestedViewTemplate item with a button for each row there, here is a image so i can explain better:

i want to put a button where the red scuare is to acces the data that inside the blue scuare.
Princy
Top achievements
Rank 2
 answered on 23 Jun 2014
2 answers
153 views
Hello!

The property DatePopupButton-ToolTip of RadDatePicker does not work.
"Open the calendar popup." cannot be changed to empty string.

Please don't give me an answer with the javascript method. This is not the solution!
Maybe you have at least a css rule!

Thanks!
Christoph
Top achievements
Rank 1
 answered on 22 Jun 2014
6 answers
439 views
I need to change the formatting of some of the field in the row/record if one of them contains any value.
I tried this:

 if (e.Item is GridDataItem)
        {
            GridDataItem dataBoundItem = e.Item as GridDataItem;
            if ((dataBoundItem["AlternCost"].Text) != null)
            {
                dataBoundItem["AlternCost"].ForeColor = Color.Red;
                dataBoundItem["AlternCost"].Font.Bold = true;
                dataBoundItem["AlternCost"].BackColor = Color.Yellow;
                dataBoundItem["TotCost"].ForeColor = Color.Red;
                dataBoundItem["TotCost"].Font.Bold = true;
            }
        }

but I am experiencing problems because the back color applies to the entire column if the condition is true and I need it to be applied only to the "AlternCost" cell/row of the record where the condition occurs.
Please help!

Thanks
Felice
Top achievements
Rank 1
 answered on 22 Jun 2014
5 answers
540 views
I have a radgrid with 4 columns:
Quantity, Cost, SpecialCost, TotalCost
The first 3 columns are data bound, the 4td column is a Calculated column.
I need to calculate the value of the TotalCost based on Quantity*Cost, this is easy:

DataFileds: Quantity, Cost
Expression: {0}*{1}

but if the SpecialCost cell contains a value then the calculation should be done using SpecialCost*Quantity.
As far as I know, the Expression editor does not take logical functions otherwise I could simply use an if statement to check if SpecialCost contains a value and select it.

How can I achieve the above? 
Felice
Top achievements
Rank 1
 answered on 22 Jun 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?