473,320 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

why does the detailsview not get the focus?

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
Oct 18 '06 #1
0 1035

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Shawn Wildermuth | last post by:
I have a *single* SqlDataSource that loads up a single result set that I show in a GridView. In the GridView, i've added a "Select" button and handling the SelectedItem event. I also have a...
12
by: Jim Hammond | last post by:
I am passing the whole object instead or parameters in my select and update methods. I can get the updated object if I set UpdateMethod, let ASP.NET autogenerate an update button, and then press...
1
by: sck10 | last post by:
Hello, I am trying to change a value when a user goes into edit mode on a DetailsView control. I am trying to use the following, but can not figure out how to get to the bound field...
2
by: André | last post by:
Hi, I made a detailsview containing several fields for inserting only. I also made a dropdownlist which is invisible at start. Now, when clicking in a particular textbox, the dropdownlist must...
0
by: André | last post by:
Hi, I want I defined a detailsview connected to a datasource. The purpose is: when an user clicks into a particular field (when the focus is on that field), something must happen.My problem is:...
0
by: dave | last post by:
Hi, I have to know when the focus is on a specific field in a detailsview. Any way to do this? Thanks Dave
0
by: mike | last post by:
Hi, When I programatically Bind a DataSource to DetailsView it does not fire "ModeChanged" event. This is first time i am trying to use ASP.NET DetailsView control. I have played with some of the...
1
by: needin4mation | last post by:
Not sure what I'm doing wrong here. I have a gridview and a detailsview. The detailsview is set to insert by default. When I insert data the detailsview it works. The data goes in the database....
5
by: =?Utf-8?B?bXBhaW5l?= | last post by:
Hello, I am completely lost as to why I can't update a DropDownList inside a DetailsView after I perform an insert into an object datasource. I tried to simply it down to the core demostration:...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.