admin管理员组文章数量:1417051
How to pass two textbox values to a javascript function on a button click event.I have tried it like this but it is not working.here is my code
<asp:LinkButton ID="lnkBTNSubmit" runat="server" CssClass="buttonlink"
OnClientClick="checkDateRange(GetTextBoxValue('<%= txtATrendStartDate.ClientID %>'.value),GetTextBoxValue('<%= txtATrendEndDate.ClientID %>'.value))">Submit</asp:LinkButton>
and
function checkDateRange(start, end)
{
}
Any Suggestion?
How to pass two textbox values to a javascript function on a button click event.I have tried it like this but it is not working.here is my code
<asp:LinkButton ID="lnkBTNSubmit" runat="server" CssClass="buttonlink"
OnClientClick="checkDateRange(GetTextBoxValue('<%= txtATrendStartDate.ClientID %>'.value),GetTextBoxValue('<%= txtATrendEndDate.ClientID %>'.value))">Submit</asp:LinkButton>
and
function checkDateRange(start, end)
{
}
Any Suggestion?
Share Improve this question edited Mar 27, 2012 at 13:01 Colin Brock 21.6k9 gold badges49 silver badges62 bronze badges asked Mar 27, 2012 at 12:59 bala3569bala3569 11k28 gold badges107 silver badges148 bronze badges 03 Answers
Reset to default 5Something like this would do the trick
<asp:LinkButton ID="lnkBTNSubmit" runat="server" CssClass="buttonlink"
OnClientClick="return onBtnSubmitClick()">Submit</asp:LinkButton>
function onBtnSubmitClick(){
var start = document.getElementById('<%= txtATrendStartDate.ClientID %>').value;
var end = document.getElementById('<%= txtATrendEndDate.ClientID %>').value;
return checkDateRange(start, end);
}
do it in your inline/header javascript like this:
var element = document.getElementById('<%= txtATrendEndDate.ClientID %>');
element.value
and if you set ClientIDMode="Static"
you can do:
var value= document.getElementById('txtATrendEndDate').value;
I think you're missing document.getElementById.
So something like:
document.getElementById('<%=txtATrendStartDate.ClientID%>').value
本文标签: aspnetHow to pass textbox value to JavaScriptStack Overflow
版权声明:本文标题:asp.net - How to pass textbox value to JavaScript? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745262409a2650415.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论