 |
| ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

August 8th, 2009, 10:31 AM
|
|
Authorized User
|
|
Join Date: Jun 2009
Posts: 30
Thanks: 13
Thanked 0 Times in 0 Posts
|
|
Hyperlink
Hi....now i am displaying...all the information in JobPost.aspx table to PostJobList.aspx...usng repeater
after display..how to make the jobtitle hyperlink...so i can go to different page...display it in detail....
This is my code in PostJobList.aspx
SqlConnection con;
SqlCommand cmdDisplay;
string select;
SqlDataReader dtrJob;
string constr = ConfigurationManager.ConnectionStrings["tarStreetConnectionString1"].ConnectionString;
con = newSqlConnection(constr);
select = "Select * From JobPost";
cmdDisplay=newSqlCommand(select,con);
con.Open();
dtrJob = cmdDisplay.ExecuteReader();
Repeater1.DataSource=dtrJob;
Repeater1.DataBind();
dtrJob.Close();
..
In the source(PostJobList.aspx)
<asp:RepeaterID="Repeater1"runat="server">
<ItemTemplate>
<%#"Job Title:"+DataBinder.Eval(Container.DataItem,"Job_Title")+"</br>"%>
<%#"Company Name:"+DataBinder.Eval(Container.DataItem,"Job_CmpName")+"</br>" %>
<%#"Specialization:"+DataBinder.Eval(Container.DataItem,"Job_Specialization")+"<br>"%>
<%#"Location:" + DataBinder.Eval(Container.DataItem, "Job_Location") + "</br>" + "----------------------------------------------</br>"%>
</ItemTemplate>
</asp:Repeater>
And the output is
Job Title:CEO--->how to change this into hyperlink and go to another page
Company Name:Sri Sentosa Sdn.Bhd
Specialization:Computer
Location:Penang
----------------------------------------------
Job Title:Auditor
Company Name:Wisma Mahsing Pvt Ltd
Specialization:Accounting
Location:
----------------------------------------------
Only 4 attributes are being displayed above, how to display the other attributes into another page after clicking the hyperlink just like Jobstreet...any idea?
|
|

August 8th, 2009, 12:13 PM
|
 |
Wrox Author
|
|
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
|
|
To make the job title clickable, you would need to use a Hyperlink control in the template. Then, you'd want to set the NavigateUrl property to the page containing the job details, passing the ID of the job post on the querystring.
Code:
<ItemTemplate>
Job Title:
<asp:HyperLink ID="HyperLink1" runat="server"
Text='<%# Eval("Job_Title") %>'
NavigateUrl='<%# "~/ShowJobDetail.aspx?ID=" + Eval("Job_Id") %>' />
*** other stuff here ***
</ItemTemplate>
|
|
The Following User Says Thank You to Lee Dumond For This Useful Post:
|
|
|

August 9th, 2009, 12:37 AM
|
|
Authorized User
|
|
Join Date: Jun 2009
Posts: 30
Thanks: 13
Thanked 0 Times in 0 Posts
|
|
hi....i am still having error...to make a hyperlink...can u correct it?
<ItemTemplate>
<asp:HyperlinkID="Hyperlink1"runat="server">
<%#"Job Title:"+DataBinder.Eval(Container.DataItem,"Job_Ti tle")</asp:Hyperlink>+"</br>"%>
<%#"Company Name:"+DataBinder.Eval(Container.DataItem,"Job_Cmp Name")+"</br>" %>
<%#"Specialization:" + DataBinder.Eval(Container.DataItem, "Job_Specialization")+"</br>"%>
<%#"Location:" + DataBinder.Eval(Container.DataItem, "Job_Location") + "</br>"%>
<%#"Years of Experience:"+DataBinder.Eval(Container.DataItem,"Y rsOfExperience")+"</br>"+"=======================================</br>"%>
</ItemTemplate>
|
|

August 9th, 2009, 12:44 AM
|
|
Authorized User
|
|
Join Date: Jun 2009
Posts: 30
Thanks: 13
Thanked 0 Times in 0 Posts
|
|
Its okay i solve it...thanks alot
|
|

