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
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745262410a4619270.html
评论列表(0条)