Hi,
To solve your problem, I ask the person, the ID first and validate this id in the database. If this id is valid, I open the option to upload the pdf file.
After uploading, I only validate the file because the id is valid.
Below example.
HTML code
<pre><form id="form1" runat="server">
<div>
<label>Type your id:</label>
<asp:TextBox ID="txtId" runat="server"></asp:TextBox>
<asp:Button ID="btn_validate" runat="server" Text="Validate" OnClick="btn_validate_Click" />
</div>
<br />
<div id="upload" runat="server" visible="false">
<asp:FileUpload ID="my_file_upload" runat="server" />
</div>
<asp:Label ID="lblStatus" runat="server" Text="Label"></asp:Label>
</form>
code-behind
public partial class frmMyTest2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
private bool validate_id()
{
return true;
}
protected void btn_validate_Click(object sender, EventArgs e)
{
try
{
if (this.validate_id())
{
this.upload.Visible = true;
}
else
{
this.lblStatus.Text = "This id is not valid";
}
}
catch (Exception ex)
{
lblStatus.Text = ex.Message;
}
}
}