locked
changing profile value in MVC view RRS feed

  • Question

  • Hi all:

    I have an MVC application where I need to show some data based profile value saved in web.config .

    <profile>

     <properties>

    <add name="visStats" type="UInt16" defaultValue="0" allowAnonymous="true" />

      </properties>

    </profile>




    Inside the view, I have two <a hrefs>, I want to change the value of profile on click of these hrefs as well as toggle view of a tr like below

     

                                      <div id="seasonclicked"> <a id="visSeasonbut" onclick="VisSeason_Click" runat="server" >Season 1</a></div>

                                 <div id="game"> <a id="visGamebut" onclick="VisGame_Click"  runat="server" >Game 1</a></div>

                                                            <%

                                                if (Profile.visStats == 0)

                                                {%>

                                                    <img id="image1" alt="" class="statbackground" src="leftblueFolder.png"/>

                                                <%   visSeasonbut.ID = "seasonclicked";

                                                    visGamebut.ID = "game";%>

                                                    

                                               <%}

                                                else

                                                { %>

                                                    <img id="image2" alt="" class="statbackground" src="rightblueFolder.png"/>

                                                <%    visSeasonbut.ID = "season";

                                                      visGamebut.ID = "gameclicked";%> 

                                                    

                                            <%   }%>  

    how can I create the server side events for these hrefs to modify the the profile value like below:




    protected void visSeason_Click(object sender, EventArgs e)

    {

        Profile.visStats = 0;  

    }



    protected void VisGame_Click(object sender, EventArgs e)

    {

        Profile.visStats = 1; 

    }

    Regards,

    Asif Hameed
    • Moved by Cookie Luo Friday, February 18, 2011 6:25 AM (From:Common Language Runtime)
    Wednesday, February 16, 2011 1:10 PM

Answers

  • Hi Asif Hameed,

    For an asp.net issue, please visit asp.net forum for better support.

    Thanks for your understanding.


    Cookie Luo[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Proposed as answer by Just Karl Wednesday, January 15, 2014 3:37 PM
    • Marked as answer by Just Karl Thursday, January 23, 2014 11:02 PM
    Friday, February 18, 2011 6:24 AM
  • Hello,

    Specifically, this should be asked in the ASP.Net MVC forum on forums.asp.net.

    Karl


    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C40686F746D61696C2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

    • Proposed as answer by Just Karl Thursday, January 16, 2014 10:31 PM
    • Marked as answer by Just Karl Thursday, January 23, 2014 11:02 PM
    Wednesday, January 15, 2014 3:37 PM

All replies