Dynamically Changing style,file in using C#


protected void btnSaveStyle_Click(object sender, EventArgs e)
string sourcePath = Server.MapPath(“~/css/” + ddlStylelist.SelectedValue.ToString());
string targetPath = Server.MapPath(“~/css”);
if (!Directory.Exists(targetPath))
foreach (var srcPath in Directory.GetFiles(sourcePath))
//Copy the file from sourcepath and place into mentioned target path,
//Overwrite the file if same file is exist in target path
File.Copy(srcPath, srcPath.Replace(sourcePath, targetPath), true);
lblMsg.Text = “Theme changed Successfully…!”;



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: