By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,954 Members | 1,540 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,954 IT Pros & Developers. It's quick & easy.

Passing Values Between Web Pages

Vkas
P: 78
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

Expand|Select|Wrap|Line Numbers
  1. <%@ Control Language="VB" AutoEventWireup="false" CodeFile="calender.ascx.vb" Inherits="calender" %>
  2. &nbsp; 
  3. <table style="width: 190px; height: 186px;">
  4.     <tr>
  5.         <td align="center" colspan="2" style="width: 77px; height: 33px;">
  6.             <asp:TextBox ID="txtdate" runat="server"></asp:TextBox></td>
  7.         <td style="width: 141px; height: 33px;">
  8.             <asp:Button ID="btnshow" runat="server" Text="+" /></td>
  9.     </tr>
  10.     <tr>
  11.         <td colspan="3" rowspan="2" style="height: 95px">
  12.             <asp:Calendar ID="myCalendar" runat="server" BackColor="#FFFFCC" BorderColor="#FFCC66"
  13.                 BorderWidth="1px" DayNameFormat="Short" Font-Names="Verdana" Font-Size="8pt"
  14.                 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">
  15.                 <SelectedDayStyle BackColor="#CCCCFF" Font-Bold="True" />
  16.                 <TodayDayStyle BackColor="#FFCC66" ForeColor="White" />
  17.                 <SelectorStyle BackColor="#FFCC66" />
  18.                 <OtherMonthDayStyle ForeColor="#CC9966" />
  19.                 <NextPrevStyle Font-Size="9pt" ForeColor="#FFFFCC" />
  20.                 <DayHeaderStyle BackColor="#FFCC66" Font-Bold="True" Height="1px" />
  21.                 <TitleStyle BackColor="#990000" Font-Bold="True" Font-Size="9pt" ForeColor="#FFFFCC" />
  22.                 <DayStyle Font-Italic="True" Font-Bold="True" />
  23.             </asp:Calendar>
  24.         </td>
  25.     </tr>
  26.     <tr>
  27.     </tr>
  28. </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

Expand|Select|Wrap|Line Numbers
  1. Public Sub myCalendar_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles myCalendar.SelectionChanged
  2.  
  3.  
  4.  
  5.         txtdate.Text = myCalendar.SelectedDate
  6.  
  7.  
  8.     End Sub
  9.  
  10.     Protected Sub btnshow_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnshow.Click
  11.         If (myCalendar.Visible = True) Then
  12.             myCalendar.Visible = False
  13.  
  14.         Else
  15.             myCalendar.Visible = True
  16.  
  17.         End If
  18.     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
Feb 14 '09 #1
Share this Question
Share on Google+
4 Replies


Vkas
P: 78
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
Expand|Select|Wrap|Line Numbers
  1.  <%@ Control Language="VB" AutoEventWireup="false" CodeFile="calender.ascx.vb" Inherits="calender" %>
  2.  &nbsp; 
  3.  <table style="width: 190px; height: 186px;">
  4.      <tr>
  5.         <td align="center" colspan="2" style="width: 77px; height: 33px;">
  6.              <asp:TextBox ID="txtdate" runat="server"></asp:TextBox></td>
  7.          <td style="width: 141px; height: 33px;">
  8.              <asp:Button ID="btnshow" runat="server" Text="+" /></td>
  9.      </tr>
  10.     <tr>
  11.        <td colspan="3" rowspan="2" style="height: 95px">
  12.             <asp:Calendar ID="myCalendar" runat="server" BackColor="#FFFFCC" BorderColor="#FFCC66"
  13.                 BorderWidth="1px" DayNameFormat="Short" Font-Names="Verdana" Font-Size="8pt"
  14.                 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">
  15.                 <SelectedDayStyle BackColor="#CCCCFF" Font-Bold="True" />
  16.                 <TodayDayStyle BackColor="#FFCC66" ForeColor="White" />
  17.                 <SelectorStyle BackColor="#FFCC66" />
  18.                 <OtherMonthDayStyle ForeColor="#CC9966" />
  19.                  <NextPrevStyle Font-Size="9pt" ForeColor="#FFFFCC" />
  20.                 <DayHeaderStyle BackColor="#FFCC66" Font-Bold="True" Height="1px" />
  21.                 <TitleStyle BackColor="#990000" Font-Bold="True" Font-Size="9pt" ForeColor="#FFFFCC" />
  22.                 <DayStyle Font-Italic="True" Font-Bold="True" />
  23.             </asp:Calendar>
  24.         </td>
  25.     </tr>
  26.     <tr>
  27.     </tr>
  28. </table> 
  29.  


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

Expand|Select|Wrap|Line Numbers
  1.  Public Sub myCalendar_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles myCalendar.SelectionChanged
  2.  
  3.          txtdate.Text = myCalendar.SelectedDate
  4.  
  5.  
  6.      End Sub
  7.  
  8.     Protected Sub btnshow_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnshow.Click
  9.          If (myCalendar.Visible = True) Then
  10.              myCalendar.Visible = False
  11.  
  12.         Else
  13.              myCalendar.Visible = True
  14.  
  15.         End If
  16.    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
Feb 16 '09 #2

Expert 100+
P: 750
PRR
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...
Feb 16 '09 #3

Frinavale
Expert Mod 5K+
P: 9,731
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
Feb 17 '09 #4

Vkas
P: 78
ok
i will check it if could not understand then will come back soon
let me check
Feb 18 '09 #5

Post your reply

Sign in to post your reply or Sign up for a free account.