<Dim row As GridViewRow = GridView1.Rows(e.RowIndex)
<Dim txt1 As TextBox = row.FindControl("txt1")
Give me GirdViewRow is not defined. That's a .NET 3.0 control, but I'm limited to .NET 1.1 and can't upgrade.
Main Topics
Browse All TopicsHi All,
I'm using a datagrid with a bound dataview to display and edit a database. That works fine.
What I'd like to do is be able to set some default values into the editable text boxes that appear on the appropriate row when the datagrid_EditCommand fires. Simple things like having a date field default to Now() or pre-filling a field with a string value held in session. I don't want them to change the database, or even the dataset actually until the datagrid_UpdateCommand fires. Essentially, I just want to replicate manually typing into the boxes except in code.
The problem is that I can't find a way to reference the text boxes. Using a structure like e.Item.Cells(6).Controls(0
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Thanks for the help, digitalZo.
< Dim txt1 As String = CType(e.Item.Cells(1).Cont
Sorry, misread your question. For pre-filling text, you will have to make use of EditItemTemplate.
To given an example in the Source Code of the app:
<asp:TemplateColumn HeaderText="FieldName1">
<ItemTemplate>
<asp:Label ID="lblField1" runat="server" Text='<%# DataBinder.Eval(Container.
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" id="txtField1" Text='[text you want to enter]'/>
</EditItemTemplate>
</asp:TemplateColumn>
</Columns>
Business Accounts
Answer for Membership
by: digitalZoPosted on 2007-09-26 at 02:47:05ID: 19961653
Dim row As GridViewRow = GridView1.Rows(e.RowIndex)
Dim txt1 As TextBox = row.FindControl("txt1")