I am trying to kick off the callback panel when a textbox looses focus but whenever the event is fired I get undefined or null for the return value of the textbox.value. Here is the code:
<dxe:ASPxTextBox ID="DriverCodeTxt" runat="server" Width="170px"
ClientInstanceName="DriverCodeTxt" EnableClientSideAPI="True">
<ClientSideEvents LostFocus="function(s, e) {
var targetElement = document.getElementById('DriverCodeTxt');
CallbackPanel.PerformCallback(targetElement.getAttribute('Value')); // I've also tried targetElement.value which returns undefined
}" />
</dxe:ASPxTextBox>
<dxcp:ASPxCallbackPanel ID="CallbackPanel" runat="server" Height="87px" Width="782px"
ClientInstanceName="CallbackPanel" OnCallback="CallbackPanel_Callback">
<PanelCollection>
<dxrp:PanelContent runat="server">
<asp:Label ID="Label3" runat="server" Text="Security Question: "></asp:Label><asp:Label
ID="QuestionLbl" runat="server" Text=""></asp:Label><br />
<asp:Label ID="Label2" runat="server" Text="Answer: "></asp:Label>
<asp:TextBox ID="AnswerTxt" runat="server" Width="380px"></asp:TextBox><br />
<br />
<asp:Button ID="SubmitBtn" runat="server" Text="Submit" />
</dxrp:PanelContent>
</PanelCollection>
</dxcp:ASPxCallbackPanel>
protected void CallbackPanel_Callback(object source, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
{
SqlConnection sqlCnn = new SqlConnection(ConfigurationManager.ConnectionStrings["driverportalConnectionString2"].ConnectionString);
sqlCnn.Open();
SqlCommand sqlCmd = new SqlCommand();
sqlCmd.Connection = sqlCnn;
if (DriverCodeTxt.Text.Length > 0)
{
sqlCmd.CommandText = "select * from [Security] where [User] = '" + e.Parameter.ToString().ToUpper() + "'";
sqlRdr = sqlCmd.ExecuteReader();
if (sqlRdr.HasRows)
{
QuestionLbl.Text = sqlRdr["Question"].ToString();
}
else
{
lblStatus.Text = "User doesn't exist.";
}
}
}