parul jain

parul jain

  • NA
  • 358
  • 76.9k

how to access protected funtion variable into another func.

Jul 5 2016 5:58 AM
how to access protected funtion variable into another func.
 
ex.:
 
protected void gvDetails_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Upload")
{
GridViewRow gvrow = (GridViewRow)(((Button)e.CommandSource).NamingContainer);
int rowIndex = gvrow.RowIndex;
string txtFileName = ((TextBox)gvrow.FindControl("txtFileName")).Text;
string txtContentType = ((TextBox)gvrow.FindControl("txtContentType")).Text;
string txtBytes = ((TextBox)gvrow.FindControl("txtBytes")).Text;
FileUpload FU = ((FileUpload)gvrow.FindControl("file1"));
byte[] bytes = null;
string filename = "";
string contentType = "";
if (FU.HasFile)
{
HttpFileCollection hfc = Request.Files;
HttpPostedFile hpf = hfc[0];
filename = Path.GetFileName(hpf.FileName);
contentType = hpf.ContentType;
using (Stream fs = hpf.InputStream)
{
using (BinaryReader br = new BinaryReader(fs))
{
bytes = br.ReadBytes(Convert.ToInt32(fs.Length));
}
}
txtFileName = filename.ToString();
txtContentType = contentType.ToString();
txtBytes = bytes.ToString();
}
}
}
 
 
---------------------------------------------------------------------------
 
here i want to aceess the value of txtFileName, txtContentType and txtBytes...
how should i access and get the values.please give the solution 
 
 

Answers (2)