Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Hi, I need help !!!

Hi, I need help !!!

Scheduled Pinned Locked Moved ASP.NET
databasehelptutorialquestion
15 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • _ Offline
    _ Offline
    _ASPAle_
    wrote on last edited by
    #1

    Hi, sorry for my bad english, but I'm italian xD! However, At this link there is an image that explain you what I want to do.(first look at it!!!) Link The foto!! I want when I click on a row of gridview, send me to another page that do see the detail of what I clicked. For example if I click on the picture of "Alfa Romeo", I must see the detail of the car in another gridview in another page. The path of the photos is stored in the database in the field 'FotoEsterno'. Someone can help me?

    N N S S _ 5 Replies Last reply
    0
    • _ _ASPAle_

      Hi, sorry for my bad english, but I'm italian xD! However, At this link there is an image that explain you what I want to do.(first look at it!!!) Link The foto!! I want when I click on a row of gridview, send me to another page that do see the detail of what I clicked. For example if I click on the picture of "Alfa Romeo", I must see the detail of the car in another gridview in another page. The path of the photos is stored in the database in the field 'FotoEsterno'. Someone can help me?

      N Offline
      N Offline
      Nisha Agrawal
      wrote on last edited by
      #2

      for that u have to handle RowDataBound and SelectedIndexChanged Events. Below is the code

      protected void gvItems_SelectedIndexChanged(object sender, EventArgs e)
      {
      Response.Redirect("ToPage.aspx?SelectedItemId=" + gvItems.SelectedDataKey.Value)
      }

      protected void gvItems_RowDataBound(object sender, GridViewRowEventArgs e)
      {
      if(e.Row.RowType==DataControlRowType.DataRow)
      {
      e.Row.Attributes.Add("onclick", ClientScript.GetPostBackEventReference(this.gvItems, "Select$" + e.Row.RowIndex));
      }
      }

      Now at ToPage.aspx u have the Id of the Selected Item so you can display the data related to that item as you want to display.

      N _ 2 Replies Last reply
      0
      • N Nisha Agrawal

        for that u have to handle RowDataBound and SelectedIndexChanged Events. Below is the code

        protected void gvItems_SelectedIndexChanged(object sender, EventArgs e)
        {
        Response.Redirect("ToPage.aspx?SelectedItemId=" + gvItems.SelectedDataKey.Value)
        }

        protected void gvItems_RowDataBound(object sender, GridViewRowEventArgs e)
        {
        if(e.Row.RowType==DataControlRowType.DataRow)
        {
        e.Row.Attributes.Add("onclick", ClientScript.GetPostBackEventReference(this.gvItems, "Select$" + e.Row.RowIndex));
        }
        }

        Now at ToPage.aspx u have the Id of the Selected Item so you can display the data related to that item as you want to display.

        N Offline
        N Offline
        Not Active
        wrote on last edited by
        #3

        Waste of time doing a Response.Redirect from a postback event, just use a Hyperlink column.


        only two letters away from being an asset

        S N 2 Replies Last reply
        0
        • _ _ASPAle_

          Hi, sorry for my bad english, but I'm italian xD! However, At this link there is an image that explain you what I want to do.(first look at it!!!) Link The foto!! I want when I click on a row of gridview, send me to another page that do see the detail of what I clicked. For example if I click on the picture of "Alfa Romeo", I must see the detail of the car in another gridview in another page. The path of the photos is stored in the database in the field 'FotoEsterno'. Someone can help me?

          S Offline
          S Offline
          sashidhar
          wrote on last edited by
          #4

          <ItemTemplate>
          <asp:LinkButton ID ="LinkButtonemp" CausesValidation="false" Text='<%# Eval("EmployeeName") %>' runat="server" CommandArgument='<% #Eval("EmployeeID")%>' CommandName="View" CssClass="gridlnk"/>
          </ItemTemplate>

          Append the name/ID to the querystring and redirect it to another page say InfoPage.aspx.In info page Request the query String .With the Help of Query String Get the Data in the InfoPage.aspx.

          If It Helps Click It as Answer

          1 Reply Last reply
          0
          • _ _ASPAle_

            Hi, sorry for my bad english, but I'm italian xD! However, At this link there is an image that explain you what I want to do.(first look at it!!!) Link The foto!! I want when I click on a row of gridview, send me to another page that do see the detail of what I clicked. For example if I click on the picture of "Alfa Romeo", I must see the detail of the car in another gridview in another page. The path of the photos is stored in the database in the field 'FotoEsterno'. Someone can help me?

            N Offline
            N Offline
            Not Active
            wrote on last edited by
            #5

            Use a Hyperlink column or a Template column to place the link in the grid


            only two letters away from being an asset

            1 Reply Last reply
            0
            • _ _ASPAle_

              Hi, sorry for my bad english, but I'm italian xD! However, At this link there is an image that explain you what I want to do.(first look at it!!!) Link The foto!! I want when I click on a row of gridview, send me to another page that do see the detail of what I clicked. For example if I click on the picture of "Alfa Romeo", I must see the detail of the car in another gridview in another page. The path of the photos is stored in the database in the field 'FotoEsterno'. Someone can help me?

              S Offline
              S Offline
              S Dhanasekaran
              wrote on last edited by
              #6

              Hi, do changes in frist column(Viewdetails) <asp:HyperLink ID="hypTitle" NavigateUrl='<%#"secondpage.aspx?pid="+DataBinder.Eval(Container.DataItem,"picid")%>' Text='<%#DataBinder.Eval(Container.DataItem,"picturename") %>' runat="server" ></asp:HyperLink> when click the viewdetails column, i pass Querystring("pid") value of current picture. On second page, get value from querystring("pid"), using to display the picture.

              S 1 Reply Last reply
              0
              • N Not Active

                Waste of time doing a Response.Redirect from a postback event, just use a Hyperlink column.


                only two letters away from being an asset

                S Offline
                S Offline
                sashidhar
                wrote on last edited by
                #7

                Mark Nischalke wrote:

                Waste of time

                Yes He is right Try to use ItemTemplate as Mark suggests

                If It Helps Click It as Answer

                1 Reply Last reply
                0
                • S S Dhanasekaran

                  Hi, do changes in frist column(Viewdetails) <asp:HyperLink ID="hypTitle" NavigateUrl='<%#"secondpage.aspx?pid="+DataBinder.Eval(Container.DataItem,"picid")%>' Text='<%#DataBinder.Eval(Container.DataItem,"picturename") %>' runat="server" ></asp:HyperLink> when click the viewdetails column, i pass Querystring("pid") value of current picture. On second page, get value from querystring("pid"), using to display the picture.

                  S Offline
                  S Offline
                  sashidhar
                  wrote on last edited by
                  #8

                  Good Answer But Try to use pre tags i.e. code block so he can understand easily:cool:

                  If It Helps Click It as Answer

                  1 Reply Last reply
                  0
                  • N Not Active

                    Waste of time doing a Response.Redirect from a postback event, just use a Hyperlink column.


                    only two letters away from being an asset

                    N Offline
                    N Offline
                    Nisha Agrawal
                    wrote on last edited by
                    #9

                    But the original requirement was to able to click on datarow not any control in the gridview row. thats why i have prvovided that code. please read the requirement carefully.

                    N 1 Reply Last reply
                    0
                    • N Nisha Agrawal

                      But the original requirement was to able to click on datarow not any control in the gridview row. thats why i have prvovided that code. please read the requirement carefully.

                      N Offline
                      N Offline
                      Not Active
                      wrote on last edited by
                      #10

                      Nisha Agrawal wrote:

                      please read the requirement carefully.

                      Please look at all of the requirements. The image clearly shows and says the OP want to click on a LINK


                      only two letters away from being an asset

                      N 1 Reply Last reply
                      0
                      • _ _ASPAle_

                        Hi, sorry for my bad english, but I'm italian xD! However, At this link there is an image that explain you what I want to do.(first look at it!!!) Link The foto!! I want when I click on a row of gridview, send me to another page that do see the detail of what I clicked. For example if I click on the picture of "Alfa Romeo", I must see the detail of the car in another gridview in another page. The path of the photos is stored in the database in the field 'FotoEsterno'. Someone can help me?

                        _ Offline
                        _ Offline
                        _ASPAle_
                        wrote on last edited by
                        #11

                        Thank you guys!!!

                        1 Reply Last reply
                        0
                        • N Not Active

                          Nisha Agrawal wrote:

                          please read the requirement carefully.

                          Please look at all of the requirements. The image clearly shows and says the OP want to click on a LINK


                          only two letters away from being an asset

                          N Offline
                          N Offline
                          Nisha Agrawal
                          wrote on last edited by
                          #12

                          yes, it's my mistake. I just followed the words that were written in the main post and ignored the one in the image.

                          1 Reply Last reply
                          0
                          • N Nisha Agrawal

                            for that u have to handle RowDataBound and SelectedIndexChanged Events. Below is the code

                            protected void gvItems_SelectedIndexChanged(object sender, EventArgs e)
                            {
                            Response.Redirect("ToPage.aspx?SelectedItemId=" + gvItems.SelectedDataKey.Value)
                            }

                            protected void gvItems_RowDataBound(object sender, GridViewRowEventArgs e)
                            {
                            if(e.Row.RowType==DataControlRowType.DataRow)
                            {
                            e.Row.Attributes.Add("onclick", ClientScript.GetPostBackEventReference(this.gvItems, "Select$" + e.Row.RowIndex));
                            }
                            }

                            Now at ToPage.aspx u have the Id of the Selected Item so you can display the data related to that item as you want to display.

                            _ Offline
                            _ Offline
                            _ASPAle_
                            wrote on last edited by
                            #13

                            Ok, it works, because when I click the link, it has this value "http://localhost:3849/progetto/visualizza.aspx?IDModello=24," but now to see the data, including other photos in the DataList , how should I proceed?

                            S 1 Reply Last reply
                            0
                            • _ _ASPAle_

                              Ok, it works, because when I click the link, it has this value "http://localhost:3849/progetto/visualizza.aspx?IDModello=24," but now to see the data, including other photos in the DataList , how should I proceed?

                              S Offline
                              S Offline
                              sashidhar
                              wrote on last edited by
                              #14

                              _ASPAle_ wrote:

                              but now to see the data

                              Can You please explain in detail.I didnt get Your point. Depending upon the IDModello You can present the data .If You want to access the previous data provide a link. If You want to See all the other photos Provide a next button or image slider.If that is the case use the below links it may help. http://www.asp.net/AJAX/AjaxControlToolkit/Samples/SlideShow/SlideShow.aspx[^] http://aspnet.4guysfromrolla.com/articles/070704-1.aspx[^] http://aspnet.4guysfromrolla.com/London/[^]

                              If It Helps Click It as Answer

                              _ 1 Reply Last reply
                              0
                              • S sashidhar

                                _ASPAle_ wrote:

                                but now to see the data

                                Can You please explain in detail.I didnt get Your point. Depending upon the IDModello You can present the data .If You want to access the previous data provide a link. If You want to See all the other photos Provide a next button or image slider.If that is the case use the below links it may help. http://www.asp.net/AJAX/AjaxControlToolkit/Samples/SlideShow/SlideShow.aspx[^] http://aspnet.4guysfromrolla.com/articles/070704-1.aspx[^] http://aspnet.4guysfromrolla.com/London/[^]

                                If It Helps Click It as Answer

                                _ Offline
                                _ Offline
                                _ASPAle_
                                wrote on last edited by
                                #15

                                "IDModello" is a sql int variable. When I click on the gridview (see the image I posted),I want to appear a DataList with only the data that I want to ... not all!

                                1 Reply Last reply
                                0
                                Reply
                                • Reply as topic
                                Log in to reply
                                • Oldest to Newest
                                • Newest to Oldest
                                • Most Votes


                                • Login

                                • Don't have an account? Register

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • World
                                • Users
                                • Groups