Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
175 views
This has to be a very simple request, but I just started using your RAD Ajax ASP combo box...

I have a combobox that is bound to a list of States.
- I am setting the DataValueField to an integer that is basically an identity value in the database.
- I am setting the DataTextField to the abbreviations of the State.

When a user fills out the form and saves the data to a database, we are saving the DataTextField , not the value field.  So, we'd save "NC" or "NY" for instance, instead of the integer of 37 or 39 or whatever corresponds to that state. 

BTW:  After the user selects a state, I use the SelectedValue to find a list of Counties that belong to that state.

Here is what I don't know how to do:
- In our app, the user can pull up this data to edit it.  Since they have previously selected a State, I need to select the value of the state that they had chosen, in the Combobox.

Q.  How can I do that?  I fill the combo box with a list of States, but if I set the "SelectedItem.Text" to the state abbreviation that they had chosen, it obviously sets the text of the first item in the combobox to their state. 
But that is wrong.  I want to programmatically select the state that they had selected, in the combox box.

- Since I only have the State abbreviation (the DataTextField) and
not the ID, I can't set the "SelectedValue" (if that would even do what I want).

I guess the question boils down to:  If I have a combo box full of string values, how can I programmatically select an item from the combo box, based on that string value?

Thanks,
Brent
Brent
Top achievements
Rank 1
 answered on 07 Oct 2008
4 answers
139 views
hi at  all

i have a problem with rad combobox events on radgrid .

