How to add links to grid view !!
here i am going to explain how to add links to grid view
i have a jobs table that has the following fields
in a gridview i need only the job title and date_added fields to be displayed where the job_title will be a link to view all details of the specified job i.e. to get all other fields from the database
so i will start with dragging a gridview control to add it to the page and add new data source
i will choose the data source to be the jobs table and also check the fields i need to display in the gridview which will be the id,job_title and date_added
i will test the query to see if it's working
after everything is ok i click on the gridview and select edit columns
in the edit columns screen i will add HyberLinkedField and edit it's properties as shown in the next figure
where the DataNavigateUrlField will be the id to send it as URL parameter to the next page
and the DataNavigateUrlFormatString will be the page where i am redirecting to which will be view_details.aspx?id={0} where 0 is the first column specified in the query which is the id of the job
and the DataTextField will be the job_title field where it will be displayed as a link
and in the HeaderText i will write jobs
then i will remove the job_title from the selected_fields pane as it will be displayed in the hyperlink column so everything will look like the following

then i view the page in the browser
next i am going to create the view_details.aspx page where it will display the full data about the select job
i will add gridview control to this page and choose the data source to be the job table and select which fields i want to display
then i will click where to choose the selected row according to the id sent from the previous gridview control on the browse_jobs.aspx
and i click add so that where clause is added to the query then click ok
discuss this topic to forum
