Vote count:
0
I am after a simple example/quick fix of passing a single value from dialog to asp parent page using JavaScript - if java script is best option that is!
I have made numerous attempts at doing this but failing with each effort so far.
lblVarSelectedDate.Text is the value i would like to post back to parent page to displayed as the lblVarChildSelectedDate value.
Below is part of Register.aspx page (PARENT)
<table>
<tr>
<td colspan="5" align="center"><asp:Label ID="lblDate" runat="server" Text="Selected Date: "></asp:Label><asp:Label ID="lblVarChildSelectedDate" runat="server" ></asp:Label></td>
<td colspan="1" align="center"><asp:Button ID="btnSelectDate" runat="server" Text="Date" /> </td>
</tr
<tr>
<td><asp:Button ID="btOK" runat="server" Text="Ok" /> </td>
</tr>
</table>
This is the VB behind register.aspx...
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Sub btnSelectDate_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSelectDate.Click
Dim Window As String
Window = " window.open('About.aspx', 'MsgWindow', 'width=500, height=500');"
ClientScript.RegisterClientScriptBlock(Me.GetType, "date", Window, true)
End Sub
Sub btnOk_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btOK.Click
End Sub
And now her is my child page selectdate.aspx..
<table>
<tr>
<td colspan="6"><asp:Calendar ID="calSelecter" runat="server" OnSelectionChanged="SelectionChange"></asp:Calendar></td>
</tr>
<tr>
<td colspan="6" align="center"><asp:Label ID="lblConsSelectedDate" runat="server" Text="Selected Date: "></asp:Label><asp:Label ID="lblVarSelectedDate" runat="server" ></asp:Label></td>
</tr
<tr>
<td><asp:Button ID="btOK" runat="server" Text="Ok" /> </td>
</tr>
</table>
Her is the vb behind the child page.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
calSelecter.SelectedDate = Date.Today
lblVarSelectedDate.Text = Date.Today
End Sub
Sub btnOk_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btOK.Click
' .... on click post back to parent page lblVarSelectedDate.Text
End Sub
Sub SelectionChange(ByVal sender As Object, ByVal e As EventArgs)
lblVarSelectedDate.Text = calSelecter.SelectedDate
End Sub
Many Thanks
asked 14 secs ago
Variable from Parent to child ASP
Aucun commentaire:
Enregistrer un commentaire