I would like to include a JavaScript file with razor like this

<script src="@ScriptPath"></script>

Except that I need to change some pathnames dynamically according to @ScriptPath inside the JavaScript before I do. Something like replace all will do.

Can it be achieved and how can it be achieved with razor or/and through controllers?

I'm really stuck on this.

My actionresult is as follows

public ActionResult HolidayReport()
    return View("~/Views/Employee/GetEmployeeHolidayReport.cshtml");

Which currently has the view content of

<div class="panel panel-default panel-main">
    <div class="panel-body">
        @{ Html.RenderAction("Test"); }        

Without even going to the controller or anything of the sorts it throws me the exception

An asynchronous operation cannot be started at this time. Asynchronous operations may only be started within an asynchronous handler or module or during certain events in the Page lifecycle. If this exception occurred while executing a Page, ensure that the Page is marked <%@ Page Async="true" %>. This exception may also indicate an attempt to call an "async void" method, which is generally unsupported within ASP.NET request processing. Instead, the asynchronous method should return a Task, and the caller should await it.

on the @{ Html.RenderAction("Test"); } part in the view. Exchanging it for @Html.Action() results in the same problem. What might be going on?

I have GridView1 with results that change after my event fire,i need to append data (not copy) from GridView1 to my GridView2, i need to save all results that was in GridView1

Here is my code(not full) and my goal;

      private void BindQuestions(int quiz)
       //i have fuction that run this each time with difrant id
       //and GridView1 thatshows me result each time
       DataSet oDs = SqlHelper.ExecuteDataset(sCon, "Ps_Quiz_GetQsns",quiz));
       GridView1.DataSource = oDs.Tables[0];

 //my goal
          private void appendToGridView2 ()
        //i need some think like this

I'm sure this is a simple fix but I am wrecking my brain trying to figure this out.

Below is the main parts of the code.