August 9th, 2009, 12:56 AM
|
|
Authorized User
|
|
Join Date: Jun 2009
Posts: 30
Thanks: 13
Thanked 0 Times in 0 Posts
|
|
hi....i want to ask one more thing....after clicking the hyperlink...how to make the page display the other attribute of the jobs....i have design the interface.....
ShowJobDetail.aspx
Company Name:[Label1]
Company Introduction:[Label2]
Requirement:[Label3]
Job Title:[label4]
|
|

August 9th, 2009, 04:15 AM
|
|
Authorized User
|
|
Join Date: Jun 2009
Posts: 30
Thanks: 13
Thanked 0 Times in 0 Posts
|
|
hi....i .try to solve it but it is not displaying the job details from the hyperlink that i click...
This code in ShowJobDetail.aspx...after clicking the hyperlink(from JobPost.aspx)...it should direct to this page but it is not displaying the job title that i click....how to display the job_id that i click?Can u correct it?....thanks
SqlConnection con;
SqlCommand cmdSelect;
SqlDataReader dtrJob;
string constr = ConfigurationManager.ConnectionStrings["tarStreetConnectionString1"].ConnectionString;
con = newSqlConnection(constr);
con.Open();
cmdSelect = newSqlCommand("Select * From JobPost", con);
dtrJob = cmdSelect.ExecuteReader();
if (dtrJob.HasRows)
{
while (dtrJob.Read())
{
Label1.Text = Convert.ToString(dtrJob["Job_CmpName"]);
Label3.Text = Convert.ToString(dtrJob["Job_CmpIntroduction"]);
Label5.Text = Convert.ToString(dtrJob["Job_MinQualification"]);
Label4.Text = Convert.ToString(dtrJob["Job_Title"]);
}
}
}
|
|

August 10th, 2009, 11:25 AM
|
 |
Wrox Author
|
|
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
|
|
You have to create a SELECT statement that uses the ID to get the single record that you want to display.
Something like...
SELECT * FROM JobPost WHERE Job_Id = @Job_Id
|
|

August 10th, 2009, 01:42 PM
|
|
Authorized User
|
|
Join Date: Jun 2009
Posts: 30
Thanks: 13
Thanked 0 Times in 0 Posts
|
|
Hi....i am still having error....
cmdSelect = newSqlCommand("Select * From JobPost Where Job_Id=@Job_Id", con);
after adding the Where Job_Id=@Job_Id , where to call the @job_Id into the below insert statement...?
cmdSelect.Parameters.Add(Request.QueryString["ID"]);
After the page below...it will direct to the page...where i am having error now
<ItemTemplate>Job Title:
<asp:HyperlinkID="Hyperlink1"runat="server"Text='<%# Eval("Job_Title") %>'NavigateUrl='<%#"~/Employer/PreviewJob.aspx?ID=" +Eval("Job_Id")%>'></asp:Hyperlink>
<%#"</br>Company Name:"+DataBinder.Eval(Container.DataItem,"Job_CmpName")+"</br>" %>
<%#"Specialization:" + DataBinder.Eval(Container.DataItem, "Job_Specialization")+"</br>"%>
<%#"Location:" + DataBinder.Eval(Container.DataItem, "Job_Location") + "</br>"%>
<%#"Years of Experience:"+DataBinder.Eval(Container.DataItem,"YrsOfExperience")+"</br>"+"=======================================</br>"%>
</ItemTemplate>
can u correct me?Thank u....
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| Hyperlink |
desireemm |
Reporting Services |
1 |
March 17th, 2008 11:35 PM |
| Hyperlink |
carlos1972 |
Access VBA |
2 |
November 7th, 2007 10:17 AM |
| hyperlink hyperlink |
sbhandar |
Classic ASP Basics |
6 |
August 26th, 2004 02:04 AM |
| hyperlink |
pab006 |
Classic ASP Basics |
5 |
December 17th, 2003 10:33 AM |
| Hyperlink |
viktor26 |
Classic ASP Basics |
0 |
October 19th, 2003 09:48 AM |
|
 |