Problem with Fileupload Control

Posted by Saritha.rajeshkumar under C# on 6/23/2011 | Points: 10 | Views : 1602 | Status : [Member] | Replies : 1
hi,

when iam selecting the value from dropdownlist the fileupload path is going.
i have written the code it is working for password but not working for fileupload control

public void Fileupload()
{
ImagepathFileUpload1.Attributes["value"] = ImagepathFileUpload1.FileName;
FileUpload2.Attributes["value"] = FileUpload2.FileName;
FileUpload3.Attributes["value"] = FileUpload3.FileName;
FileUpload4.Attributes["value"] = FileUpload4.FileName;
}


protected void DdlCountry_SelectedIndexChanged(object sender, EventArgs e)
{
Fileupload();
jb.CountryId = DdlCountry.SelectedValue;
DdlState.DataSource = jb.getstatebycountry();
DdlState.DataTextField = "StateName";
DdlState.DataValueField = "StateId";
DdlState.DataBind();
DdlState.Items.Insert(0, "- - - select - - -");
}


protected void DdlState_SelectedIndexChanged(object sender, EventArgs e)
{
Fileupload();
jb.StateId = DdlState.SelectedValue;
DdlCity.DataSource = jb.getcitybystate();
DdlCity.DataTextField = "Locationname";
DdlCity.DataValueField = "Locationid";
DdlCity.DataBind();
DdlCity.Items.Insert(0, "- - - select - - -");
}




Responses

Posted by: Swapnil on: 6/23/2011 [Member] Starter | Points: 25

Up
0
Down
Hi Saritha,

File upload control lose its state when postback happens. So in above case, you can implement ajax.

You can put ddlState and ddlCountry in Update panel and Fileupload control outside update panel which will solve your problem.

Thanks,
Swapnil.

Thanks and Regards,
Swapnil

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

Login to post response