ameert
asked on
ValueChanged event for HiddenField not firing for some reason.
I have an aspx page with a label and a hidden field. Through javascript, I set the value of the hidden field, and then call __doPostBack. But the valuechanged event doesn't fire. Is this correct what I have below (I believe it is). My aspx page has a master page and everything within my aspx paage is all inside content tags.
<script language=javascript>
function ConfigureDialog()
{
var ea = "<%= Request.Form["__EVENTARGUM ENT"] %>";
if (ea != "HdnFldSet")
{
var ttt = "val1";
var oRouteType = document.getElementById("< %= HiddenField6.ClientID %>");
oRouteType.Value = ttt;
__doPostBack("HiddenField6 ",'HdnFldS et'); //i even tried "<%= HiddenField6.ClientID %>" in place of "HiddenField6" here
}
}
</script>
<asp:HiddenField ID="HiddenField6" runat="server" OnValueChanged="HiddenFiel d6_ValueCh anged" />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>< /p>
<script>
ConfigureDialog();
</script>
Then on code behind page:
protected void HiddenField6_ValueChanged( object sender, EventArgs e)
{
Label1.Text = "someText...never shows for some reason.";
}
By the way I have page EnableEventValidation set to false. I open this page as a popup from another page.
Please tell me if there is anything wrong with this code....the valueChanged event never fires and I can't understand why.
<script language=javascript>
function ConfigureDialog()
{
var ea = "<%= Request.Form["__EVENTARGUM
if (ea != "HdnFldSet")
{
var ttt = "val1";
var oRouteType = document.getElementById("<
oRouteType.Value = ttt;
__doPostBack("HiddenField6
}
}
</script>
<asp:HiddenField ID="HiddenField6" runat="server" OnValueChanged="HiddenFiel
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label><
<script>
ConfigureDialog();
</script>
Then on code behind page:
protected void HiddenField6_ValueChanged(
{
Label1.Text = "someText...never shows for some reason.";
}
By the way I have page EnableEventValidation set to false. I open this page as a popup from another page.
Please tell me if there is anything wrong with this code....the valueChanged event never fires and I can't understand why.
or sure javascript instead
<script lanugage=javascript runat=server>
function onHiddenFieldchange(){
document.getElementById("L abel1").va lue = "changed text shown";
}
</script>
<script lanugage=javascript runat=server>
function onHiddenFieldchange(){
document.getElementById("L
}
</script>
ASKER
Hello gawai, no luck with that either.
Strange this this works fine from a parent window....but then in the popup window it's not working and it's the exact same code.
Strange this this works fine from a parent window....but then in the popup window it's not working and it's the exact same code.
ASKER
i can't use the second option because in the c# event I have, I need to set some properties to a datagrid depending on what value was assigned to the hiddenfield
might you have missed some lines of code in popup window page.
ASKER
Does anyone have a solution to this? I really need to get this done.
ASKER
Ok, figured it out.....I'm posting this soln in case anyone else has a similar problem.
I added the following to Render event and I turned on EnableEventValidation:
Page.ClientScript.Register ForEventVa lidation(t his.Hidden Field6.Uni queID, "");
I also changed <%= HiddenField6.ClientID %> to <%= HiddenField6.UniqueID %>
I added the following to Render event and I turned on EnableEventValidation:
Page.ClientScript.Register
I also changed <%= HiddenField6.ClientID %> to <%= HiddenField6.UniqueID %>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
public void HiddenField6_ValueChanged(
{
Label1.Text = "someText...never shows for some reason.";
}