1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Dynamically changing the button initial

Discussion in 'C#' started by rag84dec, Feb 4, 2008.

  1. #1
    Hi,
    I have an asp code which creates a grid or matrics (5 x 5 matrics).Each cell contains a button which will have an initial
    .The initial will be read from a database.

    say the database has these entries...table name is "TestSuite"
    ---------- ------- --------
    | Initial | Name |
    ---------- ------- --------
    | S | TestSuite1 |
    -------------------------------
    | R | Suite2
    -------------------------------
    |G | Suite3
    -------------------------------
    | T | Suite4
    -------------------------------


    Initially the button should contain "S" or the first entry of the database and on clicking the button it should change to the next initial say "R".
    SEMrush
    On clicking the button it should keep changing to the next entry till the last and again from first.


    How can i do??...With javascript function??....Earlier i had a combo box which had all the initial in it.User had an option to select a particular "Initial'....Can any one please help me in having a dynamic button??....
     
    rag84dec, Feb 4, 2008 IP
    SEMrush
  2. urstop

    urstop Peon

    Messages:
    224
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can do it in any of the three ways given below

    1. If records are few may be less than couple of 100 or so, you can get the data from the database and assign it to some client side Javascript array and in each button click you can get data from the next time in the array and set the button text.
    2. In each button click, you post back the page, go to the database and select the next row and set the button text to the data.
    3. You can use AJAX and in each button click do a AJAX request get the needed data and change the button text from the data.
     
    urstop, Feb 5, 2008 IP