Hello I need your..i am new in web: i have HTML
this is my Controller :
string hn;
hn = Content($"{account.HostName}").ToString();
now when debug hn is null. no value pass by html
Hello I need your..i am new in web: i have HTML
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Rajkiran SwainPosted Jun 1, 2023, 4:00 PM
Controller
HTML form:
tags and has the correct class attribute (form-horizontal).nameattribute of the form (name="HnForm") is correctly set.account.HostNamevalue you want to pass to the controller.JavaScript file (HostName.js):
account.HostNamecorrectly and setting it in the HTML element with the idhostname.tag.Controller:
account.HostName.Rolando PunoPosted Jun 1, 2023, 7:58 AM
Hello this my HTML file:
i wanted to pass : id="hostname" to C#.net home Controller, pls help ho can i do
public ActionResult LoginEUA(LoginInfo account)
{
string hn;
hn = Content($"{HostName}").ToString();
}
Mohamed Azarudeen ZPosted Jun 1, 2023, 7:47 AM
There are a few possible reasons why
hncould be null:Ensure that the
accountobject is properly initialized and contains theHostNamefield with a value. You may need to check how theaccountobject is being created or populated.Check if the
HostNamefield is accessible within theaccountobject. Verify that it is a public property or has a public getter method.Ensure that the
Contentmethod is correctly retrieving the value fromaccount.HostName. Verify that theContentmethod is functioning as expected and returning the correct value.Check if the
Contentmethod is handlingnullvalues correctly. Ifaccount.HostNameisnull, theContentmethod might not be returning a valid value.