why does the detailsview not get the focus?

B

bob

Hi,


When running this code, the detailsview doesn't get the focus.
The fields of the detailsview are programmatically created. I use therefore
the dtreader.FieldCount.

What's wrong with this code?
Thanks for helping.
Bob


Here part of the code:

in aspx file:
---------
....
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="Provider = Microsoft.Jet.OLEDB.4.0; Data Source =
c:mytable"> </asp:SqlDataSource>
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
CellPadding="4" DataSourceID="SqlDataSource1" DefaultMode="Insert">
<Fields>
<asp:CommandField ShowInsertButton="True" InsertText="Bewaren"
CancelText="Opnieuw"/>
</Fields>
</asp:DetailsView>

in aspx.vb file:
-------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
.....
sql = "select * from mytable;"
comd = New OleDbCommand(sql, oConnection)
dtreader = comd.ExecuteReader
nfield = dtreader.FieldCount
Dim bf(nfield) As BoundField
For i = 1 To nfield
bf(i) = New BoundField
bf(i).DataField = "fld" & i
DetailsView1.Fields.Add(bf(i))
Next
dtreader.Close()
.....

end sub

Protected Sub DetailsView1_ItemCreated(ByVal sender As Object, ByVal e As
System.EventArgs) Handles DetailsView1.ItemCreated
DetailsView1.Focus()
End Sub
 

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

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top