Friday 15 February 2013

asp.net - How do you get a single column of a gridview to auto-update without refreshing the whole page? -


I have a Gridwuv with many columns, but only one column should change dynamically. Each line has a "status" value that requires a database call to update me. I wrote a function to the call, but it is written to the I to the current approach to updating, it removes, because it is difficult does refresh the entire page Rifresing position (in other areas of the page Selected values, scrolled locations, etc.).

I have written the code to try to set it:

   & Lt; Asp: UpdatePanel id = "update_panel" updatemod = "conditional" runat = "server" & gt; & Lt; Trigger & gt; & Lt; Asp: AsyncPostBackTrigger ControlID = "timer_1" EventName = "Tic" /> & Lt; / Trigger & gt; & Lt; ContentTemplate & gt; & Lt; Asp: GridView ID = "my_gridview" runat = "server" AutoGenerateColumns = "false" gridlines = "no" width = "100%" AllowSorting = "right" CssClass = "Table Table bordered X-intensive cameraDetails" OnRowDataBound = "My_list_RowDataBound "EmptyDataText =" No Generated Heatmaps "& gt; & Lt; Columns & gt; & Lt; Asp: TemplateField Meta: resourceKey = "StringSourceID" & gt; & Lt; HeaderTemplate & gt; & Lt; Asp: label id = "srcTitleLbl" runat = "server" text = "source" /> & Lt; / HeaderTemplate & gt; & Lt; ItemTemplate & gt; & Lt; Asp: Label ID = "SrcLbl" Rnat = "server" CssClass = "LinkBtn_Type" meta: resourceKey = "srcLblResource" / & gt; & Lt; / ItemTemplate & gt; & Lt; / ASP: TemplateField & gt; & Lt; Asp: TemplateField Meta: resourceKey = "StringStatus" & gt; & Lt; HeaderTemplate & gt; & Lt; Asp: Label ID = "statusTitleLbl" runat = "server" text = "status" /> & Lt; / HeaderTemplate & gt; & Lt; ItemTemplate & gt; & Lt; Asp: Label ID = "statusLbl" runat = "server" CssClass = "linkBtn_Type" meta: resourceKey = "statusLblResource" /> & Lt; / ItemTemplate & gt; & Lt; / ASP: TemplateField & gt; & Lt; / Column & gt; & Lt; / ASP: GridView & gt; & Lt; / ContentTemplate & gt; & Lt; / ASP: UpdatePanel & gt; & Lt; / Div & gt;   

How can this be done where it does not refresh the whole page?

UpdatePanels a partial postback, but that's still page life cycle, which is the removal of state Due to the causes goes through. You can check things like the item selection (check boxes, rows, etc.), but you will most likely spend a lot of time creating this and getting it to handle will be a nightmare.

To actually avoid page lifecycle and the user experience that you're describing, then use client-side solutions, such as plain JavaScript, Nokautjes, backbone or Angulejs. In these ways your page will be left after sending / retrieving data on the server alone.

No comments:

Post a Comment