Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 8th, 2009, 10:31 AM
Authorized User
 
Join Date: Jun 2009
Posts: 30
Thanks: 13
Thanked 0 Times in 0 Posts
Default 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?
  #2 (permalink)  
Old August 8th, 2009, 12:13 PM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

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>
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
The Following User Says Thank You to Lee Dumond For This Useful Post:
Banishah (August 9th, 2009)
  #3 (permalink)  
Old August 9th, 2009, 12:37 AM
Authorized User
 
Join Date: Jun 2009
Posts: 30
Thanks: 13
Thanked 0 Times in 0 Posts
Default

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>

  #4 (permalink)  
Old August 9th, 2009, 12:44 AM
Authorized User
 
Join Date: Jun 2009
Posts: 30
Thanks: 13
Thanked 0 Times in 0 Posts
Default

Its okay i solve it...thanks alot
  #5 (permalink)  
Old August 9th, 2009, 12:56 AM
Authorized User
 
Join Date: Jun 2009
Posts: 30
Thanks: 13
Thanked 0 Times in 0 Posts
Default

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]
  #6 (permalink)  
Old August 9th, 2009, 04:15 AM
Authorized User
 
Join Date: Jun 2009
Posts: 30
Thanks: 13
Thanked 0 Times in 0 Posts
Default

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"]);
}
}
}
  #7 (permalink)  
Old August 10th, 2009, 11:25 AM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

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
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
  #8 (permalink)  
Old August 10th, 2009, 01:42 PM
Authorized User
 
Join Date: Jun 2009
Posts: 30
Thanks: 13
Thanked 0 Times in 0 Posts
Default

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....
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 01:57 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.