Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 16, 2008 12:14 PM by elegantkvc
0 Points
2 Posts
May 16, 2008 11:26 AM|LINK
Hi,
I am trying to assign a value to a hidden field by using the following code but its not working.So can anyone give some better suggestion.
function hidval(frm,val)
{
frm.hidden1.value=val
}
<body onload="BLOCKED SCRIPThidval(this.form,<%=value%>)">
<input type="hidden" name="hidden1" value="">
/// In the code Behind I am calling the hidden value as follows
dim var = request.form("hidden1")
but the above code is not working so please help me to solve this issue.
Participant
886 Points
160 Posts
May 16, 2008 11:38 AM|LINK
try this
document.getElementById('hidden1').value=val
May 16, 2008 11:45 AM|LINK
its not working ya.
can you send some other code?
thanks
May 16, 2008 12:03 PM|LINK
ok you change like this
<
then add javascript
document.getElementById(
then get it in code behind by:
hidden1.Value;
Member
258 Points
141 Posts
why you don't try the hidden field as runat="server"
and then var hidden = document.getElementById('<%= myHiden.ClientID %>');
if(hidden != null)
hidden.value = "1"
May 16, 2008 12:05 PM|LINK
your code rajakec will not work , you can't call the id straight forward if you put the control as runat="server" I disagree with you.
1073 Points
249 Posts
May 16, 2008 12:14 PM|LINK
hi,
You can use document.getElementById('HiddenField's CLientId').value to acheive ur task.
1.Hiddenfiled must have attribute runat="server"
2.By clicking view source on the output browser window you can identify the client Id for your hidden field.
cheers mate
vijay[:)]
chandran.dev...
0 Points
2 Posts
how to assign a value to hidden field using javascript in asp.net
May 16, 2008 11:26 AM|LINK
Hi,
I am trying to assign a value to a hidden field by using the following code but its not working.So can anyone give some better suggestion.
function hidval(frm,val)
{
frm.hidden1.value=val
}
<body onload="BLOCKED SCRIPThidval(this.form,<%=value%>)">
<input type="hidden" name="hidden1" value="">
/// In the code Behind I am calling the hidden value as follows
dim var = request.form("hidden1")
but the above code is not working so please help me to solve this issue.
</div>rajakec
Participant
886 Points
160 Posts
Re: how to assign a value to hidden field using javascript in asp.net
May 16, 2008 11:38 AM|LINK
try this
document.getElementById('hidden1').value=val
chandran.dev...
0 Points
2 Posts
Re: how to assign a value to hidden field using javascript in asp.net
May 16, 2008 11:45 AM|LINK
its not working ya.
can you send some other code?
thanks
rajakec
Participant
886 Points
160 Posts
Re: how to assign a value to hidden field using javascript in asp.net
May 16, 2008 12:03 PM|LINK
ok you change like this
<
input type="hidden" name="hidden1" id="hidden1" value="" runat="server" />then add javascript
document.getElementById(
'hidden1').value="value1";then get it in code behind by:
hidden1.Value;
lallouna85
Member
258 Points
141 Posts
Re: how to assign a value to hidden field using javascript in asp.net
May 16, 2008 12:03 PM|LINK
why you don't try the hidden field as runat="server"
and then var hidden = document.getElementById('<%= myHiden.ClientID %>');
if(hidden != null)
{
hidden.value = "1"
}
lallouna85
Member
258 Points
141 Posts
Re: how to assign a value to hidden field using javascript in asp.net
May 16, 2008 12:05 PM|LINK
your code rajakec will not work , you can't call the id straight forward if you put the control as runat="server" I disagree with you.
elegantkvc
Participant
1073 Points
249 Posts
Re: how to assign a value to hidden field using javascript in asp.net
May 16, 2008 12:14 PM|LINK
hi,
You can use document.getElementById('HiddenField's CLientId').value to acheive ur task.
1.Hiddenfiled must have attribute runat="server"
2.By clicking view source on the output browser window you can identify the client Id for your hidden field.
cheers mate
vijay[:)]