how can pick the url of dynamic webpage

Posted by Umeshdwivedi under ASP.NET on 5/27/2011 | Points: 10 | Views : 1305 | Status : [Member] | Replies : 10
Dear All
any body help me,
i m creating dynamic web pages and i want to show all webpages link in grid view.
i tell you step by step........
1-create a webpage in pages folder
page is creating successfully in page folder.
now
i want to show page title in a grid view without storing database
this posible
how can pick tilte in page folder
pls help me

Latest Technology Trainer
And Part time software consultant



Responses

Posted by: Ndebata on: 5/30/2011 [Member] Starter | Points: 25

Up
0
Down
Hi
You can use the bellow code. Here DPages is the folder where you are storing you dynamic pages.
Just store these Title and PageLink in a collection and bind it .
var files = Directory.GetFiles(Server.MapPath("DPages"));

var aspxfiles = files.Where(n => n.EndsWith(".aspx", StringComparison.OrdinalIgnoreCase));
foreach (var item in aspxfiles)
{
using (StreamReader rdr=new StreamReader(item))
{
string Title,PageLink;
string str=rdr.ReadToEnd().ToUpper();
if(str.Contains("<TITLE>") && str.Contains("</TITLE>"))
{
Title = str.Substring(str.IndexOf("<TITLE>")+7, str.IndexOf("</TITLE>") - str.IndexOf("<TITLE>")-7);
PageLink = item.Substring(item.LastIndexOf(@"/") + 1);
}
}
}

Thanks,
Debata

Umeshdwivedi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Umeshdwivedi on: 5/30/2011 [Member] Starter | Points: 25

Up
0
Down
dear sir
but how can bind in grid view

Latest Technology Trainer
And Part time software consultant

Umeshdwivedi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ndebata on: 5/31/2011 [Member] Starter | Points: 25

Up
0
Down
Hi
It is simple :), just create a class having two properties called Title and PageLink.
Then Create a List of this class then add object to it where i am setting the Title/PageLink in my above code.

Thanks,
Debata

Umeshdwivedi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Umeshdwivedi on: 5/31/2011 [Member] Starter | Points: 25

Up
0
Down
i m doing so but not success so pls give me a demo code

Latest Technology Trainer
And Part time software consultant

Umeshdwivedi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ndebata on: 6/1/2011 [Member] Starter | Points: 25

Up
0
Down
Hi
Please find the attached sample.
Thanks,
Debata
 Download source file

Umeshdwivedi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Umeshdwivedi on: 6/1/2011 [Member] Starter | Points: 25

Up
0
Down
Dear sir
thanks very much,if i want to click pagelink in grid and show that page how can i do.i m try but always generate an error
can you edit this file and send me again

Latest Technology Trainer
And Part time software consultant

Umeshdwivedi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ndebata on: 6/1/2011 [Member] Starter | Points: 25

Up
0
Down
Hi
You can do it either by using a Hyperlink field column or template columns.
In this sample i used Hyperlink field.

Thanks,
Debata
 Download source file

Umeshdwivedi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Umeshdwivedi on: 6/2/2011 [Member] Starter | Points: 25

Up
0
Down
Dear Sir
you are best in this dotnetfunda forum,coze i see many forum but no budy reply best manner
i like your helping attitude.this such a good work i really thank to you.and say that may all your dearms come true
dear sir if you have any pdf example pls send i want to convert data in pdf format in runtime
thanks

Latest Technology Trainer
And Part time software consultant

Umeshdwivedi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ndebata on: 6/2/2011 [Member] Starter | Points: 25

Up
0
Down
Thanks a lot for all your complements.
Regards,
Debata

Umeshdwivedi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ndebata on: 6/3/2011 [Member] Starter | Points: 25

Up
0
Down
Hello Umesh,
I have attached a pdf sample in the other thread posted by you.

Thanks,
Debata

Umeshdwivedi, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response