Hi All,
I've dynmaically created a textbox, but I can't edit it. When I click on
it, the cursor flashes for a second, but then goes away and I can't enter any
text or do anything with the value in the box.
Here's the code I've used to create the control. It's within a datagrid
that is bound to a dataTable so the action happens in the ItemDataBound event.
Private Sub dgItems_ItemDat aBound(ByVal sender As Object, ByVal e As
System.Web.UI.W ebControls.Data GridItemEventAr gs) Handles dgItems.ItemDat aBound
If e.Item.ItemType = ListItemType.It em Or e.Item.ItemType =
ListItemType.Al ternatingItem Then
Dim dtItems As New DataTable
dtItems = CType(Session(" ItemsDT"), DataTable)
'this is what I can't edit
Dim txtQty As New TextBox
Page.Controls.A dd(txtQty)
e.Item.Cells(0) .Controls.Add(t xtQty)
txtQty.ID = "txtQty" & e.Item.ItemInde x
txtQty.EnableVi ewState = True
txtQty.Text = dtItems.Rows(e. Item.DataSetInd ex)(0)
txtQty.Width = WebControls.Uni t.Pixel(30)
Dim lblDesc As New Label
lblDesc.EnableV iewState = True
lblDesc.Text = dtItems.Rows(e. Item.DataSetInd ex)(1)
e.Item.Cells(1) .Controls.Add(l blDesc)
Dim lblUnitPrice As New Label
lblUnitPrice.En ableViewState = True
lblUnitPrice.Te xt = dtItems.Rows(e. Item.DataSetInd ex)(2)
e.Item.Cells(2) .Controls.Add(l blUnitPrice)
End If
End Sub
Thanks. 2 1879
I figured out what was causing it. In the body tag of the page it had
onblur="self.fo cus();".
So, now I can edit the textbox, but as per my directive from above, the page
is a popup window and needs to stay on top and that's the code that was doing
that.
Can anyone think of any alternative ways of making that happen?
"mwhalen" wrote: Hi All,
I've dynmaically created a textbox, but I can't edit it. When I click on it, the cursor flashes for a second, but then goes away and I can't enter any text or do anything with the value in the box.
Here's the code I've used to create the control. It's within a datagrid that is bound to a dataTable so the action happens in the ItemDataBound event.
Private Sub dgItems_ItemDat aBound(ByVal sender As Object, ByVal e As System.Web.UI.W ebControls.Data GridItemEventAr gs) Handles dgItems.ItemDat aBound If e.Item.ItemType = ListItemType.It em Or e.Item.ItemType = ListItemType.Al ternatingItem Then Dim dtItems As New DataTable dtItems = CType(Session(" ItemsDT"), DataTable)
'this is what I can't edit Dim txtQty As New TextBox Page.Controls.A dd(txtQty) e.Item.Cells(0) .Controls.Add(t xtQty) txtQty.ID = "txtQty" & e.Item.ItemInde x txtQty.EnableVi ewState = True txtQty.Text = dtItems.Rows(e. Item.DataSetInd ex)(0) txtQty.Width = WebControls.Uni t.Pixel(30)
Dim lblDesc As New Label lblDesc.EnableV iewState = True lblDesc.Text = dtItems.Rows(e. Item.DataSetInd ex)(1) e.Item.Cells(1) .Controls.Add(l blDesc)
Dim lblUnitPrice As New Label lblUnitPrice.En ableViewState = True lblUnitPrice.Te xt = dtItems.Rows(e. Item.DataSetInd ex)(2) e.Item.Cells(2) .Controls.Add(l blUnitPrice)
End If End Sub
Thanks.
I believe there is a way in javascript to open a new window as a modal
dialog, meaning that you can't push it behind the parent window or interact
with the parent window until the dialog is closed.
"mwhalen" <mw*****@discus sions.microsoft .com> wrote in message
news:D0******** *************** ***********@mic rosoft.com... I figured out what was causing it. In the body tag of the page it had onblur="self.fo cus();".
So, now I can edit the textbox, but as per my directive from above, the
page is a popup window and needs to stay on top and that's the code that was
doing that.
Can anyone think of any alternative ways of making that happen?
"mwhalen" wrote:
Hi All,
I've dynmaically created a textbox, but I can't edit it. When I click
on it, the cursor flashes for a second, but then goes away and I can't
enter any text or do anything with the value in the box.
Here's the code I've used to create the control. It's within a datagrid that is bound to a dataTable so the action happens in the ItemDataBound
event. Private Sub dgItems_ItemDat aBound(ByVal sender As Object, ByVal e As System.Web.UI.W ebControls.Data GridItemEventAr gs) Handles
dgItems.ItemDat aBound If e.Item.ItemType = ListItemType.It em Or e.Item.ItemType = ListItemType.Al ternatingItem Then Dim dtItems As New DataTable dtItems = CType(Session(" ItemsDT"), DataTable)
'this is what I can't edit Dim txtQty As New TextBox Page.Controls.A dd(txtQty) e.Item.Cells(0) .Controls.Add(t xtQty) txtQty.ID = "txtQty" & e.Item.ItemInde x txtQty.EnableVi ewState = True txtQty.Text = dtItems.Rows(e. Item.DataSetInd ex)(0) txtQty.Width = WebControls.Uni t.Pixel(30)
Dim lblDesc As New Label lblDesc.EnableV iewState = True lblDesc.Text = dtItems.Rows(e. Item.DataSetInd ex)(1) e.Item.Cells(1) .Controls.Add(l blDesc)
Dim lblUnitPrice As New Label lblUnitPrice.En ableViewState = True lblUnitPrice.Te xt = dtItems.Rows(e. Item.DataSetInd ex)(2) e.Item.Cells(2) .Controls.Add(l blUnitPrice)
End If End Sub
Thanks. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bhavin |
last post by:
Anybody quickly replies it, would be a great help!
I try to create dynamic array of textboxes control in ASP.NET(C#). I got the
following error while I tried to assign value to ID property of dynamically
created textbox. (look at my code please )
Error: “ Object reference is not set to an instance of Object”
totalRows – int variable which varies with number of records in SQL table
|
by: Mike |
last post by:
Hi,
I am having problems with my program, the problem is it will not put
the datagrid into edit mode.
The .aspx page has the following code in it : -
<asp:datagrid id="DataGrid2" runat="server"
OnEditCommand="DEDR_Edit2"></asp:datagrid>
|
by: doronb |
last post by:
hello
my question is :
i define dynamic columns to datagrid , 4 columns are databound and 1
columne is "edit template column" and only this col editable ,
i define function for update when pressing on button the datagrid not
define
and body of function recognize the object i think is becuase view
state
but i don't know how to solv it
|
by: dx |
last post by:
I'm extremely frustrated with ASP.NET...again! To me this should be as
simple as setting oCheckBox.Checked = True.. yet for some reason it isn't.
I have a user control (ascx) that that has a checkbox and I can't get it to
default to checked. I tried radiobuttons and experienced the same result..
can't start them as checked. The really frustrating thing is that I set the
attributes of other input controls in the Init() with no problem.
...
|
by: Kum |
last post by:
Hi,
I need help in asp.net dynamic textbox controls
validation.
I am creating textbox controls dynamically on a
asp.net webpage. Now after creating the textboxes on
the page I want to validate these text boxes when the
user submits or posts back to the server. My intention
was to create a textboxvalidator function which takes
the control name as argument and returns an true if
| |
by: mef526 |
last post by:
I would like to reference a dynamically created control and I know the name.
I would like to use the following:
Dim strName as String = "txtControl1"
' This is the ".Name" used when textbox was dynamically created
dim c as control = me.Controls(strName)
Instead I have to do this:
|
by: BillE |
last post by:
I need to create a multi-line label dynamically.
Since labels aren't multi-line, I'm creating a textbox and making it look
like a label with the multiline property set to true.
I want to increase the height of the textbox only if there are multiple
lines, and leave it at the default height if the text does not wrap after
setting the Text property.
I thought I could use the Lines property after setting the Text property,
|
by: Radu |
last post by:
Hi. I have a page with the following html:
__________________________________________________________
<h1>Dynamic Controls Test</h1>
<hr />
<asp:TextBox ID="txtProduct1" Text="txtProduct 1" runat="server"></
asp:TextBox>
<asp:Button ID="cmdAddRow" Text="+" AccessKey="+" runat="server" />
<asp:Button ID="cmdSubtractRow" Text="-" AccessKey="+" runat="server" /
<asp:PlaceHolder runat="server" id="placeTextBoxes" />
|
by: raghulvarma |
last post by:
I have created only one object for the textbox and that particular textbox is being repeated as many times I want.But if I want to add the values in the database from each and every textbox which have been dynamically created how should I do that? I have uesd dropdown box to get the number of textboxes to be displayed and used panel to display them.
Let me explain with my real time scenario , if customer-A has 2 telephone lines and...
|
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: 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...
|
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: 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...
|
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...
|
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: 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...
| |