Click here to Skip to main content
15,886,629 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I am working in asp.net mvc5 view , how to know if id is written in the textbox , here ,How to know if Id is written here and save that value for another use ??? How to know if id is already set in the textbox ?I TRIED THIS BUT ITS NOT WORKING
@if (Html.EditorFor(model => model.Id) !=null)

    { SHOW id}


What I have tried:

=-========================================================================
Posted
Updated 10-Jan-18 1:20am
v3
Comments
ddgjgj 10-Jan-18 6:39am    
?
Karthik_Mahalingam 10-Jan-18 7:06am    
check the current value with the new value, if it is not same then the value has been edited from the textbox.
ddgjgj 10-Jan-18 7:06am    
Sir , lets be clear again , i am in the create view so i am about to create a new entity that does not exist and doesnt have already an ID , lets pretend the user is filling all the fields in the view ID TITLE and so on , i want that ON THE FLY to do that , if the user writes something in the ID Editor field ,ID is a string and lets say he wrote HAHAHA as ID , now i want to have that value to have that 'HAHAHA' and show in the view as readonly text ..so inside the create view @if (Html.EditorFor(model => model.Id) !=null){ SHOW what user wrote in ID field}
Karthik_Mahalingam 10-Jan-18 7:12am    
during submit?
ddgjgj 10-Jan-18 7:20am    
Sir , lets be clear again , i am in the create view so i am about to create a new entity that does not exist and doesnt have already an ID , lets pretend the user is filling all the fields in the view ID TITLE and so on , i want that ON THE FLY to do that , if the user writes something in the ID Editor field ,ID is a string and lets say he wrote HAHAHA as ID , now i want to have that value to have that 'HAHAHA' and show in the view as readonly text ..so inside the create view @if (Html.EditorFor(model => model.Id) !=null){ SHOW what user wrote in ID field} , what i want is to create a link inside the view like this (on the fly ) : @Html.ActionLink("Details1", "Details1", new { id = Model.Id }) and this Id is automatically filled with the text that user writes in the ID FIELD , ID is a string , and let forget a little about validation , constratins and so on , is this possible or not ?thanks a lot

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900