Skip to main content
Hi,

I need to check if the user attached a document to my form. What is the best way of doing it? Thanks.

Regards,
A.
I would assume that you can use the Events available on the DocAttachment control, I am thinking K2DocAttachment1_AddDocument or K2DocAttachment1_AddDocumentOK

I have not tested it myself but please let me know the outcome
Hi Renier,

Thanks, it was very easy to create the check with K2DocAttachment1_AddDocumentOK event.

I had to wrote just few rows of code and it works nicely

DIM AAA as integer

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
AAA = K2DocAttachment1.AttachedDocumentCount
End Sub

Private Sub K2DocAttachment1_AddDocumentOK(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles K2DocAttachment1.AddDocumentOK
If K2DocAttachment1.AttachedDocumentCount > AAA Then
K2Button1.Visible = True
Else
K2Button1.Visible = False
End If
End Sub

This event does not allow a user to submit a form without adding a document to the K2DocAttachment component.

Regards,
A.
Awesome, thank you for the response!

Reply