Hi all
Pls give me some insight as to what I should be doing.
I have a form where I have 20 text boxes and when an user submits the form I
save it to a database. When they want to retrieve it, I loop and create the
textboxes with ID and text value and then add to the form. The problem is
when trying to create the control in the code behind page I get the error
"Multiple controls with the same ID 'txtQLLink1' were found".
How do I retrieve the data and display it in the text boxes in the form?
Thanks
V 3 2381
Hi Varad, "Multiple controls with the same ID 'txtQLLink1' were found".
This means that you were not able to assign unique IDs to controls in your
page. Check whether the loop in which you are re-creating the controls, you
are also incrementing the index value for the control. This will ensure that
they get unique names like txtQLLink1, txtQLLink2, txtQLLink3 ...
If this is working fine, then you must be having some other textbox with the
same ID.
HTH,
Need any help, do post a msg back..
Happy Coding
"Varad" wrote:
Hi all Pls give me some insight as to what I should be doing. I have a form where I have 20 text boxes and when an user submits the form I save it to a database. When they want to retrieve it, I loop and create the textboxes with ID and text value and then add to the form. The problem is when trying to create the control in the code behind page I get the error "Multiple controls with the same ID 'txtQLLink1' were found". How do I retrieve the data and display it in the text boxes in the form?
Thanks V
Hi Vishnu
Thanks for responding. I have controls already named txtQlLink1, txtQLLink2
etc in the .aspx form. I created those controls by dragging and dropping them
on to the form first. Now, I'm trying to reload the page with values
retrieved from the database but doing it in a loop instead of having to do it
for each control.
This is the code that is used to set the code to the text conrols:
For Each arrValueQL As String In arrQC
qlCount = qlCount + 1
If arrValueQL <> "" Then
If (qlCount Mod 2) = 1 Then
Dim txtQLLink As New TextBox
txtQLLink.ID = "txtQLLink" & i.ToString
txtQLLink.Text = arrValueQL
Me.FindControl( "Form1").Contro ls.Add(txtQLLin k)
ElseIf (qlCount Mod 2) = 0 Then
Dim txtQLUrl As New TextBox
txtQLUrl.ID = "txtQLUrl" & i.ToString
txtQLUrl.Text = arrValueQL
Me.FindControl( "Form1").Contro ls.Add(txtQLUrl )
i = i + 1
End If
End If
Next
"Vishnu-Chivukula" wrote: Hi Varad,
"Multiple controls with the same ID 'txtQLLink1' were found". This means that you were not able to assign unique IDs to controls in your page. Check whether the loop in which you are re-creating the controls, you are also incrementing the index value for the control. This will ensure that they get unique names like txtQLLink1, txtQLLink2, txtQLLink3 ...
If this is working fine, then you must be having some other textbox with the same ID.
HTH,
Need any help, do post a msg back..
Happy Coding
"Varad" wrote:
Hi all Pls give me some insight as to what I should be doing. I have a form where I have 20 text boxes and when an user submits the form I save it to a database. When they want to retrieve it, I loop and create the textboxes with ID and text value and then add to the form. The problem is when trying to create the control in the code behind page I get the error "Multiple controls with the same ID 'txtQLLink1' were found". How do I retrieve the data and display it in the text boxes in the form?
Thanks V
Hi varad!
I have not played with Vb or web development on a .net language yet... but
as far as I can see you allready have a textbox with that id.... I notice
that you are declaring new textboxes where you already have those textboxes
ids in your form. In a regular application you could access the form's
Controls property and itenerate over the allready created control... find
the controls that are textboxes and have the specific id... and just change
their properties, instead of re-declaring a whole new textbox.
I am out of my environment since i code under c# and applications... but I
just thought I would give my two cents.
"Varad" <Va***@discussi ons.microsoft.c om> wrote in message
news:B1******** *************** ***********@mic rosoft.com... Hi Vishnu Thanks for responding. I have controls already named txtQlLink1, txtQLLink2 etc in the .aspx form. I created those controls by dragging and dropping them on to the form first. Now, I'm trying to reload the page with values retrieved from the database but doing it in a loop instead of having to do it for each control.
This is the code that is used to set the code to the text conrols: For Each arrValueQL As String In arrQC qlCount = qlCount + 1 If arrValueQL <> "" Then If (qlCount Mod 2) = 1 Then Dim txtQLLink As New TextBox txtQLLink.ID = "txtQLLink" & i.ToString txtQLLink.Text = arrValueQL Me.FindControl( "Form1").Contro ls.Add(txtQLLin k) ElseIf (qlCount Mod 2) = 0 Then Dim txtQLUrl As New TextBox txtQLUrl.ID = "txtQLUrl" & i.ToString txtQLUrl.Text = arrValueQL Me.FindControl( "Form1").Contro ls.Add(txtQLUrl ) i = i + 1 End If End If Next
"Vishnu-Chivukula" wrote:
Hi Varad,
> "Multiple controls with the same ID 'txtQLLink1' were found". This means that you were not able to assign unique IDs to controls in your page. Check whether the loop in which you are re-creating the controls, you are also incrementing the index value for the control. This will ensure that they get unique names like txtQLLink1, txtQLLink2, txtQLLink3 ...
If this is working fine, then you must be having some other textbox with the same ID.
HTH,
Need any help, do post a msg back..
Happy Coding
"Varad" wrote:
> Hi all > Pls give me some insight as to what I should be doing. > I have a form where I have 20 text boxes and when an user submits the > form I > save it to a database. When they want to retrieve it, I loop and create > the > textboxes with ID and text value and then add to the form. The problem > is > when trying to create the control in the code behind page I get the > error > "Multiple controls with the same ID 'txtQLLink1' were found". > How do I retrieve the data and display it in the text boxes in the > form? > > Thanks > V This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bil Muh |
last post by:
Esteemede Developers,
I would like to Thank All of You in advance for your sincere guidances.
I am developing a software using Visual C++ .NET Standard Edition with
Windows Form (.NET) template.
Briefly
--------------------------------------------------------------------------------------------
I need to create dynamically some controls on the forms, and display these
|
by: Patrick Marti |
last post by:
Hi together
I wish to create an object at runtime in the web. I get many good tips for
how to
do before two days by using the same Subject. So I got also the following link
wich is showing exactly that what I want to do
http://www.codeproject.com/aspnet/retainingstate.asp
but, I got always an error
>>Das Steuerelement 'ControlID_0' des Typs 'TextBox' muss in einem Formtag mit runat=server positioniert werden.]
|
by: Kiyomi |
last post by:
Hello,
I create a Table1 dynamically at run time, and at the same time, I would
like to create LinkButton controls, also dynamically, and insert them into
each line in my Table1. I would then like that, when clicking the
LinkButton, the user can be navigated to another page, carrying a variable.
I would like to use server.transfer method instead of QueryString as I don't
want the carried variable to be visible for the user.
|
by: Tim T |
last post by:
Hi,
I have the need to use dynamically loaded user controls in a webform page.
I have the controls loading dynamically, and that part works fine. this is
the code used in a webform to dynamically load one of several controls:
private void btnCategory_Click(object sender, System.EventArgs e)
{
Control myControl = LoadControl(DropDownList1.SelectedItem.Text +
".ascx");
PlaceHolder1.Controls.Add(myControl);
|
by: Johnny Fugazzi |
last post by:
Good morning,
Background: I am working on a web that will display information about
companies and contacts. I would like to have a details page that displays
some basic details about the record that has been selected (works), and then
have a table with a series of "tabs" that load additional details. I am
using this approach to cut down on the number of pages needed.
The "tabs" are a series of linkbuttons that clear a panel, and...
| |
by: z f |
last post by:
hi, tough one? for me it is currently.
i have a user control that contains other controls like text boxes.
in the client i need to dynamically add the user control using DHTML.
i achive this by having the control hidden and grabbing it's innerHTML to a
new container in the HTML.
i also change controls ID suffix in order to be able to track added controls
like in old HTML.
|
by: keithb |
last post by:
I have found that I must re-create dynamically added controls on every
postback in order to find and access them programatically. The controls I am
working with are inside a GridView control. When the edit button is clicked,
a postback occurs and the control are re-created. This causes an additional
set of columns to be created in the GridView control, so that all of the
dynamically added controls exist in 2 places on the screen. How can I...
|
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,...
|
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...
|
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,...
|
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...
| |
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |