Monday, April 1, 2019

Pass Another Value from ViewBag or Other ino EditorFor

...
@if (d.fee1 > 0)

{

<div class="form-group">

@Html.LabelFor(model => model.fee1, htmlAttributes: new { @class = "control-label col-md-2" })

<div class="col-md-10">

    @Html.EditorFor(model => model.fee1, new { htmlAttributes = new { @class = "form-control",@Value=d.fee1 } })

    @Html.ValidationMessageFor(model => model.fee1, "", new { @class = "text-danger" })

</div>

</div>

}

@if (d.fee2 > 0)

{

<div class="form-group">

@Html.LabelFor(model => model.Fee2, htmlAttributes: new { @class = "control-label col-md-2" })

<div class="col-md-10">

    @Html.EditorFor(model => model.Fee2, new { htmlAttributes = new { @class = "form-control" ,@Value=d.fee2} })

    @Html.ValidationMessageFor(model => model.Fee2, "", new { @class = "text-danger" })

</div>

</div>

}

Wednesday, March 13, 2019

Html Page Navigator in Visual Studio 2015 / Other Version

Show/Hide Html Page Navigator for .aspx, .cshtml, etc.
Go to
Menu>Tools>Options>Text Editor>HTML>Advanced>Enable Tag Navigator True/False

Tuesday, March 12, 2019

Row number on page/form in Visual Studio 2015 and Other Version

Show/Hide Line/Row number on page/form in Visual Studio 2015 and Other Version

Go to
Menu>Tools>Options>Text Editor>All Languages>General> Line Numbers 

Thursday, January 24, 2019

Print HTML by ID

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {  
$("#btn_print").on("click", function () {
printData();
})
});

function printData() {
var divToPrint = document.getElementById("grdlist"); 
newWin = window.open("");
newWin.document.write(divToPrint.outerHTML);
newWin.print();
newWin.close();
} 
</script>

Friday, October 5, 2018

Selected text in jquery in Dropdownlist


$('#dropDownId :selected').text();

Get Url Parameter in JQuery

Get Url Parameter in JQuery


// Assuming url "http://www.abc.com?cd=1234&name=ram kumar"

<script>
function getUrlParameter(param_name) {
        param_name = param_name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
        var regex = new RegExp('[\\?&]' + param_name + '=([^&#]*)');
        var results = regex.exec(location.search);
        return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
};

$(document).ready(function () {
 alert(getUrlParameter("cd"));
 var v_cd = getUrlParameter("cd");
 var v_name = getUrlParameter("name");
});
</script>

Result
123
ram kumar




Print table in JQuery

<table border="1" cellpadding="3"
id="printTable">
<tbody><tr>
<th>First Name</th>
<th>Last Name</th>
<th>Points</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
<tr>
<td>John</td>
<td>Doe</td>
<td>80</td>
</tr>
<tr>
<td>Adam</td>
<td>Johnson</td>
<td>67</td>
</tr>
</tbody></table>

<br />
<br />

<button>Print me</button>




JQuery is...


function printData()
{
   var divToPrint=document.getElementById("printTable");
   newWin= window.open("");
   newWin.document.write(divToPrint.outerHTML);
   newWin.print();
   newWin.close();
}

$(document).ready(function(){
$('button').on('click',function(){
printData();
})
})

Raw Insert query in EF8 or Entity Framwork 8

          public async Task<object> InsertRack(Rack RackInsert)         {             try             {                 sql = " i...