How access hidden filed value in web method method in c#KKkakasaheb kachare8yAsked Jul 27, 2018, 3:27 AM EDT5 answersShareLinkedInXCopy linkSavehow to access hidden field value in satic web method plz help
How access hidden filed value in web method method in c#KKkakasaheb kachare8yAsked Jul 27, 2018, 3:27 AM EDT5 answersShareLinkedInXCopy linkSavehow to access hidden field value in satic web method plz help
Jenith ThakkarRank #789 · 2.9K reputation8y agoPosted Jul 27, 2018, 3:38 AM EDT+2aspx file onselectedindexchanged="DropDownList1_SelectedIndexChanged" onChange="ConfirmIt()"AutoPostBack="True">Item1Item2Item3 Javascripts function ConfirmIt() {var x = confirm("Do you Want to notify changes to User ??");var control = '<%=inpHide.ClientID%>';if (x == true) {document.getElementById(control).value = "1";}else {document.getElementById(control).value = "0";}} Code Behind protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e){int DiagResult = int.Parse(inpHide.Value);if (DiagResult == 1){//Do SomthingResponse.Write("You Have Selected Ok");}else if (DiagResult == 0){//Do somthingResponse.Write("You have Selected Cancel");}}} please refer this code for detail how hidden field work+2KKkakasaheb kachare94 reputation8y agoPosted Jul 28, 2018, 12:46 AM EDT0Thanks, but how to acess hidden filed value in static methods ,any example 0Jefferson S. MottaRank #207 · 11.7K reputation8y agoPosted Jul 30, 2018, 6:57 PM EDT0but how to acess hidden filed value in static methods ,any example --- You cannot.You must write a client script to read the value and pass to a WebMethod using ajax.Good luck. 0Jignesh KumarRank #91 · 22.9K reputation8y agoPosted Jul 30, 2018, 7:15 PM EDT0Hi, If you want to call in web method you can do like this http://www.dotnetfunda.com/forums/show/19441/how-to-access-variable-from-outside-in-webmethod First you need to create static property and then set that property with hdnfiled value then you can use static field in your code 0Mageshwaran RRank #411 · 6.1K reputation7y agoPosted Nov 23, 2019, 7:23 AM EST0Hi,Please refer the below link, it might helps youhttps://www.aspforums.net/Threads/913362/Access-value-of-HiddenField-in-static-WebMethod-in-ASPNet/ 0Join to answer this questionEvery answer you publish earns 20 SHARP.Create free accountSign inKnow the answer?Answer a question in the forums and earn +20 SHARP for every answer.See unanswered questionsForumsTop experts01Arun PottiAnswers in the forums20answers02Tahir AnsariAnswers in the forums5answers03Kamlesh KumarAnswers in the forums5answers04Sam HobbsAnswers in the forums4answers05Željko PerićAnswers in the forums3answers?YouYour name goes here.Every answer: 20 SHARP.JoinFull leaderboard →2026DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
KKkakasaheb kachare94 reputation8y agoPosted Jul 28, 2018, 12:46 AM EDT0Thanks, but how to acess hidden filed value in static methods ,any example 0
Jefferson S. MottaRank #207 · 11.7K reputation8y agoPosted Jul 30, 2018, 6:57 PM EDT0but how to acess hidden filed value in static methods ,any example --- You cannot.You must write a client script to read the value and pass to a WebMethod using ajax.Good luck. 0
Jignesh KumarRank #91 · 22.9K reputation8y agoPosted Jul 30, 2018, 7:15 PM EDT0Hi, If you want to call in web method you can do like this http://www.dotnetfunda.com/forums/show/19441/how-to-access-variable-from-outside-in-webmethod First you need to create static property and then set that property with hdnfiled value then you can use static field in your code 0
Mageshwaran RRank #411 · 6.1K reputation7y agoPosted Nov 23, 2019, 7:23 AM EST0Hi,Please refer the below link, it might helps youhttps://www.aspforums.net/Threads/913362/Access-value-of-HiddenField-in-static-WebMethod-in-ASPNet/ 0
Jenith ThakkarRank #789 · 2.9K reputationPosted Jul 27, 2018, 3:38 AM EDT
kakasaheb kachare94 reputationPosted Jul 28, 2018, 12:46 AM EDT
Jefferson S. MottaRank #207 · 11.7K reputationPosted Jul 30, 2018, 6:57 PM EDT
Jignesh KumarRank #91 · 22.9K reputationPosted Jul 30, 2018, 7:15 PM EDT
Mageshwaran RRank #411 · 6.1K reputationPosted Nov 23, 2019, 7:23 AM EST
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts