hi
i use these code to uploading image
<asp:UpdatePanel ID="Upbdt1" runat="server">
<ContentTemplate>
<asp:ModalPopupExtender DropShadow="true" ID="ModalPopupExtender1"
PopupControlID="PnPopup1" runat="server" TargetControlID="BtnPopup1"
>
</asp:ModalPopupExtender>
<asp:Button ID="BtnPopup1" OnClick="BtnPopup_Click" runat="server" Text="select image" CssClass="DPC9_Img1" BorderStyle="Solid" BorderWidth="0px" BorderColor="White" />
<asp:Panel ID="PnPopup1" runat="server" BackColor="White"
CssClass="panel">
<asp:ImageButton ID="ImageButton3" runat="server" ImageUrl="~/image/close.png" />
<br />
<asp:FileUpload ID="fup1" runat="server"
ToolTip="click" />
<asp:Button ID="BtnUpload1" OnClick="BtnUpload_Click" runat="server" Text="load" />
</asp:Panel>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="BtnUpload1" />
</Triggers>
</asp:UpdatePanel>
and i use <asp:RequiredFieldValidator>
my problem is that
1-when i click on BtnPopup1 when popup window Appear <asp:RequiredFieldValidator> show error message i want this control show error when i click other button not BtnPopup1 button
2-when popup window appear i choose file from file up load and when i click on BtnUpload1 button it didn't do any thing it didn't exit from popup window and didn't do codes that i wrote on BtnUpload1 _click event.
this is BtnUpload1 _click event
protected void BtnUpload1_Click(object sender, EventArgs e)
{
string path = Server.MapPath(".") + "\\../image/House\\";
string[] validext = { ".jpg", ".gif", ".png", ".rar" };
string ext =
System.IO.Path.GetExtension(AsyncFileUpload1.PostedFile.FileName);
if (Array.IndexOf(validext, ext.ToLower()) < 0)
{
lblMessage.Text = "please enter correct format";
return;
}
string filename = System.IO.Path.GetFileName(fup1.PostedFile.FileName);
while (System.IO.File.Exists(path + "\\" + filename))
filename = "1" + filename;
if (fup1.HasFile)
{
try
{
if (fup1.PostedFile.ContentLength < 105000)
{
fup1.PostedFile.SaveAs(Server.MapPath("~/Upload") + System.IO.Path.DirectorySeparatorChar + AsyncFileUpload1.PostedFile.FileName);
Label20.Text = "File " + fup1.PostedFile.FileName + " uploaded successfully.";
}
else
{
Label20.Text = "File size of " + Convert.ToString(fup1.PostedFile.ContentLength / 1024) + " KB is exceeding the uploading limit.";
}
}
catch (Exception ex)
{
// error message
Label20.Text = "Some problem occurred while uploading the file. Please try after some time.";
}
}
else
{
// warning message
Label20.Text = "Please choose a file to upload.";
}
AsyncFileUpload1.PostedFile.SaveAs(path + filename);
SqlCommand _cmd = new SqlCommand("Fileup1", _cn);
_cmd.CommandType = CommandType.StoredProcedure;
string data = Server.UrlDecode(Request.QueryString["BehCode3"]);
_cn.Open();
_cmd.Parameters.AddWithValue("@image", fup1.FileBytes);
_cmd.Parameters.AddWithValue("@Behcode", data);
_cmd.ExecuteNonQuery();
_cn.Close();
}
Best Regards