CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 8/15/2007 5:31:23 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 14 Views: 25 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
15 Items, 1 Pages 1 |< << Go >> >|
specnyt
Asp.Net User
MySQL and Masterpages8/15/2007 5:31:23 AM

0/0

Hello!

I'm just starting out and i'm using asp.net, masterpages, and mysql.. and i'm lost at one part.. and i'm desperately in need of help.. coz this is my submission for tomorrow.. Crying

i'm using mysql 5 with the .net connector 5.1.2.

Here's my problem..

i have a login.aspx page that is not connected to the masterpage. and then 4 other pages, default.aspx, studentinfo.aspx, studentgrades.aspx, and studentschedule.aspx that are connected to my masterpage named studentmasterpage.. i'm able to do everything from skining and changing overall layout and stuff by watching tutorial videos that i borrowed, but i can't connect the figure out how to connect the 3 pages to their databases.

here's how my webpage is supposed to work

 - when a student logs in with his username and password (i coded my own login page because i can't use my tables for the mysqlroleprovider thing), he is directed to the default.aspx page that display some welcome message. the 3 pages are on the left hand side as a treeview menu.

- then lets say the student wants to check his personal information, so he clicks the student information link. and he gets directed to the studentinformation.aspx page. in this page, i have a sqldatasource with a mysql table named studentino and a detailsview to show the data.  and heres where my problem is..

i don't know how to populate the detailsview. i tried to use request.querystring and get the username as a string. but i land on the default.aspx page first.

how can i be able to use the request.querystring, or any other method to be able to select the data from each of the pages?

and the other 2 pages holds the almost the same items, a sqldatasource with their databases and a gridview or detailsview. and each


should i use parameters? how do you use parameters to start with? and what about stored procedures? do i need them? 

sorry if my question seems too long and noobish.. coz i really am a noob... any help is really really appreciated..

 thanks... Smile

 ps. and my codebehind is c# though i'm more proficient with vb.net

thanks again...

 


Sweeperq
Asp.Net User
Re: MySQL and Masterpages8/15/2007 5:54:47 AM

0/0

 If you are going to use MySQL, you'll pretty much have to hand code most of the data access stuff in the code-behind because it is not natively supported by the VS 2005 GUI.  The other option is to let the GUI create the Sql stuff and modify the code (yup, MySQL parameters start with ? instead of @).


When your question has been sufficiently answered, please be sure to mark your question as answered. Also, please share your solution if you had to figure it out on your own!
specnyt
Asp.Net User
Re: MySQL and Masterpages8/15/2007 6:03:36 AM

0/0

mmm.. maybe could you help me out and give me some examples on how to do that? i tried using the parameters but i don't know how to.. i can pass the querystring value from the default.aspx but how can i pass it to the other 3 pages? i'm really lost..

which is actually easier to do? hand code? or use the query builder.. that was the one you were talking about right?  

thanks... 

Sweeperq
Asp.Net User
Re: MySQL and Masterpages8/15/2007 2:09:40 PM

0/0

sorry specnyt, i'm not fully understanding your problem.

i don't know how to populate the detailsview. i tried to use request.querystring and get the username as a string. but i land on the default.aspx page first.

What is redirecting you do the default.aspx page?  How are you passing the information from page to page (maintained in URL or cookie)?


When your question has been sufficiently answered, please be sure to mark your question as answered. Also, please share your solution if you had to figure it out on your own!
specnyt
Asp.Net User
Re: MySQL and Masterpages8/15/2007 4:46:16 PM

0/0

sorry for not being able to make it clear.. its like this..

when the user logs in, he is first directed to a main page called default.aspx. this page is the first masterpage and i just have labels describing what the different link do. like "click on student grades to check your current grades".

mmm.. i tried passing the information to the default page using querystring. like this

Response.Redirect("~/Students/Default.aspx?username=" + UserNameTextBox.Text) 

i can see the querystring on the url on top. but after that, i don't know what to do next..

should i make a hidden text box to get the querystring info from the url? how can i pass the querystring from the default.aspx page to the other 3 pages when the student clicks on the other links.. i'm really lost.. :(

thanks for the reply...  

Sweeperq
Asp.Net User
Re: MySQL and Masterpages8/15/2007 4:54:29 PM

0/0

Unless you really want to embed the username in every single link on the site, your best bet is to use Sessions or Cookies.  After the user successfully logs in, set a Session or Cookie variable with the user details.  You'll probably want to encrypt the information so I can't just go to the site and set a cookie with whatever username I want.

You can then access the session or cookie variable from other pages.


When your question has been sufficiently answered, please be sure to mark your question as answered. Also, please share your solution if you had to figure it out on your own!
specnyt
Asp.Net User
Re: MySQL and Masterpages8/15/2007 5:31:55 PM

0/0

mmm.. how can i do that? by embedding the username you mean that the username will be embedded to the each url everytime they click the link? how can i do that?

and the session and cookies.. how do i go about with it? sorry for the amount of questions.. Sad i actually feel bad asking this much.. but i'm really desperately in need of help...

any tutorials and some examples would really be appreciated.. you'll have my eternal gratitude... Wink 

Sweeperq
Asp.Net User
Re: MySQL and Masterpages8/15/2007 6:12:59 PM

0/0

I highly recommend checkout out the learning resources on this site (http://www.asp.net/learn/).  It sounds like you'll want to hit the quickstarts tutorials, and probably want to get a book or two.


When your question has been sufficiently answered, please be sure to mark your question as answered. Also, please share your solution if you had to figure it out on your own!
specnyt
Asp.Net User
Re: MySQL and Masterpages8/15/2007 6:25:31 PM

0/0

thanks for the recommendations.. i already have a few books about asp.net with me, but none are really helpful when it comes to mysql.. i can't excatly change my database because my backend program is already finished and it would kill me if i have to migrate everything..

what excatly do i have to look for in the quickstart tutorial?

maybe you could explain to me how session variables and cookies work in passing data? all i know about cookies is that they track the user's access to the website right.. like how many times they accessed it.. how can i pass data through that? and i really know nothing about the session variables..
 

Sweeperq
Asp.Net User
Re: MySQL and Masterpages8/15/2007 7:03:13 PM

0/0

Those books you have should have something about Sessions and Cookies in them; they are in not tied to MySQL or SQL Server, but are part of web programming.

The HTTP protocol is stateless.  Every request is treated as a new visit.  Cookies and sessions bridge applications and make them more stateful by allowing you to store information on the user's computer.  A cookie is a small data file that resides on the client's computer.  When someone says, "set a cookie", they mean define a value, assign it to a cookie file, and send it to the user.  As long as the user is set up to accept cookies, you can retreive the values on subsequent requests.  A Session is similar, but it stores values in process on the web server and only sends an identifier cookie.

Example:

Dim strUserName As String = "myUsername"
Session("username") = strUserName        <= sets a session variable
strUserName = Session("username").ToString()      <= gets a session variable

Secondly, when you say that your backend program is already finished, what do you mean?  Do you already have a business and data layer set up?

Example:

Public Sub Login(ByVal strUserName As String, ByVal strPassword As String)
    ' Query your db for login
    If LoginSuccess Then
        Session("username") = strUserName
    Else
        Session("username") = Nothing
    End If
End Sub

Public Function GetUserName()
    Dim strUserName As String = Session("username").ToString()
    If String.IsNullOrEmpty(strUserName) Then
        Response.Redirect("login.aspx")
    Else
        'Query db for user information
    End If
End Function


When your question has been sufficiently answered, please be sure to mark your question as answered. Also, please share your solution if you had to figure it out on your own!
specnyt
Asp.Net User
Re: MySQL and Masterpages8/16/2007 4:02:05 AM

0/0

thanks a lot for the information.. i think i got what the session variables do.. Smile i'm gonna try reading now and see what i can do.. thanks again..

the thing with the backend program is that the we already developed a backend program for the school, and its already been deployed and used.. so i can't just take the system down and replace the database..

Sweeperq:
Dim strUserName As String = "myUsername"
Session("username") = strUserName        <= sets a session variable
strUserName = Session("username").ToString()      <= gets a session variable
 

and just a question with this.. with the first line,

is the myUsername the UserNameTextBox? 

thanks again.. 

Sweeperq
Asp.Net User
Re: MySQL and Masterpages8/16/2007 5:10:12 AM

0/0

no, "myUsername" is a string value.  To set the session equal to a textbox value you would use something like:

Session("username") = tbxUserName.Text      ' Where tbxUserName is the id of your username textbox


When your question has been sufficiently answered, please be sure to mark your question as answered. Also, please share your solution if you had to figure it out on your own!
specnyt
Asp.Net User
Re: MySQL and Masterpages8/16/2007 2:59:18 PM

0/0

thank you so much for the help.. it really pointed me to the right direction, and i really appreciate it.. i was really stuck and was so frustrated with myself..

i'm sorry i was only able to post a reply now.. was busy trying out the codes Smile

oh and one last question, is it alright to pass session state variables between different codebehind files? like from vb.net to c#? 

and again.. thank you Smile  you saved my life!

Sweeperq
Asp.Net User
Re: MySQL and Masterpages8/16/2007 5:02:20 PM

0/0

The Session is available for 20 minutes by default.  As long as the pages are running in the same web site they should be able to access the session (I didn't think it was possible to intermix code types in a single project [e.g. vb.net & c# used for codebehind in same website]).  If you need to access the session values from within your other code-base, you'll need to get them in the web app and pass them as variables.

e.g.:

default.aspx.cs
Dim objOrderDAL As New OrderRepository()
MyDataGrid.DataSource = objOrderDAL.GetOrdersForUser(Session("Username"))
MyDataGrid.DataBind()

OrderRepository.cs
Public Class OrderRepository
    Public Function List<Order> GetOrdersForUser(ByVal strUsername As String)
        ...
    End Function
End Class

Hopefully this will be helpful,
Sam

P.S. - I see you are new to the board, so I would like to remind you to please be sure to mark posts that helped you with your problem as answers.  If you have additional questions that are unrelated to the original question, please post them as new threads to have the best chance of getting them answered.


When your question has been sufficiently answered, please be sure to mark your question as answered. Also, please share your solution if you had to figure it out on your own!
specnyt
Asp.Net User
Re: MySQL and Masterpages8/16/2007 5:23:58 PM

0/0

well.. seeing that i'm just going to pass around the session state variable.. because i already have a login page that uses vb.net to login.. and after that, i'm just gonna pass the session variable to the default.aspx and other pages after, and i don't really have to go back to the login page.. and if possible, i don't want to recode the login page to save time..

so to be able to pass the variable to another code base, i have to make a .cs class to pass it? if i try to pass this just through the session variable would it still work or not?

and thanks for the reminder on the marking the posts as answers, i'll do this at once Smile 

15 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
MySQL and JSP Web Applications: Data-Driven Programming Using Tomcat and MySQL Authors: James Turner, Pages: 560, Published: 2002
Macromedia Dreamweaver MX 2004: Training from the Source Authors: Jeffrey Bardzell, Pages: 512, Published: 2004
Professional ASP.NET 2.0 Design: CSS, Themes, and Master Pages Authors: Jacob J. Sanford, Pages: 474, Published: 2007
Beginning ASP.NET 2.0 with C# Authors: Chris Hart, John Kauffman, David Sussman, Chris Ullman, Pages: 735, Published: 2006
Essential SharePoint 2007: Delivering High-Impact Collaboration Authors: Scott Jamison, Mauro Cardarelli, Susan Hanley, Pages: 446, Published: 2007
Macromedia Dreamweaver MX 2004 avec ASP, PHP et COLDFUSION: training from the source Authors: Jeffrey Bardzell, Pages: 0, Published: 2004
Macromedia Dreamweaver 8 Advanced for Windows and Macintosh: Visual Quickpro Guide Authors: Lucinda Dykes, Pages: 358, Published: 2006
Beginning PHP5, Apache, and MySQL Web Development Authors: Elizabeth Naramore, Michael K. Glass, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz, Pages: 798, Published: 2005
Macromedia Dreamweaver MX Advanced for Windows and Macintosh: Visual Quickpro Guide Authors: J. Tarin Towers, Abie Hadjitarkhani, Sasha Magee, Pages: 490, Published: 2002
Macromedia Dreamweaver 8 with ASP, Coldfusion and PHP: Training from the Source Authors: Jeffrey Bardzell, Pages: 508, Published: 2005

Web:
James' Sandbox: When to use Master Pages, when to use Themes, and ... Sep 11, 2008 ... Master pages are good to have to control the overall look and feel of the end- user .... Run PHP and MySql and ASP.NET on Windows Server 20. ...
MasterPage - where to open the Database Connection for best ... Do I open it in the MasterPage or in the PageLoad of my aspx files? At the moment I'm opening it in the aspx files: MySql.Data.MySqlClient. ...
Articles on master page On ASPCode.net you will find the best best articles on master page. ... NET web application, implementing paging using the cool MySQL feature LIMIT and ...
ASP.NET 2.0 Master Pages Master pages provide templates for other pages on your web site. .... PHP MySQL Hosting · Top 10 Web Hosting · UK Reseller Hosting ...
ASP.NET: How to Convert Your Site To A MasterPage Site in 3 Steps ... MasterPages are wonderful for standardizing your site and your design, ... Fill your new MasterPage with the XHTML that you wish to use on every page. ...
ASP - ASP.NET 2.0 Master Pages Tutorials Because Master Pages are similar to normal ASPX pages, they may contain the ... Name it MasterPage.master. The following graphic shows adding a Master Page ...
Master Pages - Tutorialized Apr 1, 2006 ... MySQL, Oracle, P2P Filesharing, Paint Shop Pro, Perl and CGI, Photoshop ... Learn to use Master Pages to edit documents in QuarkXpress. ...
ASP.NET 2.0 Master Pages Strangeness: msg#00039 NET 2.0 Master Pages Strangeness, Scott Allen. Previous by Thread: ASP.NET 2.0 and MySQL 5.x, Christian Ista. Next by Thread: Re: ASP.NET 2.0 Master Pages ...
Master pages and forms - .NET ASP Master pages and forms. Get answers to your questions in our . ... Do you put your form on the master page or in each individual page? ...
ASP.NET Master Pages - Interview Questions NET Master Pages - What is Master Page in ASP.NET?, Advantages of using Master Page in ASP.NET , Define Multiple Master Page., How do you create Master Page?




Search This Site:










asp.net and windows applications

collapsing menu in left pane to get larger content pane

skin automated install tool?

getting correct eventtarget for postback

is the data provider model usable in complex, business applications?

great way to figure out what caused the app to recycle

dnn3 on a mac?

visual studio 2008 registration problem

how to have master page and content page in different projects

code for the placing a link to a textfile which exists in my project.

"type abstract" error when i try to open default.aspx (dnn3.1.1)

dnn security with other files within the same virtual directory

make personalization with iis windows authentication

commerce started kit problem

how to make page content under menu move down, when a menu item is chosen?

is this possible?

how to hide a button on a asp page from a call from an aspx page?

aspnet menu control

grayed out controls

change master page controls from content page

visual studio 2005 missing items in toolbox

dnn 3.0 localization enh/bug

creating a side menu

debugging the club website locally?

what is the best way to to preserve data between postback

remote degugging using vpn

is there a way to put imagebuttons in the treeview?

location of web control(s) in whidbey

registration benefit portal link

3.0.8 issue: missing modules

 
All Times Are GMT