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

textbox values

12 Answers 227 Views
Window
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 21 Dec 2012, 11:34 AM
I have a radwindow with 2 text boxes, when the submit button is clicked i notice neither of the textboxes on this page show the values that have been entered.

both show as empty.

how do i get these values?

it works when the form is within a normal asp.net page so its presumably due to the radwindow scenario.

12 Answers, 1 is accepted

Sort by
0
Kevin
Top achievements
Rank 2
answered on 21 Dec 2012, 01:13 PM
Hello Mark,

Is the submit you are talking about in the RadWindow or outside the RadWindow? If it's outside the RadWIndow, then it's expected that the textbox values become blank after it's clicked.
0
Mark
Top achievements
Rank 1
answered on 21 Dec 2012, 01:45 PM
the submit button is in the radwindow

im trying to get the values in the code behind page from which it was launched
0
Kevin
Top achievements
Rank 2
answered on 21 Dec 2012, 06:36 PM
What does your RadWindow page markup look like, because I tried it on my end it works correctly. I just want to clarify, when you submit the form, is it clearing the textboxes or are not able to retrieve the value from the textboxes in the code-behind?
0
Mark
Top achievements
Rank 1
answered on 24 Dec 2012, 08:46 AM
here is my radwindow code:
<telerik:RadWindow ID="uxEditResult" runat="server" Width="475px">
        <ContentTemplate>       
            <div style="padding:15px">
                <fieldset>
                    <legend>Edit test result</legend>
                    <label><asp:Literal  runat="server" ID="ResultValueName" /> (<asp:Literal runat="server" ID="Units" />)<asp:textbox ID="Result" runat="server" /></label>               
                    <span id="IndexBasedResult" runat="server"><label>Index<asp:TextBox runat="server" ID="Index" /></label></span>     
                </fieldset>          
                <div style="padding:30px;">
                    <asp:ImageButton runat="server" ImageUrl="~/image?button=OK" ID="OK" />
                    <asp:ImageButton runat="server" ImageUrl="~/image?button=Close" ID="Close" />
                </div>  
            </div>
        </ContentTemplate>
    </telerik:RadWindow>

I then use this code in the code behind page to get the values in textboxes - Result and Index - but both are empty, not showing the values that are typed in the boxes prior to clicking ok.

Dim item = DirectCast(uxResults.SelectedItems(0), GridDataItem)      
        item("Value").Text = Result.Text
        item("Index").Text = Index.Text
        TryClose(sender, e)






0
Princy
Top achievements
Rank 2
answered on 26 Dec 2012, 06:36 AM
Hi Mark,

Here is the full code that I tried based on your scenario which works as expected.

ASPX:
<telerik:RadWindow ID="uxEditResult" runat="server" Width="475px" VisibleOnPageLoad="true">
        <ContentTemplate>     
            <div style="padding:15px">
                <fieldset>
                    <legend>Edit test result</legend>
                    <label><asp:Literal  runat="server" ID="ResultValueName" /> (<asp:Literal runat="server" ID="Units" />)<asp:textbox ID="Result" runat="server" /></label>             
                    <span id="IndexBasedResult" runat="server"><label>Index<asp:TextBox runat="server" ID="Index" /></label></span>   
                </fieldset>        
                <div style="padding:30px;">
                    <asp:ImageButton runat="server" ImageUrl="~/Images/bullet5.jpg" ID="OK" OnClick="OK_Click" />
                    <asp:ImageButton runat="server" ImageUrl="~/Images/bullet5.jpg" ID="Close" />
                </div>
            </div>
        </ContentTemplate>
</telerik:RadWindow>

VB:
Protected Sub OK_Click(sender As Object, e As ImageClickEventArgs)
    Dim ind As String = Index.Text
    Dim res As String = Result.Text
End Sub

Thanks,
Princy.
0
Mark
Top achievements
Rank 1
answered on 27 Dec 2012, 08:51 AM
thanks, thats effectively the code im using but both text box values are empty strings.

you have the OK method in a separate page, not the window?

0
Princy
Top achievements
Rank 2
answered on 27 Dec 2012, 11:24 AM
Hi Mark,

Here is the full code that I tried.

RadWindow.aspx
<telerik:RadWindow ID="uxEditResult" runat="server" Width="475px" VisibleOnPageLoad="true">
        <ContentTemplate>      
            <div style="padding:15px">
                <fieldset>
                    <legend>Edit test result</legend>
                    <label><asp:Literal  runat="server" ID="ResultValueName" /> (<asp:Literal runat="server" ID="Units" />)<asp:textbox ID="Result" runat="server" /></label>              
                    <span id="IndexBasedResult" runat="server"><label>Index<asp:TextBox runat="server" ID="Index" /></label></span>    
                </fieldset>         
                <div style="padding:30px;">
                    <asp:ImageButton runat="server" ImageUrl="~/Images/bullet5.jpg" ID="OK" OnClick="OK_Click" />
                    <asp:ImageButton runat="server" ImageUrl="~/Images/bullet5.jpg" ID="Close" />
                </div
            </div>
        </ContentTemplate>
</telerik:RadWindow>

RadWindow.aspx.vb
Protected Sub OK_Click(sender As Object, e As ImageClickEventArgs)
    Dim ind As String = Index.Text
    Dim res As String = Result.Text
