Click here to Skip to main content
15,893,814 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello guys,

Need your help..
I have two aspx pages.
First page has a gridview with selected columns "Name", "PhoneNumber" , "Age", "City" and a button " View Details" against each row. The results are fetched from sql .
I have another page with more than "80 fields" seperated by "3 tabs" and every field has a label infront of it.
What i want is when a user clicks on view details, It should redirect it to the second page and display records based on the selected row. Also note that that these 80 fields are stored in different database in sql and the gridview values are fetched from different database but both databases have common fields like "Name" , "Age" and "City", so the data should be fetched in second page based on above 3 columns.

I really need your help here and would highly appreciate it.
Thanks in advance.

What I have tried:

I have searched different sites but i could not find a similar problem as mine.
Posted
Updated 27-Sep-16 23:25pm
Comments
Suvendu Shekhar Giri 28-Sep-16 4:50am    
So what is the issue to write code for the logic you already have with you?
Can you pinpoint the actual issue you are facing?
Faran Saleem 28-Sep-16 4:54am    
I would like to fetch the row that is being clicked and display it in second page. I need some code, if you can provide any help i would really appreciate it.
Suvendu Shekhar Giri 28-Sep-16 4:56am    
Onclick, you can just redirect to the second page with a querystring of a unique value which identifies the clicked record.
Faran Saleem 28-Sep-16 4:58am    
Thanks for replying.
Can you share some code please..that would really help

Thanks

 
Share this answer
 
Comments
Faran Saleem 29-Sep-16 3:58am    
Thank you..that was extremely helpful. Please be kind enough to solve another query.. i also want to fetch the remaining 80 rows according to the passed query string values against each label.
I would be very thankful and will appreciate your efforts
It's pretty easy actually.
Let's forget about the button click, if the requirement is just to navigate to another page with some unique identification. It can be done through just simple hyperlink/anchor tag.

Let's see, how the code need to be modified (just for reference)-

Gridview:
ASP.NET
<asp:templatefield headertext="Action">
   <itemtemplate>
      <a href="yourSecondPage?id='<%#Eval(" youruniqueid")="" %="">'">Click</a>
   </itemtemplate>
</asp:templatefield>

In the second page (in probably the page load event), check if page came with a querystring named "id" and call a method to bind the gridview in the second page.

Something similar to following-
C#
if(!Page.IsPostback)
{
  if(Request.QueryString["id"] != null)
  {
     bindMyGridviewWith80Fields(Request.QueryString["id"]);
  }
}


Hope, it helps :)
If there are further doubts or in case I have missed anything here, please let me know.
 
Share this answer
 
v8
Comments
Faran Saleem 29-Sep-16 3:58am    
Thank you..that was extremely helpful. Please be kind enough to solve another query.. i also want to fetch the remaining 80 rows according to the passed query string values against each label.
I would be very thankful and will appreciate your efforts
Suvendu Shekhar Giri 29-Sep-16 5:06am    
80 rows?
ok. just do a select query from that table. Or is there any issue?
I am sorry but, need more information to suggest further.
Faran Saleem 29-Sep-16 5:12am    
80 columns*.. my mistake.

I just need to display the results againt relevant labels. Like i want to display Name against name, age against age.. And this table is in different database

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