Gridview row updating

Posted by Ramrao93 under C# on 2/1/2012 | Points: 10 | Views : 2432 | Status : [Member] | Replies : 3
I have file upload control control inside gridview edit template.when i edit perticular row and upload new file then on row updating can not pick file from file upload.It get null value
Here is my code
FileUpload FileUpload1 = (FileUpload)gv_banner.Rows[e.RowIndex].FindControl("file_edit_banner");

if (file_edit_banner1.HasFile)
{
Random rd = new Random();
int random = rd.Next();
banner = Convert.ToString(lbl_banner_image.Text);

string path = "../images/banner/";
file_edit_banner1.SaveAs(Server.MapPath(path + banner));
}
pls give me any suggession if any ?




Responses

Posted by: Blessyjees on: 2/1/2012 [Member] Bronze | Points: 25

Up
0
Down
Hi,
Try this

FileUpload FileUpload1 = (FileUpload)gv_banner.Rows[e.RowIndex].FindControl("file_edit_banner"); 


if (FileUpload1 .HasFile)
{
Random rd = new Random();
int random = rd.Next();
banner = Convert.ToString(lbl_banner_image.Text);

string path = "../images/banner/";
FileUpload1 .SaveAs(Server.MapPath(path + banner));
}


Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

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

Posted by: Ramrao93 on: 2/1/2012 [Member] Starter | Points: 25

Up
0
Down
I try this code but still not working properly. It gets null value of file upload control

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

Posted by: Thilsivaprasath on: 2/6/2012 [Member] Starter | Points: 25

Up
0
Down
Ramrao,

Can you post your aspx source of gridview for better understanding of your problem.


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

Login to post response