i have two radcombobox in a column template on a  radgrid,
when a change the selected item in the firts radcombobox
the elements of the second radcombobox must be change.
I did it, but only works when the grid is in editmode,
but not when the grid created a new item , what can i do what's wrong in my code.
(i'am usig radcontrols 2008 q1,vs2005 and vb)

Protected Sub RadGrid1_ItemCreated(ByVal sender As ObjectByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemCreated 
    If (TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode) Then 
        Dim list As RadComboBox = CType(CType(e.Item, GridEditableItem)("TemplateColumn").Controls(1), RadComboBox) 
        list.AutoPostBack = True 
        AddHandler list.SelectedIndexChanged, AddressOf Me.list_SelectedIndexChanged          
 
    End If 
End Sub 
Private Sub list_SelectedIndexChanged(ByVal sender As ObjectByVal e As RadComboBoxSelectedIndexChangedEventArgs) 
    
    Dim editedItem As GridEditableItem = CType(CType(sender, RadComboBox).NamingContainer, GridEditableItem) 
  
    Dim ddList As RadComboBox = CType(editedItem("NroCelular").Controls(1), RadComboBox) 
    
    Dim sql As String = "SELECT [NroCelular] FROM [Celulares] WHERE idUsuario=@idUsuario ORDER BY [NroCelular] " 
    Dim parameters As New Collection 
    Dim parameter1 As New OleDbParameter 
    parameter1.ParameterName = "@idUsuario" 
    parameter1.OleDbType = OleDbType.Integer 
    parameter1.Value = CType(editedItem("TemplateColumn").Controls(1), RadComboBox).SelectedValue 
    parameters.Add(parameter1) 
    ddList.Items.Clear() 
    Dim table As DataTable = dbManager.getDataTable(sql, parameters) 
    Dim row As DataRow 
    For Each row In table.Rows 
        Dim item As New RadComboBoxItem(row(0), row(0)) 
        ddList.Items.Add(item) 
    Next 
End Sub 
Protected Sub RadGrid1_ItemDataBound(ByVal sender As ObjectByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound 
    If TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode Then 
        Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem) 
        Dim editMan As GridEditManager = editedItem.EditManager 
        Dim editor As GridTemplateColumnEditor = CType(editMan.GetColumnEditor("NroCelular"), GridTemplateColumnEditor) 
        Dim ddlOrderIDcombo As RadComboBox = CType(editedItem("TemplateColumn").Controls(1), RadComboBox) 
        Dim sql As String = "SELECT [NroCelular] FROM [Celulares] WHERE idUsuario=@idUsuario ORDER BY [NroCelular] " 
        Dim parameters As New Collection 
        Dim parameter1 As New OleDbParameter 
        parameter1.ParameterName = "@idUsuario" 
        parameter1.OleDbType = OleDbType.Integer 
        parameter1.Value = CType(editedItem("TemplateColumn").Controls(1), RadComboBox).SelectedValue 
        parameters.Add(parameter1) 
        Dim table As DataTable = dbManager.getDataTable(sql, parameters) 
        Dim ddList As RadComboBox = CType(editedItem("NroCelular").Controls(1), RadComboBox) 
        ddList.DataSource = table 
        ddList.Items.Clear() 
        Dim row As DataRow 
        For Each row In table.Rows 
            Dim item As New RadComboBoxItem(row(0), row(0)) 
            ddList.Items.Add(item) 
        Next 
    End If 
End Sub 
this is my code from server side

<telerik:GridTemplateColumn DataField="NombreCompleto" FilterImageToolTip="Filtrar" 
    HeaderText="Usuario" SortExpression="NombreCompleto" UniqueName="TemplateColumn"
    <ItemTemplate> 
        <asp:Label ID="Label3" runat="server" Text='<%# Eval("NombreCompleto") %>'></asp:Label> 
    </ItemTemplate> 
    <EditItemTemplate> 
        <telerik:RadComboBox ID="cmbUsuario" runat="server" DataSourceID="dsUsuarios" DataTextField="NombreCompleto" 
            DataValueField="idUsuario" 
            SelectedValue='<%# Bind("idUsuario") %>' Skin="WebBlue" Width="200px"   > 
            <CollapseAnimation Duration="200" Type="OutQuint" /> 
        </telerik:RadComboBox> 
    </EditItemTemplate> 
</telerik:GridTemplateColumn> 
<telerik:GridTemplateColumn DataField="NroCelular" FilterImageToolTip="Filtrar" HeaderText="Nro Celular" 
    SortExpression="NroCelular" UniqueName="NroCelular"
    <ItemTemplate> 
        <asp:Label ID="Label2" runat="server" Text='<%# Eval("NroCelular") %>'></asp:Label> 
    </ItemTemplate> 
    <EditItemTemplate> 
        <telerik:RadComboBox ID="cmbNroCelular" runat="server" Skin="WebBlue" Width="200px"    > 
            <CollapseAnimation Duration="200" Type="OutQuint" /> 
             
        </telerik:RadComboBox> 
    </EditItemTemplate> 
</telerik:GridTemplateColumn> 

this is my code from the client side




Juan
Top achievements
Rank 1
 answered on 07 Oct 2008
1 answer
114 views
First of all, I have a RadAjaxManager on my page for use with a RadAjaxPanel.  These are present so I can make changes to the page after a callback to the server without having to reload the whole page.

I recently added a RadWindowManager so I could make a custom confirmation popup window come up when a user clicks the submit button.  If the user clicks OK then I call __doPostBack('<%=this.btnSubmit.ClientID%>','');

In the post back I have the server load some new variables into the session...  This all works just fine.

However, after the request is complete, if the user comes back to submit another form the same data remains in the session from the previous visit to the page.

If I remove the popup window and the RadWindowManager all works just fine.

What is going on here?

Svetlina Anati
Telerik team
 answered on 07 Oct 2008
2 answers
103 views
I am looking for a Software Automation program that works well testing Telerik controls. Recently, I have tried many free programs and QTP, but no program seems to work consistently.

Any Suggestions?
Mike
Top achievements
Rank 1
 answered on 07 Oct 2008
2 answers
145 views
I am having a hard time finding a deeply nested control.

I have a RadPanelBar
Inside the RadPanelBar I have A RadGrid
The RadGrid is using a FormTemplate for Editing Purposes
Inside the FormTemplate I have a RadEditor and a TextBox.

Can anyone tell me how I can Find those two controls for my Update Command?

Thanks in advance
Chase
Chase Florell
Top achievements
Rank 1
 answered on 07 Oct 2008
1 answer
124 views
Hi,

I'd like to describe my problem below:

1. Use Firefox
2. Open modal window (RadWindow) using url of page containing RadEditor control.
3. Set scroll="no" to the page's body

Now, right-click on the editor - context menu should appear. The problem is because it should be displayed in front of radwindow (just like it is in IE). Instead it makes the inner page's scrollbars appear and is partially hidden under its parent window. I tried to set the highest z-index property and position to absolute with no avail

Regards,
Rycho
Rycho
Top achievements
Rank 1
 answered on 07 Oct 2008
1 answer
131 views
How would you remove the little tip? like it is when its "Center" but on bottom right...

thanks

Svetlina Anati
Telerik team
 answered on 07 Oct 2008
4 answers
147 views
Hi,

With RadEditor:
1) How to add custom buttons (with custom button images) using tools file xml?
2) Background color in design mode gets black
3) What should be the folder structure for applying custom skin?

Thanks,
Vaibhav

Todd Anglin
Top achievements
Rank 2
 answered on 07 Oct 2008
2 answers
150 views
how do i retrieve value from itemtemplate in the radpanelbar? could anyone tell me? do i still say  strname = me.textbox1.text  or something else like find control first??thanks.
appdev
Top achievements
Rank 1
 answered on 07 Oct 2008
3 answers
229 views
Hi.

I have a modal pupup. Inside that, i have another button, that opens up a new modal poup window with a RadEditor. If i click in the textfield inside the radeditor, closes the popup, and in the first modal popup opens another window with a textbox, it is not possible for me to set the mose courser inside the field. It is not displayed, and the text typed is not displayed either.

To explain the obove:
  • Page
    • Popup (opens first)
      • Popup with Rade editor (opens second)
      • Popup with textbox (opens third).

It only happens if i use IE7, and not in FireFox.

Todd Anglin
Top achievements
Rank 2
 answered on 07 Oct 2008
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?