473,569 Members | 2,648 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Finding a SQLDatasource control within a DetailsView control

1 New Member
hi, I'm coding a social network style application for my dissertation and am having a few problems, I'm using ASP.net and VB.net

I have a button within a DetailsView control that I want to trigger an Insert for a Datasource that is also within the DetailsView

There is an OnClick event handler for the button but I'm having problems finding the datasource to trigger it the code I'm using is

Expand|Select|Wrap|Line Numbers
  1. Dim DataSource As SqlDataSource = CType(getFriendRequests.FindControl("approveFriend"), SqlDataSource)
  2.  
  3. DataSource.Update()
  4.  

"getFriendReque sts" is the name of the Details View and "approveFri end" is the name of the datasource I want to find

using the code above it can't find the datasource and returns a null error

any help would be great,

Thanks

Luke
Mar 29 '07 #1
0 991

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

Similar topics

1
18869
by: fuchs.markus | last post by:
Hello, on my page, I have a DetailsViewControl connected to a SqlDataSource. Now when I dynamically set the FilterExpression and FilterParameters - for example in a OnClick-EventHandler of a button - the DetailsView shows the filtered Data, but Deleting and Updating doesn't work anymore. The DetailsView changes to EditMode, but after clicking...
0
1016
by: Stu | last post by:
I have a GridView that pulls straight from a table. This uses SqlDataSource1. SqlDataSource2 grabs data from the same table, but only 1 row to fill a DeatilsView, this SqlDataSource2 uses a ControlParameter to get the SelectedValue from the initial GridView to isolate the 1 row. My question is this: in the DetailsView, a column of data is...
2
1581
by: stuart.d.jones | last post by:
Hi, I'm using a detailsview control with an SqlDataSource control. My Update query isn't working, and I've narrowed it down to the optimistic concurrency parameters - i.e. when I comment them out of the query, it works. What seems to be happening is that if a field is NULL when it is read in through the select statement, it's causing the...
3
6391
by: Jim Andersen | last post by:
Just to let you know, and to help any future sorry sods who gets trapped in the same black hole...... You can't just copy/move a working sql-statement into a stored procedure. Working with a sqldatasource. Conflictdetection set to compareallvalues. Oldvaluesparameterformatstring set to original_{0} tblA has 2 fields. ID and MyText. ...
3
9863
by: K B | last post by:
Hi, I've tried this several ways but get the error that the control can't be found. I have a details view with a dropdownlist in the EditItemTemplate populated and assigned the selected value in code. I need to get the selected value when the record is saved. I've tried using the following in the SqlDataSource updating event:
3
9234
by: Asaf | last post by:
Hi, I have SqlDataSource control that makes a "select count" to show how many rows there are in a Table and it is working fine on first page load. The problem is that when I am inserting a new row to the database table at the same ASPX page the rows count from the SqlDataSource remain the same. To refresh the SqlDataSource I have used his...
1
4266
by: Corey B | last post by:
I have a page with a DetailsView control and a SQLDataSource control. The SQLDataSource control is connected to an Access database. Everything works fine. Now I want to change the back end database from Access to SQL Server. So I go in to the SQLDataSource and modify it to connect to the SQL Server database. No problem. However, the...
1
3541
by: David Lozzi | last post by:
Howdy, ASP.Net 2.0 using VB on SQL 2005 This is a two fold issue. I have a DetailsView control which users can insert or edit items. Editing works great. Insert works great however I need to display the form once the user has entered the information and clicked Add.
2
5485
by: makennedy | last post by:
Hi Experts, Please help, I am a newbie to ASP.NET 2.0 may be I am doing something wrong or there may be a bug somewhere. Basically I have a TreeView Control which I have created programmatically. And I want to bind the selection of a TreeNode (which is a record) from the database) to a DetailsView which shows the datatable record for the...
0
7615
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...
1
7677
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...
0
7979
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...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3643
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2115
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
1
1223
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
940
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.