I have file uploader inside UpdateItemTemplate of ListView and there's a TextBox1 control, I want to update its Text property with the address of uploaded image. So I've got the problem with assigning data to TextBox1.Text. I tried to assign image_address.Text property through some other control (e.g Label4.Text in my code) which is outside of listview, then tried properties, but they don't work either. It's pity that arguments could not be passed to events. So how update controls inside templates? Here's my code:
public void Uploader_FileUploaded(object sender, UploaderEventArgs args)
{
args.CopyTo(@"D:\images\menu\" + args.FileName);
ResizeImage(@"D:\images\menu\" + args.FileName, @"D:\images\menu\small_" + args.FileName, 150, 100, false);
args.Delete();
Label4.Visible = true;
Label4.Text = @"D:\imagesmenu\small_" + args.FileName;
//(TextBox) huyimg = (TextBox)(ListView1.Controls[0].FindControl("TextBox1"));
TextBox img = (TextBox)(ListView1.Items[ListView1.SelectedIndex].FindControl("TextBox1"));
img.Text = @"D:\imagesmenu\small_" + args.FileName;
}
protected void ListView1_ItemUpdating(object sender, ListViewUpdateEventArgs e)
{
ListViewItem myItem = ListView1.Items[ListView1.EditIndex];
TextBox image_address = (TextBox)(ListView1.Items[e.ItemIndex].FindControl("TextBox1"));
image_address.Text = Label4.Text;
...
ListView1.EditIndex = -1;
BindList();
}