OK...there are two ways to this. I'll try to explain both and please feel free to reply if you have any questions regarding either of them.
The easiest way is to do it on client side. Say you have a text box and a "Submit" button:
Code: HTML/ASPX
<asp:TextBox runat="server" id="userInput" />
<asp:Button runat="server" id="submitButton" Text="Submit" />
You would attach a onclick handler to the button, let's call it "verifyInput" and. Inside that function you can verify the user's input and if it is invalid, you can:
1. Display a dialog box;
2. Returns false to cancel the submit;
Both steps are important.
Code: JavaScript
function verifyInput()
{
var dialog = eo_GetObject("your_dialog_id");
var textBox = document.getElementById("userInput");
//check whether the text box is empty
if (textBox.value.length == 0)
{
//Display the dialog
dialog.show(true);
//Returns false to cancel the submt
return false;
}
}
Code: HTML/ASPX
<asp:Button runat="server" id="submitButton"
Text="Submit" onclick="return verifyInput()" />
A second way is to do everything on the server side. This way you would need to use a CallbackPanel control. It will be something like this:
Code: HTML/ASPX
<eo:CallbackPanel runat="server"
id="CallbackPanel1" Triggers="{ID:submitButton;Parameter:}">
<eo:Dialog runat="server" id="Dialog1">
...dialog stuff...
</eo:Dialog>
</eo:CallbackPanel>
At here the submitButton is set to trigger the Callback (through Triggers property). You will then handle submitButton_Click event and verify user's input:
Code: C#
private void submitButton_Click(object sender, EventArgs e)
{
if (userInput.Text.Length == 0)
Dialog1.InitialState = DialogState.Visible;
else
{
Dialog1.InitialState = DialogState.Hidden;
//user input is OK. continue to write it to DB
}
}
The key of this second method is the dialog's InitialState property.