pass a value to same page on clicking a button in asp.net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • priravi
    New Member
    • May 2007
    • 11

    pass a value to same page on clicking a button in asp.net

    Hi

    i'm new to asp .. and .net environment.. the task is on clicking a button i want the same page to be posted back with an additional flag variable..and then i want to check this variable and based on it i have to follow a different path

    so i tried in the onclick event of the image button to call the same page

    e.g default.aspx?'& amp;flagvalue=1 '

    and in the codebehind on page load event if i try to get the value

    using request.queryst ring , it always seems to be null ami missing something here

    or is there any better way than this


    thanks in advance
  • prabunewindia
    New Member
    • Mar 2007
    • 199

    #2
    hi friend,
    give the exact code u used to pass value thru query string and to get the value

    Prabu


    Originally posted by priravi
    Hi

    i'm new to asp .. and .net environment.. the task is on clicking a button i want the same page to be posted back with an additional flag variable..and then i want to check this variable and based on it i have to follow a different path

    so i tried in the onclick event of the image button to call the same page

    e.g default.aspx?'& amp;flagvalue=1 '

    and in the codebehind on page load event if i try to get the value

    using request.queryst ring , it always seems to be null ami missing something here

    or is there any better way than this


    thanks in advance

    Comment

    • priravi
      New Member
      • May 2007
      • 11

      #3
      Originally posted by prabunewindia
      hi friend,
      give the exact code u used to pass value thru query string and to get the value

      Prabu
      hi

      <input type=hidden id="favouritefl ag" value ="">

      <td border=0>
      <input type="image" align ="absbottom" src="images/favourite.gif" alt="My favourites" border=0 style="cursor:h and;" onclick=" 'cb_datalist.as px?Title=Concep t Bank&amp;profil e=' +'<%=Session["s_repositoryId "]%>'+ '&amp;workspace id='+workspace + '&amp;parentid= 0'+ '&amp;favourite flag=1'" >
      </td>


      and in the code behind in pageload event,i gave
      if(Request.Quer yString["favouritef lag"]!=null)
      {
      Session["favflag"]= Request.QuerySt ring["favouritef lag"];

      }

      Comment

      • pankajprakash
        New Member
        • Feb 2007
        • 70

        #4
        I just want to show the text before of paging, is there any property to set the text before the page index.

        Comment

        • prabunewindia
          New Member
          • Mar 2007
          • 199

          #5
          hi friend,
          i think there is a space between Concept and Bank
          remove the space and try

          Prabu

          Originally posted by priravi
          hi

          <input type=hidden id="favouritefl ag" value ="">

          <td border=0>
          <input type="image" align ="absbottom" src="images/favourite.gif" alt="My favourites" border=0 style="cursor:h and;" onclick=" 'cb_datalist.as px?Title=Concep t Bank&amp;profil e=' +'<%=Session["s_repositoryId "]%>'+ '&amp;workspace id='+workspace + '&amp;parentid= 0'+ '&amp;favourite flag=1'" >
          </td>


          and in the code behind in pageload event,i gave
          if(Request.Quer yString["favouritef lag"]!=null)
          {
          Session["favflag"]= Request.QuerySt ring["favouritef lag"];

          }

          Comment

          • kenobewan
            Recognized Expert Specialist
            • Dec 2006
            • 4871

            #6
            You could do some of the above or you could find the values in a simple onclick. HTH.

            Comment

            Working...