Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>One approach is to allow the updates in a more Ajaxy way, as Aristos discusses. This is typically considered a more user friendly approach and will certainly offer a nicer user experience, but requires familiarity with jQuery and JavaScript and the interactions between the client and the server are a little more complex from your perspective.</p> <p>If you want to continue to use the Web control paradigm, consider making the "Arrives At" and "Leaves At" fields TemplateFields. In the ItemTemplate you could continue to display the text you concatenate at the database, but you'd put a GridView in the EditItemTemplate. This GridView could be bound to a data source control (also in the EditItemTemplate) and configured to support editing. If you are programmatically binding data (i.e., you are <em>not</em> using a data source control) then you'll need to bind the data to the child GridView whenever the parent row becomes editable. This can be done declaratively using markup like so:</p> <pre><code>&lt;asp:TemplateField ...&gt; &lt;EditItemTemplate&gt; &lt;asp:GridView runat="server" id="gvChild" DataSource='&lt;%# SomeFunction() %&gt;' ...&gt; ... &lt;/asp:GridView&gt; &lt;/EditItemTemplate&gt; &lt;/asp:TemplateField&gt; </code></pre> <p>Here, <code>SomeFunction</code> would be a function in your code-behind class (typically) that returns the data to bind to the grid.</p> <p>Alternatively, you could bind the data to the child GridView programmatically via the parent GridView's <code>RowDataBound</code> event handler. Namely, you would check to see if you are dealing with the row being edited (that is, if <code>e.Row.RowIndex = ParentGridViewID.EditIndex</code>). If so, you could programmatically reference the child GridView using <code>e.Row.FindControl("ChildGridViewID")</code> and then set its <code>DataSource</code> property and call its <code>DataBind</code> method.</p> <p>When a users clicks the Edit button for the parent grid the "Arrive At" and "Leave At" cells will show as a grid with Edit buttons of their own to modify the individual times. Alternatively, you could put the child editable GridView in the ItemTemplate if you wanted to let the users edit the "Arrive At" and "Leave At" times without requiring the user to first choose to edit the parent record.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload