473,779 Members | 2,001 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help needed - nested detailsview referencing

1 New Member
Hi,

I have a page which is basically a details view(in inset mode) inside a datalist.
The problem is I want to set the field "invoiceID" (of the detailsview) to an invoiceID coming through the query string of the page.

Now, I have sucessfully done this with a detailsview that is not enclosed in a datalist, using the following page load script:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArg s) Handles Me.Load

Dim Invoiceid As TextBox = CType(DetailsVi ew1.FindControl ("Invoiceid" ), TextBox)
Invoiceid.Text = Request.QuerySt ring("Invoiceid ")
End Sub



however when I enclosed the detailsview in a datalist, it suddenly stopped working,

The first error I get is

Compiler Error Message: BC30451: Name 'DetailsView1' is not declared.

Line 9: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArg s) Handles Me.Load
Line 10:
Line 11: Dim Invoiceid As TextBox = CType(DetailsVi ew1.FindControl ("Invoiceid" ), TextBox)
Line 12: Invoiceid.Text = Request.QuerySt ring("Invoiceid ")
Line 13: End Sub



My code is below:



<asp:DataList ID="DataList1" runat="server" DataKeyField="T estID" DataSourceID="O bjectDataSource 2"
Style="z-index: 120; left: 32px; position: absolute; top: 162px">
<ItemTemplate >

<asp:GridView ID="GridView1" runat="server" AutoGenerateCol umns="False" DataKeyNames="T estID"
DataSourceID="O bjectDataSource 1" Style="position : static">
<Columns>
<asp:CommandFie ld ShowDeleteButto n="True" />
<asp:BoundFie ld DataField="Test ID" HeaderText="Tes tID" InsertVisible=" False" ReadOnly="True"
SortExpression= "TestID" />
<asp:BoundFie ld DataField="Invo iceID" HeaderText="Inv oiceID" SortExpression= "InvoiceID" />
<asp:BoundFie ld DataField="Firs tName" HeaderText="Fir stName" SortExpression= "FirstName" />
<asp:BoundFie ld DataField="Surn ame" HeaderText="Sur name" SortExpression= "Surname" />
</Columns>
</asp:GridView>

<asp:ObjectData Source ID="ObjectDataS ource1" runat="server" DeleteMethod="D elete"
InsertMethod="I nsert" OldValuesParame terFormatString ="original_{ 0}" SelectMethod="G etData"
TypeName="DataS et1TableAdapter s.TestTableAdap ter" UpdateMethod="U pdate">
<DeleteParamete rs>
<asp:Paramete r Name="Original_ TestID" Type="Int32" />
</DeleteParameter s>
<UpdateParamete rs>
<asp:Paramete r Name="InvoiceID " Type="Int32" />
<asp:Paramete r Name="FirstName " Type="String" />
<asp:Paramete r Name="Surname" Type="String" />
<asp:Paramete r Name="Original_ TestID" Type="Int32" />
<asp:Paramete r Name="TestID" Type="Int32" />
</UpdateParameter s>
<SelectParamete rs>
<asp:QueryStrin gParameter DefaultValue="1 " Name="InvoiceID " QueryStringFiel d="InvoiceID"
Type="Int32" />
</SelectParameter s>
<InsertParamete rs>
<asp:Paramete r Name="InvoiceID " Type="Int32" />
<asp:Paramete r Name="FirstName " Type="String" />
<asp:Paramete r Name="Surname" Type="String" />
</InsertParameter s>
</asp:ObjectDataS ource>

<asp:DetailsVie w ID="DetailsView 1" runat="server" AutoGenerateRow s="False" DataKeyNames="T estID"
DataSourceID="O bjectDataSource 1" Height="50px" Style="position : static" Width="125px" DefaultMode="In sert">
<Fields>
<asp:BoundFie ld DataField="Test ID" HeaderText="Tes tID" InsertVisible=" False" ReadOnly="True" SortExpression= "TestID" />
<asp:CommandFie ld ShowInsertButto n="True" />

<asp:TemplateFi eld >
<InsertItemTemp late>
<asp:TextBox ID="InvoiceID" runat="server" Text='<%# Bind("InvoiceID ") %>' Visible="false" ></asp:TextBox>
<asp:TextBox ID="FirstName" runat="server" Text='<%# Bind("FirstName ") %>'></asp:TextBox>
<asp:TextBox ID="Surname" runat="server" Text='<%# Bind("Surname") %>'></asp:TextBox>
</InsertItemTempl ate>
</asp:TemplateFie ld>

</Fields>
</asp:DetailsView >


</ItemTemplate>
</asp:DataList>


