This is a migrated thread and some comments may be shown as answers.

[Solved] Send RadWindow SelectedValue from a RadComboBox

1 Answer 129 Views
Window
This is a migrated thread and some comments may be shown as answers.
Zachary
Top achievements
Rank 1
Zachary asked on 01 Mar 2008, 03:39 AM

I have a RadComboBox with two values.  I want to select a value from the combobox, then click a submit button.  When I do this, I want a RadWindow to open and for the SelectedValue of the combobox item to be passed to the RadWindow.

Here is the code for my JS function

<script type="text/javascript">
 function OpenPositionedWindow(oButton, url, windowName)
 {
   var oWnd = window.radopen(url,windowName); 
 }
 function openRadWindow(ContractID)
 {
    var oWnd = radopen("ContractAddContractBlock.aspx?ContractID=" + ContractID, "AddBlock" );
    oWnd.Center();
 }
         
</script>

Here is the code for the combobox
        <telerik:RadComboBox ID="RadComboBox1" Runat="server"
            RadComboBoxImagePosition="Right">
            <Items>
                <telerik:RadComboBoxItem runat="server" Text="Test1" Value="1" />
                <telerik:RadComboBoxItem runat="server" Text="Test2" Value="2" />
            </Items>
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>

<ExpandAnimation Type="OutQuart"></ExpandAnimation>
        </telerik:RadComboBox>

Here is the code for my button

<asp:Button ID="Button1" OnClick="openRadWindow('<%# radcomboxbox1.selectedvalue %>'); return false;" runat="server" Text="Button" />

When I run it, I get
BC30456: 'openRadWindow' is not a member of 'ASP.test_aspx'.

This is the only article I found relative to my problem but due to its age I don't know if it is still relevant.
http://www.telerik.com/community/forums/thread/b311D-babeg.aspx

Am I going at this the right way?  It seems like my problems is all in the OnClick of the button, but I'm just not sure why.  I have tried a standard HTML button as well so it would be all client-side, but I get a similar error.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 04 Mar 2008, 04:28 PM
Hello Zachary,


I would suggest the following approach:
<form id="form1" runat="server"> 
    <asp:ScriptManager ID="ScriptManager1" runat="server"> 
    </asp:ScriptManager> 
     
<script type="text/javascript"> 
function OpenPositionedWindow(oButton, url, windowName) 
{ 
var oWnd = window.radopen(url,windowName);  
} 
function openRadWindow() 
{ 
var combo = $find("<%= RadComboBox1.ClientID %>"); 
var ContractID = combo.get_value(); 
var oWnd = radopen("ContractAddContractBlock.aspx?ContractID=" + ContractID, "AddBlock" ); 
oWnd.Center(); 
} 
      
</script> 
    <telerik:RadComboBox ID="RadComboBox1" runat="server" RadComboBoxImagePosition="Right"> 
        <Items> 
            <telerik:RadComboBoxItem runat="server" Text="Test1" Value="1" /> 
            <telerik:RadComboBoxItem runat="server" Text="Test2" Value="2" /> 
        </Items> 
        <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
        <ExpandAnimation Type="OutQuart"></ExpandAnimation> 
    </telerik:RadComboBox> 
    <br /> 
    <asp:Button ID="Button1"  
    OnClientClick="openRadWindow(); return false;"  
    runat="server" Text="Button" /> 
</form> 

Note that the JavaScript function is set with the OnClientClick property and that the value is taken with the combobox's client-side API.



Kind regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Window
Asked by
Zachary
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Share this question
or