Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > why does the detailsview not get the focus?

Reply
Thread Tools

why does the detailsview not get the focus?

 
 
bob
Guest
Posts: n/a
 
      10-18-2006
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>
<aspetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
CellPadding="4" DataSourceID="SqlDataSource1" DefaultMode="Insert">
<Fields>
<asp:CommandField ShowInsertButton="True" InsertText="Bewaren"
CancelText="Opnieuw"/>
</Fields>
</aspetailsView>

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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
why does the detailsview not get the focus? bob ASP .Net 0 10-18-2006 10:58 AM
why does the detailsview not get the focus? bob ASP .Net Web Controls 0 10-18-2006 10:58 AM
DetailsView - Changing to Insert Mode (Not By Using the Insert Button In the DetailsView Control) Feege ASP .Net Web Controls 0 12-20-2005 12:28 AM



Advertisments