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

J

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"
OnRowEditing="interceptGridView_RowEditing">
<Columns>
<asp:BoundField DataField="InterceptID" HeaderText="ID" ReadOnly="True" />
<asp:BoundField DataField="SourceNameURL" HeaderText="URL Text" />
<asp:TemplateField HeaderText="Body Text">
<ItemTemplate>
<%# Convert.ToString(DataBinder.Eval(Container.DataItem, "BodyText"))%>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" TextMode="MultiLine" ID="bodyText" />
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Call To Action">
<ItemTemplate>
<%# Convert.ToString(DataBinder.Eval(Container.DataItem, "CallToAction"))%>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="callToAction"
runat="server" TextMode="MultiLine">
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowEditButton="True" />
<asp:CommandField ShowDeleteButton="True" />
</Columns>
</asp:GridView>


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

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,150
Members
46,697
Latest member
AugustNabo

Latest Threads

Top