End Sub

Hope this helps.

Thanks,
Princy.
0
Mark
Top achievements
Rank 1
answered on 27 Dec 2012, 12:08 PM
yes i see but what im wanting to do is get the values from the page that launches the window NOT the window itself...

Clicking OK in the window fires a method in the page that launches the window...

so i must not be targetting the textbox values correctly as this code doesnt work in this scenario. (values empty)
0
Princy
Top achievements
Rank 2
answered on 28 Dec 2012, 05:15 AM
Hi Mark,

I suppose you need to access RadTextboxes from the child page. Here is the code that I tried.

RadWindow.aspx

<telerik:RadWindow ID="uxEditResult" runat="server" Width="475px" VisibleOnPageLoad="true" NavigateUrl="ChildPage.aspx" >
</telerik:RadWindow>

ChildPage.aspx

ASPX:
<div style="padding:15px">
                <fieldset>
                    <legend>Edit test result</legend>
                    <label><asp:Literal  runat="server" ID="ResultValueName" /> (<asp:Literal runat="server" ID="Units" />)<asp:textbox ID="Result" runat="server" /></label>              
                    <span id="IndexBasedResult" runat="server"><label>Index<asp:TextBox runat="server" ID="Index" /></label></span>    
                </fieldset>         
                <div style="padding:30px;">
                    <asp:ImageButton runat="server" ImageUrl="~/Images/bullet5.jpg" ID="OK" OnClick="OK_Click" />
                    <asp:ImageButton runat="server" ImageUrl="~/Images/bullet5.jpg" ID="Close" />
                </div
</div>

VB:
Protected Sub OK_Click(sender As Object, e As ImageClickEventArgs)
    Dim ind As String = Index.Text
    Dim res As String = Result.Text
End Sub

Hope this helps.

Thanks,
Princy.
0
Mark
Top achievements
Rank 1
answered on 28 Dec 2012, 08:50 AM
hi

this is my scenario...

i have a page where a window is launched when a row is clicked... its the window that has the textboxes in and when values are entered and button clicked i want to get the textbox values in the parent page it was launched from...

Private Sub ResultClicked(sender As Object, e As EventArgs) Handles uxResults.ItemCommand
 
        uxEditResult.Show()
        Dim item = DirectCast(uxResults.SelectedItems(0), GridDataItem)
 
        ResultValueName.Text = item("Name").Text
        Result.Text = item("Value").Text
        Units.Text = item("Units").Text
        Index.Text = item("Index").Text
 
        IndexBasedResult.Visible = Not String.IsNullOrEmpty(Units.Text.UnencodedText())
    End Sub
 
Private Sub TryOK(sender As Object, e As EventArgs) Handles OK.Click
 
        Dim item = DirectCast(uxResults.SelectedItems(0), GridDataItem)     
 
        item("Value").Text = Result.Text
        item("Index").Text = Index.Text
 
        TryClose(sender, e)
 
    End Sub

<telerik:RadWindow ID="uxEditResult" runat="server" Width="475px">   
        <ContentTemplate>       
            <div style="padding:15px">
                <fieldset>
                    <legend>Edit test result</legend>
                    <label><asp:Literal  runat="server" ID="ResultValueName" /> (<asp:Literal runat="server" ID="Units" />)<asp:textbox ID="Result" runat="server" /></label>               
                    <span id="IndexBasedResult" runat="server"><label>Index<asp:TextBox runat="server" ID="Index" /></label></span>     
                </fieldset>           
                <div style="padding:30px;">
                    <asp:ImageButton runat="server" ImageUrl="~/image?button=OK" ID="OK" />
                    <asp:ImageButton runat="server" ImageUrl="~/image?button=Close" ID="Close" />
                </div>  
            </div>
        </ContentTemplate>
    </telerik:RadWindow>
0
Princy
Top achievements
Rank 2
answered on 03 Jan 2013, 06:41 AM
Hi,

I am not quite sure about your requirement. Here is the full code that I tried to retrieve the new value in textbox of the radwindow.
aspx:
<telerik:RadWindow ID="RadWindow1" runat="server">
  <ContentTemplate>
   <asp:TextBox ID="txt1" runat="server" />
   <asp:Button ID="Save" runat="server" Text="Save" onclick="Save_Click" />
  </ContentTemplate>
</telerik:RadWindow>
JS:
function OnRowClick(sender, args) {
  var masterTable = sender.get_masterTableView();
        var row = masterTable.get_dataItems()[args.get_itemIndexHierarchical()];
        var cell = masterTable.getCellByColumnUniqueName(row, "OrderID");
        var wind = $find("RadWindow1");
        wind.show();//Opening radwindow
        $get("<%= txt1.ClientID %>").value = cell.innerHTML;//showing the value in textbox of radwindow
    }
VB:
Protected Sub Save_Click(sender As Object, e As EventArgs)
    Dim txt As TextBox = DirectCast(RadWindow1.ContentContainer.FindControl("txt1"), TextBox)
    Dim value As String = txt.Text
End Sub

Thanks,
Princy.
0
Mark
Top achievements
Rank 1
answered on 04 Jan 2013, 11:32 AM
thanks,

this helped sort it, though there was also another issue affecting it that i spotted...

Tags
Window
Asked by
Mark
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 2
Mark
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or