c# - New Line at Every Full Stop in ASP.NET MVC -
i connect sql database using asp.net mvc. new concept , looking make database displayed in more readable format.
at minute, have field within database table called description , application dumps in field on page. wanting make easier read having brand new line each sentence. want start new line @ every full stop.
this view...
@model dataintelligence.models.error @{ viewbag.title = "details"; } <script language="javascript" type="text/javascript" src="jquery-1.8.3.js"> </script> <script> function goback() { window.history.back(); } </script> <div class="jumbotron"> <h2>error details</h2> </div> <fieldset> <legend>@html.displayfor(model => model.source)</legend> <div class="row"> <div class="col-sm-3"> <div class="display-label"> @html.displaynamefor(model => model.executionid) </div> <div class="display-field"> @html.displayfor(model => model.executionid) </div> </div> <div class="col-sm-3"> <div class="display-label"> @html.displaynamefor(model => model.number) </div> <div class="display-field"> @html.displayfor(model => model.number) </div> </div> <div class="col-sm-3"> <div class="display-label"> @html.displaynamefor(model => model.tfsbugid) </div> <div class="display-field"> @html.displayfor(model => model.tfsbugid) </div> </div> <div class="col-sm-3"> <div class="display-label"> @html.displaynamefor(model => model.date) </div> <div class="display-field"> @html.displayfor(model => model.date) </div> </div> </div> <br /> <div class="display-label"> @html.displaynamefor(model => model.description) </div> <div class="display-field"> <p> @html.displayfor(model => model.description)</p> </div> </fieldset> <button class="btn btn-link" onclick="goback()">back list</button>
and sample data...
ssis error code dts_e_primeoutputfailed. primeoutput method on new accounts source returned error code 0xc0202092. component returned failure code when pipeline engine called primeoutput(). meaning of failure code defined component, error fatal , pipeline stopped executing. there may error messages posted before more information failure. appreciated, thank you
in action method format string , put <br />
in end of new line.
public actionresult getmyerror(int id) { error model=_mydb.get(id); model.description=model.description.replace(". ","<br />"); return view(model); }
and in model need add [datatype(datatype.html)]
property.
class error { // other members [datatype(datatype.html)] public string description {get; set;} }
Comments
Post a Comment