473,796 Members | 2,875 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

can SqlDataSource give "new index" on insert?

BeemerBiker
87 New Member
I was wondering if a command like "SqlDataSource1 .insert()" can somehow give me the new index that was created when the insert took place. If the insert always occurs at the end of the dataset then I assume something like "...Count" could be used to figure out where the insert is going to take place. I am not sure if there is a "Count" in SqlDataSource. Unfortunately, I didnt see a callback for something like "ItemInsert ed" which would give me the index. I did set some breakpoints and poke around to find an index but gave up.

SqlDataSource.I nsert() just returns the number of rows inserted which is just 1 unless something goes wrong.

Anyway, what I want to do is to set DetailView1.Pag eIndex to that new index number so I can then use the DetailView display to help create a new record in my GridView.

This whole exercise is caused by the lack of a "new row" in gridview. Does dotnet 3.5 or the new ajax have any mechanism for a gridview "new row"?

I am using this as a guide to handleing the "new row" problem in my gridview. The scheme works fine if there is no paging. If there is pageing you have to hunt for where the new empty row is. I thought I would switch to a DetailView the instant "new" was selected and set the index page of the DetailView to the "new index" Since DetailView1 has an update and cancel button then I can use that to add my new row into the gridview.

Maybe someone can suggest a better way to add a new row. I have several grids and wanted to come up with a common scheme to handle all of them. Previously I hand coded forms for each new grid row.

I am also trying to avoid using stored procedures though I know it is possible to have the new index returned. Just was hoping to do all this in code

thanks for looking
Apr 8 '09 #1
0 1676

Sign in to post your reply or Sign up for a free account.

Similar topics

5
2259
by: Serge Rielau | last post by:
Contains a major blurp on SELECT FROM INSERT and some other hopefully useful tricks. http://www-106.ibm.com/developerworks/db2/library/techarticle/dm-0411rielau/ Enjoy Serge
1
3148
by: Giorgio | last post by:
Hi, I have a dropdown menu with categories and when a category is selected the Gridview is binded with sub-categories. Then when a sub-category is selected a detailsview is displayed side-by-side to the gridview and then I can click on "new" and isert a new subcategory or edit and update the sub-category. My problem is that when a category doesn't have any sub-categories then the Gridview is not displayed therefore there's no way I can...
1
3891
by: scartin | last post by:
I'm fairly new to working with ASP web controls, and am running into what seems to be a ridiculous problem that I'm hoping will be a breeze for an experienced ASP developer. I have a GridView and a FormView on the same page, where the GridView is visible at page load, and the FormView is set to Edit mode by default, but is hidden on the page. I have the Select link enabled on my GridView, and I use the SelectedIndexChanged event to hide...
2
1316
by: Gabriele *darkbard* Farina | last post by:
Hi, I'm using Python 2.5 to develop a simple MVC framework based on mod_python. To load my controllers, I create new modules using the "new" module like this: # .... my_module = new.module("random_name") my_module.__file__ = module_path
122
5539
by: C.L. | last post by:
I was looking for a function or method that would return the index to the first matching element in a list. Coming from a C++ STL background, I thought it might be called "find". My first stop was the Sequence Types page of the Library Reference (http://docs.python.org/lib/typesseq.html); it wasn't there. A search of the Library Reference's index seemed to confirm that the function did not exist. A little later I realized it might be called...
43
2404
by: Bill H | last post by:
25 years ago every computer came with some form of Basic interpreter so you could use yoru computer without having to buy more software. Is Javascript (teamed with HTML) set to become the new Basic, where anyone with a computer can start writing code without having to purchase any expensive languages? Bill H
5
7369
by: Pseudonyme | last post by:
Dear All : Ever had an httpd error_log bigger than the httpd access log ? We are using Linux-Apache-Fedora-Httpd 2006 configuration. The PHP lines code that lead too tons of errors are : $http_ref= $HTTP_REFERER; $prog = $_COOKIE;
0
1311
by: jonceramic | last post by:
Hi All, My apologies for asking something that I'm sure has been answered for. But, my google searching can't find a proper set of keywords. I would like to add "New..." or "other..." or "Show All" to my combo boxes. I'm tired of having to put buttons beside them for "special options".
1
2190
BeemerBiker
by: BeemerBiker | last post by:
Using GridView and SqlDataSource I found that an index field defaults to "ReadOnly=True" and I have to change it to False and then hide it before my sql UPDATE command works. This seems awkward and I was wondering if there was a better way of getting a GridView to work with MS SQL. GridView1: -SelectCommand = "SELECT * FROM xxx" -UpdateCommand="UPDATE xxx SET yyy WHERE =@index; The SELECT gets "index". If I explicitly code the select so...
0
9679
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9527
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10453
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10223
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10172
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5441
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5573
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.