showcasing html page while clicking a button in same web page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • maddiashok
    New Member
    • Sep 2008
    • 7

    showcasing html page while clicking a button in same web page

    Hi,
    How to redirect the Html page in spcicific location, while clicking hyperlink or link button.

    Please help me i am fresher for Asp.net.
    its urgent


    Thank you....
  • maddiashok
    New Member
    • Sep 2008
    • 7

    #2
    showcasing html page while clicking a button in same web page

    Hi,
    I want to showcase html page while clicking a button in same web page
    is it possible or not
    if possible how send me the sample code

    Please help me regarding this task

    thank you

    Comment

    • shweta123
      Recognized Expert Contributor
      • Nov 2006
      • 692

      #3
      Hi,

      To redirect the Html page to different location you have to write code on OnClick event of Link button.
      e.g.

      In aspx page create LinkButton tag like the following way :

      Code:
      <asp:LinkButton ID="LinkButton1" runat="server" OnClick = "LinkButton1_Click" >LinkButton</asp:LinkButton>
      In code behind page write the following code :
      Code:
       
      Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton1.Click
              Response.Redirect("Default.aspx")
      End Sub

      Comment

      • kenobewan
        Recognized Expert Specialist
        • Dec 2006
        • 4871

        #4
        I don't see what the problem is - what have you tried?

        Comment

        • Frinavale
          Recognized Expert Expert
          • Oct 2006
          • 9749

          #5
          I don't understand what you mean by "showcasing "
          Could you please provide more details on what you are trying to achieve along with what you've tried so far.

          Comment

          • Frinavale
            Recognized Expert Expert
            • Oct 2006
            • 9749

            #6
            Or it cold be as simple as adding a regular HTML hyper link to the page....the hyperlink will have the href="theUrlOfT heNewPage". Hyperlinks will only work if you don't require any processing before passing the user on to the other page.

            Comment

            • maddiashok
              New Member
              • Sep 2008
              • 7

              #7
              Hi,

              File upload control

              Protected Sub FileUpload1_Loa d(ByVal sender As Object, ByVal e As System.EventArg s) Handles FileUpload1.Loa d

              If FileUpload1.Has File Then
              Label1.Text = "Received " & FileUpload1.Fil eName & " Content Type " & FileUpload1.Pos tedFile.Content Type & " Length " & FileUpload1.Pos tedFile.Content Length
              Else
              Label1.Text = "Upload file"
              End If

              End Sub

              Upload Button:

              If FileUpload1.Pos tedFile Is Nothing Then
              Me.Label1.Text = "No File Selected to Upload."
              Exit Sub
              End If

              strName = System.IO.Path. GetFileName(Fil eUpload1.Posted File.FileName)

              Try
              FileUpload1.Pos tedFile.SaveAs( "Path" + strName)
              Me.Label1.Text = """" + strName + """ was uploaded successfully."
              Catch ex As Exception
              Me.Label1.Text = "An Error Occured While Uploading File."
              End Try

              Here i am able to upload the html file, But i want to show or open the uploaded file by clicking InputView Button, in the same web page Bottom or a pop up window. and i am unable catch the file name which one am i uploading. i want to catch the file name and have2 store in a string and have2 use in other buttons in same web page.

              Comment

              • maddiashok
                New Member
                • Sep 2008
                • 7

                #8
                Hi,

                File upload contole

                Protected Sub FileUpload1_Loa d(ByVal sender As Object, ByVal e As System.EventArg s) Handles FileUpload1.Loa d

                If FileUpload1.Has File Then
                Label1.Text = "Received " & FileUpload1.Fil eName & " Content Type " & FileUpload1.Pos tedFile.Content Type & " Length " & FileUpload1.Pos tedFile.Content Length
                Else
                Label1.Text = "Upload file"
                End If

                End Sub

                Upload Button:

                If FileUpload1.Pos tedFile Is Nothing Then
                Me.Label1.Text = "No File Selected to Upload."
                Exit Sub
                End If

                strName = System.IO.Path. GetFileName(Fil eUpload1.Posted File.FileName)

                Try
                FileUpload1.Pos tedFile.SaveAs( "Path" + strName)
                Me.Label1.Text = """" + strName + """ was uploaded successfully."
                Catch ex As Exception
                Me.Label1.Text = "An Error Occured While Uploading File."
                End Try

                Here i am able to upload the html file, But i want to show or open the uploaded file by clicking InputView Button, in the same web page Bottom or a pop up window. and i am unable catch the file name which one am i uploading. i want to catch the file name and have2 store in a string and have2 use in other buttons in same web page.


                Originally posted by kenobewan
                I don't see what the problem is - what have you tried?

                Comment

                • maddiashok
                  New Member
                  • Sep 2008
                  • 7

                  #9
                  Hi,

                  File upload control

                  Protected Sub FileUpload1_Loa d(ByVal sender As Object, ByVal e As System.EventArg s) Handles FileUpload1.Loa d

                  If FileUpload1.Has File Then
                  Label1.Text = "Received " & FileUpload1.Fil eName & " Content Type " & FileUpload1.Pos tedFile.Content Type & " Length " & FileUpload1.Pos tedFile.Content Length
                  Else
                  Label1.Text = "Upload file"
                  End If

                  End Sub

                  Upload Button:

                  If FileUpload1.Pos tedFile Is Nothing Then
                  Me.Label1.Text = "No File Selected to Upload."
                  Exit Sub
                  End If

                  strName = System.IO.Path. GetFileName(Fil eUpload1.Posted File.FileName)

                  Try
                  FileUpload1.Pos tedFile.SaveAs( "Path" + strName)
                  Me.Label1.Text = """" + strName + """ was uploaded successfully."
                  Catch ex As Exception
                  Me.Label1.Text = "An Error Occured While Uploading File."
                  End Try

                  Here i am able to upload the html file, But i want to show or open the uploaded file by clicking InputView Button, in the same web page Bottom or a pop up window. and i am unable catch the file name which one am i uploading. i want to catch the file name and have2 store in a string and have2 use in other buttons in same web page.







                  Originally posted by Frinavale
                  I don't understand what you mean by "shwocasing "
                  Could you please provide more details on what you are trying to achieve along with what you've tried so far.

                  Comment

                  • balabaster
                    Recognized Expert Contributor
                    • Mar 2007
                    • 798

                    #10
                    You know I read that whole post and it might have well been written in Greek... come again?

                    Comment

                    • maddiashok
                      New Member
                      • Sep 2008
                      • 7

                      #11
                      Originally posted by shweta123
                      Hi,

                      To redirect the Html page to different location you have to write code on OnClick event of Link button.
                      e.g.

                      In aspx page create LinkButton tag like the following way :

                      Code:
                      <asp:LinkButton ID="LinkButton1" runat="server" OnClick = "LinkButton1_Click" >LinkButton</asp:LinkButton>
                      In code behind page write the following code :
                      Code:
                       
                      Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton1.Click
                              Response.Redirect("Default.aspx")
                      End Sub

                      Hi,
                      Thank you for reply

                      Actually what am i trying, i am uploading an html file, after clicking upload button file should be upload, next when i click on input view button, it should open uploaded html file as a separate webpage.

                      please see the code what am i tried, hera i am able to upload. I want to open in separate webpage.

                      File upload
                      Code:
                      Protected Sub FileUpload1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles FileUpload1.Load
                      
                           If FileUpload1.HasFile Then
                                Label1.Text = "Received " & FileUpload1.FileName & " Content Type " & FileUpload1.PostedFile.ContentType & " Length " & FileUpload1.PostedFile.ContentLength 
                           Else
                                Label1.Text = "Upload file"
                           End If
                      
                      End Sub
                      Upload Button:
                      Code:
                      If FileUpload1.PostedFile Is Nothing Then
                           Me.Label1.Text = "No File Selected to Upload."
                           Exit Sub
                      End If
                      
                      strName = System.IO.Path.GetFileName(FileUpload1.PostedFile. FileName)
                      
                      Try
                           FileUpload1.PostedFile.SaveAs("Path" + strName)
                           Me.Label1.Text = """" + strName + """ was uploaded successfully."
                           Catch ex As Exception
                                Me.Label1.Text = "An Error Occured While Uploading File."
                           End Try
                      End Sub
                      Input Button

                      What Am i to write to open uploaded html file as separate web page.
                      Last edited by Frinavale; Sep 18 '08, 01:04 PM. Reason: added [code] tags

                      Comment

                      • shweta123
                        Recognized Expert Contributor
                        • Nov 2006
                        • 692

                        #12
                        Hi,

                        You can set postBackUrl property of your Input Button to redirect to the required Html page.
                        e.g.

                        <asp:Button ID="Button1" runat="server" Text="Button" PostBackUrl ="Yourpage.html " />

                        Comment

                        • Frinavale
                          Recognized Expert Expert
                          • Oct 2006
                          • 9749

                          #13
                          I have merged your threads into one because it is very difficult to help you when you have 2 of the same question posted at one time.

                          Please do not double post your question in the future. There is a rule about Double Posting outlined in Posting Guidelines.

                          Please take the time to review all of the rules in the Posting Guidelines so that we can answer your questions more quickly and easily.

                          Also remember to use code tags when posting code snippets.

                          -Moderator Frinny

                          Comment

                          • maddiashok
                            New Member
                            • Sep 2008
                            • 7

                            #14
                            Hi Members,
                            Thanks I got Solution, For My post.
                            Thank you shweta123.

                            Comment

                            Working...