hi in the button click event i need to read the positions of the images from the textbox and then i need to change the photoorder in the database to whatever order i ve placed the images?
inorder to get the images and read the data to the textbox i ve written the following code?
so can any1 give me da code for the above requirement?
ie i need to change the photoorder when i click on save button and update this in database?
inorder to get the images and read the data to the textbox i ve written the following code?
Code:
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
Response.Write(Request.Form["txtPhotos"]);
}
else
{
DataSet dsPhotos = SqlHelper.ExecuteDataset(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ToString(), CommandType.Text,
"SELECT PhotoId,PhotoPath,PhotoOrder,UploadDate FROM tPhotos WHERE Albumid=20 AND Userid=65");
string ScriptBlock;
ScriptBlock = @"<script type='text/javascript'>";
//int i = dsPhotos.Tables[0].Rows[0]["PhotoPath"];
ScriptBlock += "var photoArray = new Array(" + dsPhotos.Tables[0].Rows.Count + ");";
int i = 0;
for (i = 0; i <= dsPhotos.Tables[0].Rows.Count - 1; i++)
{
ScriptBlock += "photoArray[" + i + "]" + "='" + dsPhotos.Tables[0].Rows[i]["PhotoPath"].ToString() + "';";
}
ScriptBlock += "function PhotoOrder()";
ScriptBlock += "{";
ScriptBlock += "var photoReorder=photoArray.join(',');";
ScriptBlock += "document.getElementById('" + txtPhotos.ClientID + "').value=photoReorder;";
ScriptBlock += "}";
ScriptBlock += "</script>";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "arrayscript", ScriptBlock);
}
}
ie i need to change the photoorder when i click on save button and update this in database?