[Framework 2.0] Any examples of using a GridView in "manual" mode?


Jeff Johnson

I'm using a GridView which I am binding directly to a data source, i.e., I
am NOT using a data source control. Why not? Don't wanna. Anyways, I don't
know how to put the grid into edit mode. I have an edit-type command button,
but I don't know what to do in the RowEditing event to turn on the text
boxes in the columns that are editable.

As you might have guessed, Web development is not my specialty, so treat me
like a total n00B in this case. Here's my markup for the grid:

<asp:GridView runat="server" AutoGenerateColumns="False"
ID="interceptGridView" OnRowDeleting="interceptGridView_RowDeleting"
<asp:BoundField DataField="InterceptID" HeaderText="ID" ReadOnly="True" />
<asp:BoundField DataField="SourceNameURL" HeaderText="URL Text" />
<asp:TemplateField HeaderText="Body Text">
<%# Convert.ToString(DataBinder.Eval(Container.DataItem, "BodyText"))%>
<asp:TextBox runat="server" TextMode="MultiLine" ID="bodyText" />
<asp:TemplateField HeaderText="Call To Action">
<%# Convert.ToString(DataBinder.Eval(Container.DataItem, "CallToAction"))%>
<asp:TextBox ID="callToAction"
runat="server" TextMode="MultiLine">
<asp:CommandField ShowEditButton="True" />
<asp:CommandField ShowDeleteButton="True" />

I tried doing

interceptGridView.EditIndex = e.NewEditIndex;

in the RowEditing event, but no text boxes showed up. I also read a post
where constant data binding was a problem, so I made sure I'm not binding
the grid during a postback. Still no luck.

What kind of dumb error am I making?

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Latest member

Latest Threads