S
Shaheen.Pisces
Hello
i'm displaying the searched file names in data list. i want ti make
the filenames as hyperlink ...i wrote the following code
==================================================
<asp:Hyperlink
NavigateURL='<%# DataBinder.Eval(Container.DataItem,
"link.NavigateUrl")%>'
Target="_blank"
Text='<%# DataBinder.Eval(Container.DataItem,
"link.Text")%>'
runat="server" >
</asp:Hyperlink>
================================================
===================The Code Behind File=============
using System;
using System.Data;
using System.Text;
using System.IO;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Presentation_Results : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ArrayList Results = (ArrayList)Session["FileData"];
string ErrorMessage = (string)Session["Message"];
if (ErrorMessage != null)
{
Literal2.Text = ErrorMessage;
}
else
{
ArrayList values = new ArrayList();
foreach (object s in Results)
{
ResultFiles re; //Struct object to store each
file name and its hit score
re = (ResultFiles)s;
if (re.totalHits > 0 )
{
values.Add(new ResultData1(re.link,
re.HitScore));
ResultData1.DataSource = values;
ResultData1.DataBind();
//i++;
}
else
{
Literal2.Text = "No Documents Found";
}
}
}}}
public class ResultData1
{
private float HitScore;
private System.Web.UI.WebControls.HyperLink link;
private int totalHits;
public ResultData1(System.Web.UI.WebControls.HyperLink links,
float hitscore, int totalhits)
{
link = new HyperLink();
this.link.ID = links.ID;
this.link.Text = links.Text;
this.link.NavigateUrl = links.NavigateUrl;
this.HitScore = hitscore;
this.totalHits = totalhits;
}
public System.Web.UI.WebControls.HyperLink Link
{
get
{
return link;
}
}
public float Hitscore
{
get
{
return HitScore;
}
}
}
}
================================================
this works fine means file name is displayed as a link and the
correct
path is shown in status bar but the problem is that when i click on
the file name nothing is happened. plz help in solving this problem
asap
Thanx
Shaheen
i'm displaying the searched file names in data list. i want ti make
the filenames as hyperlink ...i wrote the following code
==================================================
<asp:Hyperlink
NavigateURL='<%# DataBinder.Eval(Container.DataItem,
"link.NavigateUrl")%>'
Target="_blank"
Text='<%# DataBinder.Eval(Container.DataItem,
"link.Text")%>'
runat="server" >
</asp:Hyperlink>
================================================
===================The Code Behind File=============
using System;
using System.Data;
using System.Text;
using System.IO;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Presentation_Results : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ArrayList Results = (ArrayList)Session["FileData"];
string ErrorMessage = (string)Session["Message"];
if (ErrorMessage != null)
{
Literal2.Text = ErrorMessage;
}
else
{
ArrayList values = new ArrayList();
foreach (object s in Results)
{
ResultFiles re; //Struct object to store each
file name and its hit score
re = (ResultFiles)s;
if (re.totalHits > 0 )
{
values.Add(new ResultData1(re.link,
re.HitScore));
ResultData1.DataSource = values;
ResultData1.DataBind();
//i++;
}
else
{
Literal2.Text = "No Documents Found";
}
}
}}}
public class ResultData1
{
private float HitScore;
private System.Web.UI.WebControls.HyperLink link;
private int totalHits;
public ResultData1(System.Web.UI.WebControls.HyperLink links,
float hitscore, int totalhits)
{
link = new HyperLink();
this.link.ID = links.ID;
this.link.Text = links.Text;
this.link.NavigateUrl = links.NavigateUrl;
this.HitScore = hitscore;
this.totalHits = totalhits;
}
public System.Web.UI.WebControls.HyperLink Link
{
get
{
return link;
}
}
public float Hitscore
{
get
{
return HitScore;
}
}
}
}
================================================
this works fine means file name is displayed as a link and the
correct
path is shown in status bar but the problem is that when i click on
the file name nothing is happened. plz help in solving this problem
asap
Thanx
Shaheen