I am trying to program a simple blog system. But I don't know how to make "readmore" button. Now I am using gridview to show the articles. ANd when "gridview.lenght >100 ""readmorebutton.visible = true". But I couldn't make readmore button's click event.
I want it to retrieve full data and show it with details. And I fancy changing the url like " www.website.com/articleDetail.aspx?articleID=100" Which event should I use. Can you give me an example code. Or some tutorials?
Do you want to show the full article on the same page or on new page? Please be more specific what exactly you want. Could you paste some code you already have done?
Thanks for you answer but it doesn't accept the code. I am using a gridview. And I added this hyperlink into "Item Template" But it doesn't accept the ".lenght" section. Also what does this code do? Does it change the Url into articledetails.aspx? and what
do you mean by contentfield? Now I have a webform called "articles.aspx". And on this form. there is a gridview which shows the articles in the DB. I want this;
Gridview will shgow only 100 characters of the article(it's column name is "article" in my DB). And when you click on read more button(which is a normal button) the gridview will retrieve only the article that I clicked. How can I do that? I eman how can
gridview specify articleID's on gridview's each row? I eamn if the article's which I cllicked its readmore button, gridview will "select" the data "where" ID is 2
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval ("articleID","articleDetail.aspx?articleID= {0}") %>' Text="read more"> </asp:HyperLink> use request.querystring("articleId") to get the value or use querystring parameter if using sqldatasource.
Mac14
Member
46 Points
71 Posts
Read More
Dec 13, 2012 05:35 PM|LINK
Hello everyone!
I am trying to program a simple blog system. But I don't know how to make "readmore" button. Now I am using gridview to show the articles. ANd when "gridview.lenght >100 ""readmorebutton.visible = true". But I couldn't make readmore button's click event. I want it to retrieve full data and show it with details. And I fancy changing the url like " www.website.com/articleDetail.aspx?articleID=100" Which event should I use. Can you give me an example code. Or some tutorials?
Thanks I am waiting for your answers!
gregaDro
Member
318 Points
65 Posts
Re: Read More
Dec 13, 2012 07:30 PM|LINK
Hi,
Do you want to show the full article on the same page or on new page? Please be more specific what exactly you want. Could you paste some code you already have done?
oned_gk
All-Star
31764 Points
6492 Posts
Re: Read More
Dec 13, 2012 11:27 PM|LINK
Try this
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("articleID","articleDetail.aspx?articleID={0}") %>' Text="read more" Visible='<%# Eval("contentfield").lenght >100 %>'> </asp:HyperLink>Mac14
Member
46 Points
71 Posts
Re: Read More
Dec 14, 2012 02:42 PM|LINK
Hi^^
Thanks for you answer but it doesn't accept the code. I am using a gridview. And I added this hyperlink into "Item Template" But it doesn't accept the ".lenght" section. Also what does this code do? Does it change the Url into articledetails.aspx? and what do you mean by contentfield? Now I have a webform called "articles.aspx". And on this form. there is a gridview which shows the articles in the DB. I want this;
Gridview will shgow only 100 characters of the article(it's column name is "article" in my DB). And when you click on read more button(which is a normal button) the gridview will retrieve only the article that I clicked. How can I do that? I eman how can gridview specify articleID's on gridview's each row? I eamn if the article's which I cllicked its readmore button, gridview will "select" the data "where" ID is 2
(sorry , you know I am a noob)
Thanks
oned_gk
All-Star
31764 Points
6492 Posts
Re: Read More
Dec 14, 2012 03:49 PM|LINK