McSick's Profile User Rating: -----

Reputation: 33 Craftsman
Group:
Active Members
Active Posts:
178 (0.11 per day)
Joined:
02-September 10
Profile Views:
3,424
Last Active:
User is offline Mar 05 2014 09:04 AM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Linux
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Chevrolet
Dream Kudos:
0
Icon   McSick has not set their status

Posts I've Made

  1. In Topic: Odd or Even Program

    Posted 10 Apr 2013

    Here is my go at this without modulus. Trying for speed here! Bitwise "&" is faster than modulo.
    SRC: http://jacksondunsta...m/articles/1946

    print("This is a program to see if an integer is odd or even.")
    
    
    num = input('Enter the number here: ')
    
    if (num & 1) == 0:
        print('The integer '+ str(num)+ ' is even.')
    else:
        print('The integer '+ str(num) +' is odd.')
    
    
    
  2. In Topic: Run function one time on Page start

    Posted 10 Apr 2013

    View Posttrevster344, on 10 April 2013 - 10:10 AM, said:

    That's also why I suggested Application variables because as long as the page is in the directory of the application it will always maintain the variables.


    You could use them however I think they seem to be out of the scope needed. What I got from his question is that he is generating a math problem every time he visits the page (maybe at random?) and thus the values and correct answer need only be saved on this one page on this visit. In that sense a ViewState would make more sense since it would persist across the postbacks but once the page is not a postback (coming back to answer a new problem?) he would generate and save those variables in the viewstate to be used again since they are potentially new. It depends on what exactly he is trying to do.
  3. In Topic: Load fields from database

    Posted 10 Apr 2013

    You don't have to databind text fields. Grab the data from the database and most input object have a Text property you can edit. See psuedo code below!

    PageLoad()
    {
      data = getSomeDataFromDatabase();
      input1.Text = data.columnToSave; //Parse data basically
    
    }
    
    
    


    Things to look out for, make the text field or input have an id! You will use that id to access the Text property in your code. Make sure that your text field or input have the attribute runat="server" or getting the control will be a bit harder as in terms of code.
  4. In Topic: Run function one time on Page start

    Posted 10 Apr 2013

    Since you are using C#, I suggest looking into ViewState and Session for Asp.net.

    ViewState
    Anything stored persists to a single page only. For example if you had a page onepage.aspx, any variables in the viewstate will stay on postbacks. However moving to anotherpage.aspx and then back and all the variables would disappear.

    Session
    All session variables persist across website pages for a given session. So in the example above going from onepage.aspx to anotherpage.aspx and then back to onepage.aspx and session variables are stored. However going from another domain back to your domain and session variables are lost.


    More information on ViewState
    http://msdn.microsof...y/ms972976.aspx
    And on Session
    http://msdn.microsof...(v=vs.100).aspx

    Both have example code that go along with it!

My Information

Member Title:
D.I.C Head
Age:
24 years old
Birthday:
December 29, 1990
Gender:
Location:
West Lafayette, Indiana
Interests:
Gaming, programming, basketball, football, baseball, sleeping, eating, and lights. That's led lights, strobe lights, black lights, rope lights, lasers, any thing of the such.
Full Name:
Michael Sickles
Programming Languages:
C, C++,C#/ASP.NET,Assembly, Matlab, VB6, Python, Autoit, MySQL, PHP, HTML, Javascript

Contact Information

E-mail:
Click here to e-mail me
AIM:
AIM  McSick90
Facebook:
http://www.facebook.com/McSick

Friends

Comments

McSick has no profile comments yet. Why not say hello?