Passing data from Partial View to its parent View

前端 未结 5 1459
旧巷少年郎
旧巷少年郎 2020-12-19 06:45

If I have a View and a Partial View, is there any way that I can pass data from the Partial View to the parent?

So if I have View.cshtml:



        
5条回答
  •  暖寄归人
    2020-12-19 07:17

    You can simply use javascript for this. I have this hidden textbox in partial view and i want to access it's value in parent view

    
    

    So, simplest way is as follow:

    var allexamcount = document.getElementById("allexamcount").value;
    document.getElementById("examcount").value = allexamcount ;
    

提交回复
热议问题