<asp:ObjectData Source ID="ObjectDataS ource2" runat="server" DeleteMethod="D elete"
InsertMethod="I nsert" OldValuesParame terFormatString ="original_{ 0}" SelectMethod="G etData"
TypeName="DataS et1TableAdapter s.TestTableAdap ter" UpdateMethod="U pdate">
<DeleteParamete rs>
<asp:Paramete r Name="Original_ TestID" Type="Int32" />
</DeleteParameter s>
<UpdateParamete rs>
<asp:Paramete r Name="InvoiceID " Type="Int32" />
<asp:Paramete r Name="FirstName " Type="String" />
<asp:Paramete r Name="Surname" Type="String" />
<asp:Paramete r Name="Original_ TestID" Type="Int32" />
<asp:Paramete r Name="TestID" Type="Int32" />
</UpdateParameter s>
<SelectParamete rs>
<asp:QueryStrin gParameter DefaultValue="1 " Name="InvoiceID " QueryStringFiel d="InvoiceID"
Type="Int32" />
</SelectParameter s>
<InsertParamete rs>
<asp:Paramete r Name="InvoiceID " Type="Int32" />
<asp:Paramete r Name="FirstName " Type="String" />
<asp:Paramete r Name="Surname" Type="String" />
</InsertParameter s>
</asp:ObjectDataS ource>


Can anyone tell me how to reference the Invoice ID textbox in the detailsview, and then set it to a request.queryst ring value?

thanks
Mar 16 '07 #1
0 1359

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

Similar topics

2
4706
by: berthelot samuel | last post by:
Hi everyone, I am currently trying to write a report based on a View of SQL Server. Basically, I have 3 tables : Hardware, SoftwareInstalled and Software with SoftwareInstalled that keeps track of all the software installed on each piece of hardware by referencing the primary keys of each table. So now, I have a request that retrieve information from those 3 tables giving a list of all the hardware with their details + the software...
12
8705
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 update after making changes, but I don't want that update button. How can I get the updated object when the user presses one of my other action buttons?
7
1928
by: ÀÏÆÅ»³ÔÐ5¸öÔ | last post by:
I want use dropdownlist contral in gridview but have trouble now mycode here: i'm very sorry for my poor english <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
8
1685
by: rh0dium | last post by:
Hi all, I am using python to drive another tool using pexpect. The values which I get back I would like to automatically put into a list if there is more than one return value. They provide me a way to see that the data is in set by parenthesising it. This is all generated as I said using pexpect - Here is how I use it.. child = pexpect.spawn( _buildCadenceExe(), timeout=timeout) child.sendline("somefunction()")
3
19345
by: Martin | last post by:
Hi, I have a very frustrating problem that I have researched for countless hours to no avail. There are many posts asking very similar things, however none usefull in my situation. I am using VS 2005 (ASP 2.0) and VB .NET. I have a page with a datalist, a gridview and then other data controls, nested in that order. This all works great, and produces a nice looking page, but I cannot for the life of me figure out how to reference
4
6316
by: jens Jensen | last post by:
Hello, I have an image file name in a table that a let users modify via a GridView/DetailView pair. * The actual image file is saved in the image folder of the application. But the image is rendered in a templatefield 's <itemtemplate> on the detailsview. In the <edititemtemplate> i have a fileupload control . leting users upload a new picture and thus replace the old one.
0
1686
by: K B | last post by:
I finally figured out how to use the Calendar Control in DetailsView edit, HOWEVER, it's awkward having the control show. My users are used to having an image to click on then bring up a pop-up Calendar Control to populate the textbox with the date. I tried the old way but couldn't get the calendar click return to function...probably not referencing the control correctly. Is there any way to hide the calendar until the user clicks on...
1
2203
by: Not Me | last post by:
Hi, I've been trying different ways of getting an insert button within a detailsview control to be the default button when the return key is pressed. Using a panel and itemtemplates I get the exception "{"The DefaultButton of '' must be the ID of a control of type IButtonControl."} - why it thinks I'm referencing ''? Is it a scope issue because the button is within the itemtemplate?
0
1190
geo039
by: geo039 | last post by:
I have add functionality in my gridview footer and a detailsview in the emptydatatemplate. I need to write the same code I have for gridview_rowcommand but i'm not sure how to reference it. Basically how do i say this for a detailsview Protected Sub gridLocations_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs) If e.CommandName = "Insert" AndAlso Page.IsValid Then ' Insert new record Dim roomnum As String =...
0
9471
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
10302
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
10136
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
10071
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
8958
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7478
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6723
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5372
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
5501
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.