var PurchaseOrderModel = function () {
    var self = this;

    self.OrderNumber = ko.observable();
    self.Description = ko.observable();

    self.GetPurchaseOrder = function(Id) {
            type: "GET",
            url: 'URL' + Id,
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) {
                self.OrderNumber = ko.observable(data.OrderNumber);
                self.Description = ko.observable(data.Description);
            error: function (err) {
                alert(err.status + " : " + err.statusText);

//DOM Loaded
$(document).ready(function () {
    var po = new PurchaseOrderModel();



    <input id="test" type="text" data-bind="value: OrderNumber">
    <input type="text" data-bind="value: Description">

    <p type="text" data-bind="text: OrderNumber"></p>


return Json(new
        OrderNumber = model.OrderNumber,
        Description = model.Description
    }, JsonRequestBehavior.AllowGet);

This is what I see in the inspector Network tab


So the data is being returned, I'm just wondering why the UI isn't catching it / binding properly.

Any insight is appreciated!

I've recently rebuilt an older website on a new platform, URL structures are completely different so I need to add redirects on certain pages. Within the IIS site, it runs multiple subdomains for different websites. So a blanket redirect wouldn't work.

I've tried adding conditions on the HOST & URL but the following code doesnt seem to work:

<rule name="Test Redirect" stopProcessing="true">
  <match url="(.*)" />
      <add input="{HTTP_HOST}" pattern="^sub1\.staging\.domain\.co\.uk$" />
      <add input="{REQUEST_URI}" pattern="^testredirect/?$" />
   <action type="Redirect" url="http://redirectdomain.co.uk" redirectType="Permanent" />

I've used the following links for help:

https://forums.iis.net/t/1228667.aspx https://forums.iis.net/t/1168593.aspx

I have ASP.NET project that is using SQLite database. Using NuGet package manager on my dev machine (Windows, Visual Studio 2013) I have added SQLite Core package to the project and on Windows everythings works fine.

The app targets .NET 4.5.1.

I need to host this project on Mono on Linux, but I can't get it running. If I just copy the content of the published project including bin folder to the web server I end up with exception when I try to open SQLiteConnection.


Stack trace:

  at (wrapper managed-to-native) System.Data.SQLite.UnsafeNativeMethods:sqlite3_config_none (System.Data.SQLite.SQLiteConfigOpsEnum) 
  at System.Data.SQLite.SQLite3.StaticIsInitialized () <0x40b70510 + 0x0008b> in <filename unknown>:0 
  at System.Data.SQLite.SQLiteLog.Initialize () <0x40b700f0 + 0x00027> in <filename unknown>:0  
  at System.Data.SQLite.SQLiteConnection..ctor (System.String connectionString, Boolean parseViaFramework) <0x40b6d900 + 0x0004f> in <filename unknown>:0 
  at System.Data.SQLite.SQLiteConnection..ctor (System.String connectionString) <0x40b6d8d0 + 0x00013> in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.Data.SQLite.SQLiteConnection:.ctor (string)
  at web.Controllers.TestController.CreateSqLiteConnection () <0x40b6d7f0 + 0x00053> in <filename unknown>:0 
  at web.Controllers.TestController.Index () <0x40b6d4a0 + 0x0002f> in <filename unknown>:0 
  at (wrapper dynamic-method) System.Object:lambda_method (System.Runtime.CompilerServices.Closure,System.Web.Mvc.ControllerBase,object[])
  at System.Web.Mvc.ActionMethodDispatcher.Execute (System.Web.Mvc.ControllerBase controller, System.Object[] parameters) <0x40b6d460 + 0x0002d> in <filename unknown>:0 
  at System.Web.Mvc.ReflectedActionDescriptor.Execute (System.Web.Mvc.ControllerContext controllerContext, IDictionary`2 parameters) <0x40b6bf40 + 0x00107> in <filename unknown>:0 
  at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod (System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ActionDescriptor actionDescriptor, IDictionary`2 parameters) <0x40b6bee0 + 0x00033> in <filename unknown>:0 
  at System.Web.Mvc.Async.AsyncControllerActionInvoker+ActionInvocation.InvokeSynchronousActionMethod () <0x40b6beb0 + 0x00025> in <filename unknown>:0 
  at System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39 (IAsyncResult asyncResult, ActionInvocation innerInvokeState) <0x40b6bd00 + 0x00013> in <filename unknown>:0 
  at (wrapper delegate-invoke) System.Web.Mvc.Async.EndInvokeDelegate`2[System.Web.Mvc.Async.AsyncControllerActionInvoker+ActionInvocation,System.Web.Mvc.ActionResult]:invoke_TResult_IAsyncResult_TState (System.IAsyncResult,System.Web.Mvc.Async.AsyncControllerActionInvoker/ActionInvocation)
  at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncResult`2[TResult,TState].CallEndDelegate (IAsyncResult asyncResult) <0x40b6bc80 + 0x0006a> in <filename unknown>:0 
  at System.Web.Mvc.Async.AsyncResultWrapper+WrappedAsyncResultBase`1[TResult].End () <0x40b6b5a0 + 0x00053> in <filename unknown>:0 
  at System.Web.Mvc.Async.AsyncResultWrapper.End[TResult] (IAsyncResult asyncResult, System.Object tag) <0x40b6b450 + 0x0003b> in <filename unknown>:0 
  at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod (IAsyncResult asyncResult) <0x40b6bc40 + 0x0002b> in <filename unknown>:0 
  at System.Web.Mvc.Async.AsyncControllerActionInvoker+AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d () <0x40b6b9f0 + 0x0007a> in <filename unknown>:0 
  at System.Web.Mvc.Async.AsyncControllerActionInvoker+AsyncInvocationWithFilters+<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f () <0x40b6b7e0 + 0x00038> in <filename unknown>:0  

I've seen that there are (probably) different SQLite DLLs for Mono? I've tried some of those found on sqlite web site, but nothing worked for me...

What is required to host such web app on Mono?


In this statement DateTime.Now.ToString, where does the Now come from? Is it from the Control Panel-> Region settings?

If we want to change the format of the outcome of the function DateTime.Now.ToString without changing the code, can we do that by chaning the date format in Region setting?

I Write this code for crude operations but here updation is not working peoperly.please check it.and let me inform very i modify

protected void gv_onrowupdate(object sender, GridViewUpdateEventArgs e) { TextBox tname = (TextBox)GridView1.Rows[e.RowIndex].FindControl("name");

    //SqlCommand cmd = new SqlCommand("update employee set NAME=@NAME where ID=@ID", con);

    SqlCommand cmd = new SqlCommand("update_emp", con);
    cmd.Parameters.AddWithValue("@ID", GridView1.DataKeys[e.RowIndex].Values[0].ToString());
    //cmd.Parameters.AddWithValue("@NAME", tname.Text);

    GridView1.EditIndex = -1;

I have two placeholders/panels:

<!-- This panel is displayed for logged-in members -->
<asp:Panel ID="PanelLogged" runat="server" Visible="false">
  <cc:MyControl1 runat="server" />

<!-- This panel is displayed for NON logged-in members -->
<asp:Panel ID="PanelNotLogged" runat="server" Visible="true">
  <cc:MyControl2 runat="server" />

In Page.Page_Load event, I'm showing/hiding one of those panels. In both custom controls I have Page_Load event, where I'm populating them/making some tasks. However, Page_Load event is called on both custom controls all the time, even if Panel has property Visible="false".

How can I call only one Page_Load of the control which is currently visible? I tried with DataBind() event but with no success.

I'm trying to do a simple call from html to C# to return the current 'Message' in an array. I am trying to send the index in the array from a javascript method, but it's not letting me, saying "The name 'rowID' does not exist in the current context". I understand from this Stack Overflow post, that he's struggling to pass in the variable, however for him there's no parameter to insert. So I'm still stick on the same problem. This is what I want to do:

var rowID = table.row('.selected').index();
SetSmartWindow(@Model.Messages[rowID].DeviceId, false, false, false, false, false, false);

I'm trying to add deeplinking to a page that requires it.

But for some reason it is not working.

$(document).ready(function () {
        $('#takeMeBack').click(function () {
            if (isMobile.any()) {


<asp:HyperLink ID="takeMeBack" runat="server" Text="Take Me Back To The App" CssClass="btn btn-success btn-block"></asp:HyperLink>

I have following two class which is already inherited to XYZ

Country Class

public class country_master : XYZ
        private string _id;

        public string id
            get { return _id; }
            set { _id = value; }
        private string _country_code;

        public string country_code
            get { return _country_code; }
            set { _country_code = value; }

        private string _country_name;

        public string country_name
            get { return _country_name; }
            set { _country_name = value; }

State Class

public class state_master: XYZ
        private string _id;

        public string id
            get { return _id; }
            set { _id = value; }
        private string _state_code;

        public string state_code
            get { return _state_code; }
            set { _state_code= value; }

        private string _state_name;

        public string state_name
            get { return _state_name; }
            set { _state_name= value; }

Now, I want to use country_name in my state_master class how it is possible?

Thank You.

I try to create SPA using angularjs that allow change data in EF context without call saveChanges() and then save(call saveChanges()) or cancel changes.


public class MyController : ApiController
        private Oralce_dbContainer _db = new Oralce_dbContainer();

        public async Task<IHttpActionResult> GetItems(int? ParentId)

            var Parent = await _db.parents.FindAsync(ParentId);
            var items = Parent.Item.ToList();
            return Ok(items);

        public async Task<IHttpActionResult> Delete(Item item)
            var i = await _db.Item.FirstOrDefaultAsync(x => x.id == item.id);
            return Ok(true);

        protected override void Dispose(bool disposing)
            if (disposing)

I get items then post delete and get items again I get all items with deleted item. How can i save EF context beetwen calling controller actions?

I have a view with a dropdown list and kendo grid with checkbox. I want to pass the selected data from the checked data in my kendo grid and pass the dropdown list in one button to controller. But i confused how to do the data parsing, and how the controller is look like? I'm just a beginner in this razor mvc4 ,so please help me. Thanks in advanced.


<div class="tables">
    <div class="table-responsive bs-example widget-shadow">
        <h4>Data Kuisioner:</h4>
                    .OptionLabel("Pilih gelombang . . .")
                    .HtmlAttributes(new { style = "width:50%" })
                    .Filter("contains").DataSource(source => { source.Read(read => read.Action("GetgelombangByJSON", "Kuisioner")); })
                <a href="#" type="button" class="btn btn-success" id="btnSave" name="btnSave">Set Kuisioner</a>

            .Columns(columns =>
                columns.Template(@<text></text>).ClientTemplate("<input type='checkbox' #= id_pertanyaan ? checked='checked':'' # class='chkbx' />")
                .HeaderTemplate("<input type='checkbox' id='masterCheckBox' onclick='checkAll(this)'/>").Width(30);
                columns.Bound(p => p.id_pertanyaan).Hidden();
                columns.Bound(p => p.pertanyaan).Title("Pertanyaan");
                columns.Command(command => { command.Edit(); command.Destroy(); }).Width(250);
            .ToolBar(toolbar => toolbar.Create())
            .Editable(editable => editable.Mode(GridEditMode.InLine))
            .DataSource(dataSource => dataSource
                .Events(events => events.Error("error_handler").Sync("sync_handler"))
                .Model(model => model.Id(p => p.id_pertanyaan))
                .Create(update => update.Action("kuisioner_Create", "Kuisioner"))
                .Update(update => update.Action("kuisioner_Update", "Kuisioner"))
                .Read(read => read.Action("kuisioner_read", "Kuisioner"))
                .Destroy(update => update.Action("kuisioner_Delete", "Kuisioner"))



<script type="text/javascript">
    function error_handler(e) {    
        if (e.errors) {
            var message = "Errors:\n";
            $.each(e.errors, function (key, value) {
                if ('errors' in value) {
                    $.each(value.errors, function() {
                        message += this + "\n";

    function sync_handler(e) {

    $(function () {
        $('#grid').on('click', '.chkbx', function () {
            var checked = $(this).is(':checked');
            var grid = $('#grids').data().kendoGrid;
            var dataItem = grid.dataItem($(this).closest('tr'));
            dataItem.set('id_pertanyaan', checked);

    function checkAll(ele) {
        var state = $(ele).is(':checked');
        var grid = $('#grid').data().kendoGrid;
        $.each(grid.dataSource.view(), function () {
            if (this['id_pertanyaan'] != state)
                this.dirty = true;
            this['id_pertanyaan'] = state;

i'm using C# asp.net mvc 4 and i'm making a dictionary to be send and displayed at test.cshtml i'm new to c# and i have problem with casting the object value Dictionary in the cshtml page.

here's my object class and i send it using viewbag :

Dictionary<string, User> dic = new Dictionary<string, User>();
dic.Add("1", new User { ID_Task = "task1", Agent = "shasapo" });
dic.Add("2", new User { ID_Task = "task2", Agent = "fania" });
dic.Add("3", new User { ID_Task = "task3", Agent = "andre" });
ViewBag.taskDetailVehicle = dic;

and here's my first try in test.cshtml how i get the value :

    @if (ViewBag.taskDetailVehicle.ContainsKey("3"))
      User test1 = ViewBag.taskDetailVehicle.Where(z => z.Value.ID_Task == "3").FirstOrDefault().Value;
      User test2 = ViewBag.taskDetailVehicle.Values.FirstOrDefault(k => k.ID_Task == "3");

But this code is giving me error : "Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type".

Then i try other ways :

@if (ViewBag.taskDetailVehicle.ContainsKey("3"))
      User test1 = ViewBag.taskDetailVehicle["3"];
      <p>test1.ID_Task <br/> test1.Agent </p>

But it's return null..

help me please, is there any way to get the value by key ?

I am stuck here and cannot think of a more accurate answer.
Its not a good question but for me its a confusing issue.

I am working of the asset management system. In this it will have 4 assets inherited from main asset class in model shown below: Model of my Asset category and sub categories.

Now the confusing part is i have a view as shown below:Index page of user ans its asset categories consists of ActionLinks of category name

The controller is empty scaffolding template as shown below: Empty controller to handle the request for particular category selected

The confusing part:

I want to get the selected category identity through action links from view to controller and then perform Crud and listing for that particular category selected.

Update: i tried

@Html.ActionLink("Furniture","Index","IndividualAsset",new { id = 1 }), well it isn't working. So i have to get an idea for implementing this. Also i want to to be handled from one controller only. is it possible?

Thanks in advance.

In my many-to-one relationship I am trying to delete one of the child objects and keep an audit trail in my overridden SaveChanges.

The file.Entity.Product is not null when doing an EntityState.Modified or EntityState.Added but when doing a .Deleted EF seems to be aggressively removing the relationship from the entity even before base.Savechanges() is called.

Is there any way to retrieve when Product this file was associated with in my SaveChanges override after I have called .Remove on the File (child)?

var files = from e in ChangeTracker.Entries<SavedFile>()
                    where e.State != EntityState.Unchanged
                    select e;
if (file.State == EntityState.Deleted)
                var text = "File Deleted: " + file.Entity.FriendlyFileName;
                // file.Entity.Product is null
                var updatedProduct = new Update { Product = file.Entity.Product, UpdateDateTime = DateTime.Now, UpdateText = text, User = HttpContext.Current.Request.LogonUserIdentity.Name };

I am using this Grid view nested into another grid view so there's nothing wrong with the parent grid but I have this child grid in which I have this update button, after changing the value in one of the textboxes in grid view and when I click on the Update button nothing happens and i checked the database table too it's not updated either. Please help me fix it. Thank you. The Parent Grid is connected to datasource in the run time code whereas the child grid is databound from the back end.

The table looks like this:I've reduced the size of the code so people could go through it fast

enter image description here

The frond end code:

 <div id="dvSDate1">
   <asp:UpdatePanel ID="PnlUsrDetails" runat="server">
        <asp:GridView ID="gvSDate" runat="server" AutoGenerateColumns="false" CssClass="Grid" DataKeyNames="ID" OnRowDataBound="OnRowDataBound" DataSourceID="OleDBDataSource1">
           <img alt="+" style="cursor: pointer" src="images/plus.png" onclick="ShowHideDiv()"/>
           <asp:Panel ID="pnlSDate" runat="server" Style="display: none">
            <asp:GridView ID="gvSDate2" runat="server" AutoGenerateColumns="false" CssClass="ChildGrid" DataKeyNames="ID" OnRowUpdating="updategvSDate2">
                    <td><asp:Label ID="lblID" runat="server" Text='<%#Eval("ID") %>' /></td>
                    <td><asp:TextBox ID="textFunction" runat="server" Text='<%#Eval("Function") %>' /></td>
                    <th>நிகழ்ச்சி தேதி</th>
                    <td><asp:TextBox ID="textFunctionDate" runat="server" Text='<%#Eval("FunctionDate") %>' /></td>
                    <th>நிகழ்ச்சி நேரம்</th>
                    <asp:DropDownList ID="ddlFunctionTime" runat="server" Text='<%#Eval("FunctionTime") %>'>
                       <asp:ListItem Value="">--Select--</asp:ListItem>
                       <asp:ListItem Value="காலை 05:00AM - 01:00PM">காலை 05:00AM - 01:00PM</asp:ListItem>
                       <asp:ListItem Value="மாலை 02:00PM - 10:00PM">மாலை 02:00PM - 10:00PM</asp:ListItem>
                       <asp:ListItem Value="முழு நாள் 05:00AM - 10:00PM">முழு நாள் 05:00AM - 10:00PM</asp:ListItem>
                    <th>கொண்டாடுபவர் பெயர்</th>
                    <td><asp:TextBox ID="textCelebrateName" runat="server" Text='<%#Eval("CelebrateName") %>' /></td>
              <asp:ButtonField CommandName="Update" Text="Update" />
       <asp:BoundField ItemStyle-Width="150px" DataField="CelebrateName" HeaderText="கொண்டாடுபவர் பெயர்" />
       <asp:BoundField ItemStyle-Width="150px" DataField="Function" HeaderText="நிகழ்ச்சி" />
       <asp:BoundField ItemStyle-Width="150px" DataField="FunctionDate" HeaderText="நிகழ்ச்சி தேதி" DataFormatString="{0:dd-MM-yyyy}" />
       <asp:BoundField ItemStyle-Width="150px" DataField="FunctionTime" HeaderText="நிகழ்ச்சி நேரம்" />
       <asp:BoundField ItemStyle-Width="150px" DataField="CelebratePhone" HeaderText="கொண்டாடுபவர் கைபேசி" />
       <asp:BoundField ItemStyle-Width="150px" DataField="CelebrateAddress" HeaderText="கொண்டாடுபவர் முகவரி" />
    <asp:SqlDataSource runat="server" ID="OleDBDataSource1" ConnectionString='<%$ ConnectionStrings:ConnectionString %>' ProviderName='<%$ ConnectionStrings:ConnectionString.ProviderName %>' SelectCommand="SELECT [ID], [CelebrateName], [Function], [FunctionDate], [FunctionTime], [CelebratePhone], [CelebrateAddress] FROM [function] WHERE ([FunctionDate] = ?)">
       <asp:FormParameter FormField="txtSDate" Name="FunctionDate" Type="DateTime"></asp:FormParameter>
 <asp:AsyncPostBackTrigger ControlID="btnSDate" EventName="Click" />

The back end code:

private static DataTable GetData(string query)
    string strConnString = ConfigurationManager.ConnectionStrings["MandapamDatabase"].ConnectionString;
    using (OleDbConnection con = new OleDbConnection(strConnString))
       using (OleDbCommand cmd = new OleDbCommand())
          cmd.CommandText = query;
          using (OleDbDataAdapter sda = new OleDbDataAdapter())
             cmd.Connection = con;
             sda.SelectCommand = cmd;
             using (DataSet ds = new DataSet())
                DataTable dt = new DataTable();
                return dt;

protected void OnRowDataBound(object sender, GridViewRowEventArgs e)
    if (e.Row.RowType == DataControlRowType.DataRow)
       string ID = gvSDate.DataKeys[e.Row.RowIndex].Value.ToString();
       GridView gvSDate2 = e.Row.FindControl("gvSDate2") as GridView;
       gvSDate2.DataSource = GetData(string.Format("select ID, Function, FunctionDate, FunctionTime, CelebrateName from function where ID={0}", ID));
protected void updategvSDate2(object sender, GridViewUpdateEventArgs e)
   GridView gvSDate2 = sender as GridView;
   int ID = Convert.ToInt32(((Label)gvSDate2.Rows[e.RowIndex].FindControl("lblID")).Text);
   string Function = ((TextBox)gvSDate2.Rows[e.RowIndex].FindControl("textFunction")).Text;
   string FunctionDate = ((TextBox)gvSDate2.Rows[e.RowIndex].FindControl("textFunctionDate")).Text;
   string FunctionTime = ((DropDownList)gvSDate2.Rows[e.RowIndex].FindControl("ddlFunctionTime")).Text;
   string CelebrateName = ((TextBox)gvSDate2.Rows[e.RowIndex].FindControl("textCelebrateName")).Text;
   int index = Function.IndexOf(",");
   string finalFunction = Function.Substring(index + 1);
   index = FunctionDate.IndexOf(",");
   string finalFunctionDate = FunctionDate.Substring(index + 1);
   index = FunctionTime.IndexOf(",");
   string finalFunctionTime = FunctionTime.Substring(index + 1);
   index = CelebrateName.IndexOf(",");
   string finalCelebrateName = CelebrateName.Substring(index + 1);
   index = ReferenceAddress.IndexOf(",");
   this.Update(ID, finalFunction, finalFunctionDate, finalFunctionTime, finalCelebrateName);
   gvSDate2.EditIndex = -1;
   gvSDate.DataSource = OleDBDataSource1;
private void Update(int iD, string Function, string FunctionDate, string FunctionTime, string CelebrateName)
   string strConnString = ConfigurationManager.ConnectionStrings["MandapamDatabase"].ConnectionString;
   string OleDbStatement = "Update function SET Function=@Function,FunctionDate=@FunctionDate,FunctionTime=@FunctionTime,CelebrateName=@CelebrateName WHERE ID=@ID";
    using (OleDbConnection con = new OleDbConnection(strConnString))
       using (OleDbCommand cmd = new OleDbCommand(OleDbStatement, con))
          cmd.Parameters.AddWithValue("@ID", ID);
          cmd.Parameters.AddWithValue("@Function", Function);
          cmd.Parameters.AddWithValue("@FunctionDate", FunctionDate);
          cmd.Parameters.AddWithValue("@FunctionTime", FunctionDate);
          cmd.Parameters.AddWithValue("@CelebrateName", CelebrateName);

Here I want to show paging system from html generator ... How do i do that any paging style will be accaptable ...(1..2..3..4..)or (Next

public string LoadDealHistory(DealHistory aDealhistory) { StringBuilder html = new StringBuilder(); try {

        using (DealTranctionGateway dealTranctionGateway = new DealTranctionGateway())
            DataTable dt = new DataTable();
            dt = dealTranctionGateway.LoadDealHistory(aDealhistory);
            string dealHistory = "";
            string updateOn = "";
            if (dt.Rows.Count > 0)

                html.Append("<table class='table table-bordered'>");
                html.Append("<th>Admin Name</th>");
                html.Append("<th>Marchent Name</th>");

                for (int i = 0; i < dt.Rows.Count; i = i + 1)
                    int sNo = i + 1;
                    html.Append("<td>" + sNo + "</td>");
                    html.Append("<td>" + dt.Rows[i]["field"] + "</td>");
                    html.Append("<td>" + dt.Rows[i]["old"] + "</td>");
                    html.Append("<td>" + dt.Rows[i]["new"] + "</td>");

                    if (string.IsNullOrEmpty(dt.Rows[i]["Name"].ToString()) == true && dt.Rows[i]["MarchentName"] != null)
                        html.Append("<td>" + dt.Rows[i]["MarchentName"] + "</td>");


                   else if (dt.Rows[i]["Name"] != null && dt.Rows[i]["MarchentName"] != null)
                        html.Append("<td>" + dt.Rows[i]["Name"] + "</td>");

                    updateOn = ((DateTime)dt.Rows[i]["UpdatedOn"]).ToString("dd-MM-yyyy", CultureInfo.InvariantCulture);
                    html.Append("<td>" + updateOn + "</td>");
                    // html.Append("<td>" + dt.Rows[i]["UpdatedOn"].ToString("dd-MM-yyyy", CultureInfo.InvariantCulture) + "</td>");

    catch (Exception ex)
    return html.ToString();


In my case ASP.NET controls are posting back to server and some are with UpdatePanel requests. I need to show Loading... box when __doPostBack is being called. I went through ScriptResources javascripts to find any event but couldn't.

Is there any way by which I can get the callback when __doPostBack is in progress, started or completed?