Sunday, 15 September 2013

c# - How to change style of DIV element in view from controller? -



c# - How to change style of DIV element in view from controller? -

i have next div in view:

<div id="review"> review: <p> <%:viewdata["review"]%> </p> <input name="submit" id="submit" type="submit" value="ok"/> </div>

how can set div visibility visible within of controller when button clicked?

this code fragment in controller:

public actionresult index(esafemodel model,string submit, string create) { if (button.equals("create")) { viewdata["review"] = esafedata.createreview(esafe); } else if (button.equals("ok")) { if (esafedata.create(esafe)) { viewdata["message"] = "e-safe info created!!!"; } } }

you can't straight div on client side , controller server side. can have property in model bound view .this can have value of visibility attribute div , can assign using server tags div

below sample code snippet

<div id="elementid" style="visibility:'<%=model.visible %>'"/>

on click of button can homecoming same view , model time model have visible ="hidden"

c# model-view-controller view controller code-behind

No comments:

Post a Comment