Passing Values Between Web Pages

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Vkas
    New Member
    • Feb 2009
    • 78

    Passing Values Between Web Pages

    HELLO!!!!!!!!!! !!!
    me using
    ASP.net 2.0, language VB.net!
    working tool Visula studio.Net 2005

    I HAVE CREATED A simple WEB User control (calender.ascx) having
    a text box ,
    a button,
    and a calender control

    Code:
    <%@ Control Language="VB" AutoEventWireup="false" CodeFile="calender.ascx.vb" Inherits="calender" %>
    &nbsp; 
    <table style="width: 190px; height: 186px;">
        <tr>
            <td align="center" colspan="2" style="width: 77px; height: 33px;">
                <asp:TextBox ID="txtdate" runat="server"></asp:TextBox></td>
            <td style="width: 141px; height: 33px;">
                <asp:Button ID="btnshow" runat="server" Text="+" /></td>
        </tr>
        <tr>
            <td colspan="3" rowspan="2" style="height: 95px">
                <asp:Calendar ID="myCalendar" runat="server" BackColor="#FFFFCC" BorderColor="#FFCC66"
                    BorderWidth="1px" DayNameFormat="Short" Font-Names="Verdana" Font-Size="8pt"
                    ForeColor="#663399" Height="144px" ShowGridLines="True" Width="180px" VisibleDate="2/12/2009" UseAccessibleHeader="true" DayStyle-Font-Italic="false" Font-Bold="true" SelectedDayStyle-BorderStyle="NotSet" SelectionMode="DayWeekMonth" DayStyle-Font-Bold="true" NextPrevFormat="ShortMonth" Visible="False">
                    <SelectedDayStyle BackColor="#CCCCFF" Font-Bold="True" />
                    <TodayDayStyle BackColor="#FFCC66" ForeColor="White" />
                    <SelectorStyle BackColor="#FFCC66" />
                    <OtherMonthDayStyle ForeColor="#CC9966" />
                    <NextPrevStyle Font-Size="9pt" ForeColor="#FFFFCC" />
                    <DayHeaderStyle BackColor="#FFCC66" Font-Bold="True" Height="1px" />
                    <TitleStyle BackColor="#990000" Font-Bold="True" Font-Size="9pt" ForeColor="#FFFFCC" />
                    <DayStyle Font-Italic="True" Font-Bold="True" />
                </asp:Calendar>
            </td>
        </tr>
        <tr>
        </tr>
    </table>



    AND THE CODE BEHIND FILE MY CODING IS (calender.ascx. vb) is as follow
    through which i show the selected date in my textbox and the button helps in hiding and displaying the calender

    Code:
    Public Sub myCalendar_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles myCalendar.SelectionChanged
    
    
    
            txtdate.Text = myCalendar.SelectedDate
    
    
        End Sub
    
        Protected Sub btnshow_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnshow.Click
            If (myCalendar.Visible = True) Then
                myCalendar.Visible = False
    
            Else
                myCalendar.Visible = True
    
            End If
        End Sub
    MY PROBLEM

    how can i get the value of this calender.ascx in another page!!!

    OR how to use and get the Value of t his control in other pages of my application
    kindly guide me !!!!!!!!!!!!!!! !!!11
    Last edited by kenobewan; Feb 15 '09, 12:21 PM. Reason: Reoved unnecessary bold tags and added code tags
  • Vkas
    New Member
    • Feb 2009
    • 78

    #2
    help yar

    HELLO!!!!!!!!!! !!!
    me using
    ASP.net 2.0, language VB.net!
    working tool Visula studio.Net 2005

    I HAVE CREATED A simple WEB User control (calender.ascx) having
    a text box ,
    a button,
    and a calender control
    Code:
     <%@ Control Language="VB" AutoEventWireup="false" CodeFile="calender.ascx.vb" Inherits="calender" %>
     &nbsp; 
     <table style="width: 190px; height: 186px;">
         <tr>
            <td align="center" colspan="2" style="width: 77px; height: 33px;">
                 <asp:TextBox ID="txtdate" runat="server"></asp:TextBox></td>
             <td style="width: 141px; height: 33px;">
                 <asp:Button ID="btnshow" runat="server" Text="+" /></td>
         </tr>
        <tr>
           <td colspan="3" rowspan="2" style="height: 95px">
                <asp:Calendar ID="myCalendar" runat="server" BackColor="#FFFFCC" BorderColor="#FFCC66"
                    BorderWidth="1px" DayNameFormat="Short" Font-Names="Verdana" Font-Size="8pt"
                    ForeColor="#663399" Height="144px" ShowGridLines="True" Width="180px" VisibleDate="2/12/2009" UseAccessibleHeader="true" DayStyle-Font-Italic="false" Font-Bold="true" SelectedDayStyle-BorderStyle="NotSet" SelectionMode="DayWeekMonth" DayStyle-Font-Bold="true" NextPrevFormat="ShortMonth" Visible="False">
                    <SelectedDayStyle BackColor="#CCCCFF" Font-Bold="True" />
                    <TodayDayStyle BackColor="#FFCC66" ForeColor="White" />
                    <SelectorStyle BackColor="#FFCC66" />
                    <OtherMonthDayStyle ForeColor="#CC9966" />
                     <NextPrevStyle Font-Size="9pt" ForeColor="#FFFFCC" />
                    <DayHeaderStyle BackColor="#FFCC66" Font-Bold="True" Height="1px" />
                    <TitleStyle BackColor="#990000" Font-Bold="True" Font-Size="9pt" ForeColor="#FFFFCC" />
                    <DayStyle Font-Italic="True" Font-Bold="True" />
                </asp:Calendar>
            </td>
        </tr>
        <tr>
        </tr>
    </table>


    AND THE CODE BEHIND FILE MY CODING IS (calender.ascx. vb) is as follow
    through which i show the selected date in my textbox and the button helps in hiding and displaying the calender

    Code:
     Public Sub myCalendar_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles myCalendar.SelectionChanged
    
             txtdate.Text = myCalendar.SelectedDate
      
    
         End Sub
    
        Protected Sub btnshow_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnshow.Click
             If (myCalendar.Visible = True) Then
                 myCalendar.Visible = False
      
            Else
                 myCalendar.Visible = True
      
            End If
       End Sub
    MY PROBLEM

    how can i get the value of this calender.ascx in another page!!!

    OR how to use and get the Value of t his control in other pages of my application
    kindly guide me !!!!!!!!!!!!!!! !!!11
    Last edited by Frinavale; Feb 17 '09, 02:13 PM. Reason: added code tags and merged double posts

    Comment

    • PRR
      Recognized Expert Contributor
      • Dec 2007
      • 750

      #3
      Take a look at : Include a User Control in an ASP.NET Web Page
      and
      Create an ASP.NET User Control
      Also use a more appropriate title for your question...

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        There are a lot of ways to pass information between web pages....for example:

        You could store the selected date in Session.
        When you store something in Session, that value is kept on the server and made available to every page in the web site. See the article titled: Sessions: how pass information between web pages for more information.

        You could also use Cookies to pass information between web pages.
        You'll have to create a cookie, store the date in it, and then access the cookie in the next page.

        You could also look into using the Server.Transfer method. Make sure you fully understand how Server.Transfer works before using it because it could cause server side performance problems if not used correctly.



        -Frinny

        Comment

        • Vkas
          New Member
          • Feb 2009
          • 78

          #5
          ok
          i will check it if could not understand then will come back soon
          let me check

          Comment

          Working...