I need to add the control in the page at the run time. i have a code to add the control dynamically. but the control disappears when i refresh the page or close the page. i need to display the controls in the page itself when i refresh or close the page.
@using (Html.BeginForm())
{
}
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 24, 2013, 5:17 AM EDT
You need to store number of dynamic controls created in your database and when you load next time the same page depend on the count you can create those many number of controls. I believe you are also saving the data for each dynamic control so while creating the control you can also bind the data which was saved earlier.
Regards,
Iftikar
vidhyaRank #4,868 · 321 reputationPosted Jul 24, 2013, 7:50 PM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 24, 2013, 7:52 PM EDT
Regards,
Iftikar
vidhyaRank #4,868 · 321 reputationPosted Jul 24, 2013, 8:28 PM EDT
$(document).ready(function()
{
$("#txt").click(function()
{
here need to update the count in the database. how to update the value in the db.i m new to jquery
var $ctrl = $('').attr({ type: 'text', name:'text', value:'text'}).addClass("text");
$("#holder").append($ctrl);
});
}
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 24, 2013, 8:59 PM EDT
Regards,
Iftikar
vidhyaRank #4,868 · 321 reputationPosted Jul 24, 2013, 9:21 PM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 24, 2013, 9:33 PM EDT
Regards,
Iftikar
vidhyaRank #4,868 · 321 reputationPosted Jul 24, 2013, 9:37 PM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 24, 2013, 9:57 PM EDT
in your cshtml
in your controller
Regards,
Iftikar
vidhyaRank #4,868 · 321 reputationPosted Jul 24, 2013, 9:59 PM EDT
If i use there(bolded text) it displays at any time. how can i use for loop there.
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 24, 2013, 10:08 PM EDT
Regards,
Iftikar
vidhyaRank #4,868 · 321 reputationPosted Jul 24, 2013, 10:30 PM EDT
Without clicking the save button, i need the controls stable on the page.
vidhyaRank #4,868 · 321 reputationPosted Jul 24, 2013, 10:33 PM EDT
When i click it should add. it should appear when i refresh the page or close the page.
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 24, 2013, 10:45 PM EDT
Regards,
Iftikar
vidhyaRank #4,868 · 321 reputationPosted Jul 24, 2013, 10:48 PM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 24, 2013, 10:57 PM EDT
Regards,
Iftikar
vidhyaRank #4,868 · 321 reputationPosted Jul 24, 2013, 11:15 PM EDT
how do i submit to the page?
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 24, 2013, 11:21 PM EDT
http://blog.stevensanderson.com/2010/01/28/editing-a-variable-length-list-aspnet-mvc-2-style/
Regards,
Iftikar
vidhyaRank #4,868 · 321 reputationPosted Jul 25, 2013, 1:04 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 25, 2013, 1:23 AM EDT
Regards,
Iftikar
vidhyaRank #4,868 · 321 reputationPosted Jul 25, 2013, 2:50 AM EDT
@using (Html.BeginCollectionItem("MatchingQuestionModel"))
{
@Html.LabelFor(m => m.QuestionTitle)
@Html.EditorFor(m => m.QuestionTitle)
}
@using (Html.BeginForm())
{
@Html.ActionLink("Add", "QuestionCreateMatching", "Test", new { id = "addItem" }, null)
}
I am getting ,
Compiler Error Message: CS1061: 'System.Web.Mvc.HtmlHelper
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 25, 2013, 4:04 AM EDT
@using (Html.BeginCollectionItem("MatchingQuestionModel"))
{
@Html.LabelFor(m => m.QuestionTitle)
@Html.EditorFor(m => m.QuestionTitle)
}
Regards,
Iftikar
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts