Click here to Skip to main content
15,889,216 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello Everyone, I'm developing auction site as my University Final year project.
But I'm stuck in one problem i-e Which I click "View Details" hyperlink in Grid-view, it should compare Sno and Display its complete information present in SQL Server Table in new Tab.
I want to post the screenshot of output but unfortunately there is no option that's why I supplied "Code for designing Grid-view"

What I have tried:

Code for Gridview in ASP.Net
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" HeaderText="Absolute">
            <Columns>
                <asp:BoundField DataField="Sno" HeaderText="Sno" SortExpression="Sno" />
                <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
          
                <asp:BoundField DataField="Typeofauction" HeaderText="Typeofauction" SortExpression="Typeofauction" />
                <asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" />
                <asp:BoundField DataField="PostedDate" HeaderText="PostedDate" SortExpression="PostedDate" DataFormatString="{0: dd MMM yyyy}" />
                <asp:BoundField DataField="StartProcess" HeaderText="StartProcess" SortExpression="StartProcess" />
                <asp:BoundField DataField="EndProcess" HeaderText="EndProcess" SortExpression="EndProcess" />
                <asp:TemplateField HeaderText="CoverImage" SortExpression="CoverImage">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("CoverImage") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Image ID="Image2" runat="server" Height="128px" ImageUrl='<%# Eval("CoverImage") %>' Width="219px" />
                    </ItemTemplate>
                </asp:TemplateField>
             
                <asp:HyperLinkField HeaderText="Bid Here" NavigateUrl="~/Bid.aspx" Text="Bid Now" />
             
                <asp:HyperLinkField HeaderText="View Details" Text="View Details" NavigateUrl="~/Buy.aspx" />
             
               
            </Columns>
            <EmptyDataTemplate>
                <asp:Image ID="Image1" runat="server" Height="138px" Width="213px" />
            </EmptyDataTemplate>
           
        </asp:GridView>
Posted
Updated 21-Mar-19 5:53am
Comments
CHill60 19-Mar-19 9:52am    
This is just your grid view - post the code that you are using to do the comparison and the display and explain what the problem is
AbdulMujeeb2011 19-Mar-19 10:10am    
I don't write the comparison code because I have no idea how to do that?

Use DataNavigateUrlFields[^] and DataNavigateUrlFormatString[^] to pass the value to the second page in the querystring:
<asp:HyperLinkField 
    HeaderText="View Details" 
    Text="View Details" 
    DataNavigateUrlFields="Sno"
    DataNavigateUrlFormatString="~/Buy.aspx?sno={0}"
/>

On the second page, use a QueryStringParameter[^], model binding[^], or manually read the Request.QueryString to find the item to display.
 
Share this answer
 
Comments
Maciej Los 22-Mar-19 10:07am    
5ed!
 
Share this answer
 
Comments
AbdulMujeeb2011 19-Mar-19 13:26pm    
This is good. But can we make logic in C# or ASP.net
[no name] 19-Mar-19 14:03pm    
Yes, you have my permission.
CHill60 21-Mar-19 12:37pm    
Did you actually look at the article? The code is … in C# and ASP.net

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900