Hi, I need help !!!
-
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?
-
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?
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.
-
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.
Waste of time doing a Response.Redirect from a postback event, just use a Hyperlink column.
only two letters away from being an asset
-
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?
<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
-
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?
Use a Hyperlink column or a Template column to place the link in the grid
only two letters away from being an asset
-
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?
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.
-
Waste of time doing a Response.Redirect from a postback event, just use a Hyperlink column.
only two letters away from being an asset
-
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.
-
Waste of time doing a Response.Redirect from a postback event, just use a Hyperlink column.
only two letters away from being an asset
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.
-
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.
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
-
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?
-
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
yes, it's my mistake. I just followed the words that were written in the main post and ignored the one in the image.
-
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.
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?
-
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?
_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
-
_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