hello sir.....

suppose i want to display list of item name at specific portion on webpage(.aspx page)

but coding portion is done in aspx.cs file with use of for loop i get Item name into variable from database.

now i want to use that varibale to dispaly Item name at specific portion in aspx page
so how i can able to do this thing in aspx page(source view..)?
plz help me ...its emergency....
i hope U help me as my last two post reply...(right solution)

Just declare those variables at the top of the page_load method or just below the partial class of your aspx.cs file. Then you will use those variables into the aspx page.

Just declare those variables at the top of the page_load method or just below the partial class of your aspx.cs file. Then you will use those variables into the aspx page.

Sorry Sir,
U have not get my question..
so i will try by my code...
In my aspx.csaspx.cs file code is.....

public partial class copyfile : System.Web.UI.Page
{
    DirectoryInfo dInfo;
    FileInfo[] FilesList;
    protected void Page_Load(object sender, EventArgs e)
    {
        if ((Request["filename"]) != null)
        {
            dInfo = new DirectoryInfo(Server.MapPath("upload"));
            FilesList = dInfo.GetFiles();
            foreach (FileInfo fi in FilesList)
            {
                if (fi.Name.Equals(Request["filename"]))
                {
                    fi.Delete();
                    getfiles();
                    break;
                }
            }
        }
        if (FileUpload1.HasFile)
        {
            getfiles();
        }
    }
    protected void getfiles()
    {
        this.FileUpload1.SaveAs(Server.MapPath("upload\\" + FileUpload1.FileName));
        this.Label1.Text = "File Uploaded Sucessfull!!!!";
        dInfo = new DirectoryInfo(Server.MapPath("upload"));
        FilesList = dInfo.GetFiles();
        int i = 1;
        foreach (FileInfo fi in FilesList)
        {
            Label l = new Label();
            l.Text = fi.Name.ToString();
            Response.Write(i + "." + fi.Name);
            Response.Write("<a href='" + Request.CurrentExecutionFilePath + "?filename=" + fi.Name + "'>Remove</a>");
            Response.Write("");
            Response.Write("</br>");
            i++;
        }
    }
}

My aspx (Desing) page contain...

<html>
      <head id="Head1" runat="server"> 
      <title>Sample Page</title>
      
<script type="text/javascript">
function DoSubmit()
{ 
  var form=document.getElementById("form1");
  form.submit();
}
</script>
      <style type="text/css">
          #form1
          {
              height: 120px;
          }
      </style>
      </head>
      <body>&nbsp;<form id="form1" runat="server">
          <asp:FileUpload ID="FileUpload1" runat="server" onChange="DoSubmit();"
              style="z-index: 1; left: 51px; top: 88px; position: absolute" />
          <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
           <%  %>     
      </form>
      </body>
     </html>

The problem is regarding to forloop bcz U can see in aspx.cs for loop have file name in fi.Name. and now i want to display at particular place in design page
so how i use that fi.name in desing view in aspx file?
i hope u will help me?

>suppose i want to display list of item name at specific portion on webpage.

Use ASP.NET Table or GridView or DataList or Repeater control.

Expression Tag: Another way to show value of variables.

aspx markup

<%=Value %>
    <br />
    Name : <%=Name[0] %>
    <br />
    Name : <%=Name[1] %>
    <br />

Code Behind

public int Value = 100;
    public string[] Name = { "AA", "BB" };
    protected void Page_Load(object sender, EventArgs e)
    { }

You may also use simple DataBind using <%# Expression %>
(DataBind() method evaluates those expressions).

aspx markup

<%# Value %>
  <%# Name[0] %>
 <%# Name[1] %>

code-behind

public int Value = 100;
    public string[] Name = { "AA", "BB" };
    protected void Page_Load(object sender, EventArgs e)
    {
        DataBind();
    }