how can show webpages [Resolved]

Posted by Neha-kapoor under ASP.NET on 7/22/2011 | Points: 10 | Views : 1488 | Status : [Member] | Replies : 8
dear to all
i m populate some webpages in datalistview
like
home.aspx
aboutus.aspx etc
i want that when user click home link then open home page
if user click about us page then open about us page
plssssssssss help me

thanks


Responses

Posted by: RaviRanjanKr on: 7/23/2011 [Member] Starter | Points: 50

Up
0
Down

Resolved
hey! Neha I've did simple changing in your code and its working as your requirement.
Take a look some changing in AccessDataSource
<asp:AccessDataSource ID="AccessDataSource1" runat="server" 

DataFile="~/blog.mdb" SelectCommand="SELECT [Cat_type], [url] FROM [catagory]">
</asp:AccessDataSource>


and adding binding PostBackUrl property with url column
PostBackUrl='<%# Eval("url") %>'


so Overall Code is
<div>  

<asp:DataList ID="DataList1" runat="server" DataSourceID="AccessDataSource1"
CellPadding="0" RepeatColumns="5" RepeatDirection="Horizontal" OnSelectedIndexChanged="DataList1_SelectedIndexChanged">
<ItemTemplate>
<asp:LinkButton ID="Cat_typeLabel" runat="server" Text='<%# Eval("Cat_type") %>' PostBackUrl='<%# Eval("url") %>' />
</ItemTemplate>
</asp:DataList>
<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/blog.mdb" SelectCommand="SELECT [Cat_type], [url] FROM [catagory]">
</asp:AccessDataSource>
</div>


You Can also download Edited Sample Code.

If you have any query then please fell free to revert back.
 Download source file

Thanks
Ravi Ranjan Kumar
http://raviranjankr.wordpress.com

Neha-kapoor, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: J2_K on: 7/23/2011 [Member] Starter | Points: 25

Up
0
Down
Hi Apsiring .Net frds,
i hope so u hv brought these links in Item Template of DataList
Sumthing like this
<ItemTemplate>
<span>Home Page </span>
</ItemTemplate>

or
<ItemTemplate>
<asp:label Id="lblHome" runat="Server" > Home Page </asp:label>
</ItemTemplate>


instead of this u can use HyperLink or LinkButton by using such controls we can play with their proporties in .CS page
NavigateURL ="http:\\XYZ.com\home.aspx



I hope u will get some useful idea from this...
or share ur code...so we get clear idea abt ur requirement according to used controls in ur CODE...

Regards
J2 K

Knowledge grows by Share & Hear it...

Neha-kapoor, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Neha-kapoor on: 7/23/2011 [Member] Starter | Points: 25

Up
0
Down
Dear Sir
i m populating the url to the database

thanks

Neha-kapoor, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Neha-kapoor on: 7/23/2011 [Member] Starter | Points: 25

Up
0
Down
dear sir
i m sending my attachment
pls check this
 Download source file

thanks

Neha-kapoor, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: A4u_6178 on: 7/23/2011 [Member] Starter | Points: 25

Up
0
Down
hi,
use datalist control like this ..
<asp:DataList>  

<ItemTemplate>
<asp:HyperLink ID="link" runat="server" Text="HOME" NavigateUrl="~/aspx pages/Default.aspx"></asp:HyperLink>
<br />
<asp:HyperLink ID="HyperLink1" runat="server" Text="ABOUT US" NavigateUrl="~/aspx pages/Default2.aspx"></asp:HyperLink>
</ItemTemplate>
</asp:DataList>

hope this is helpful...
if ur problem solved from above code its fine, otherwise paste ur code in reply..

Thanks & Regards,

Neha-kapoor, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Neha-kapoor on: 7/23/2011 [Member] Starter | Points: 25

Up
0
Down
dear sir
pls find attachment
i attach my project pls check it

thanks

Neha-kapoor, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Neha-kapoor on: 7/23/2011 [Member] Starter | Points: 25

Up
0
Down
hi ravi
its really nice
this is fine code
thanks

thanks

Neha-kapoor, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: RaviRanjanKr on: 7/24/2011 [Member] Starter | Points: 25

Up
0
Down
You are welcome Neha
I'm glad it helped you :)

Thanks
Ravi Ranjan Kumar
http://raviranjankr.wordpress.com

Neha-kapoor, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response