Hi,
I am trying to use the FindControl method to find a HTML
Select control I have in my Datagrid. The syntax I am
using is
Dim obj As HTMLSelect
Dim str As String
obj = E.Item.FindControl("controlname")
str = obj.Value
Only thing is this gives an error saying 'object is not
set to a reference of an object', does anyone know if this
is even possible?
Thanks
Sid 4 3513
Are you using this in ItemCreated or ItemDataBound? If yes, do you check
ItemType property that the item is Item or AlternatingItem?
--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
"Sid" <an*******@discussions.microsoft.com> wrote in message
news:09****************************@phx.gbl... Hi,
I am trying to use the FindControl method to find a HTML Select control I have in my Datagrid. The syntax I am using is
Dim obj As HTMLSelect Dim str As String
obj = E.Item.FindControl("controlname") str = obj.Value
Only thing is this gives an error saying 'object is not set to a reference of an object', does anyone know if this is even possible?
Thanks
Sid
Hi, Thanks for replying, I am using this in the
EditItemTemplate and it is being used in the UpdateItem
command. -----Original Message----- Are you using this in ItemCreated or ItemDataBound? If
yes, do you checkItemType property that the item is Item or
AlternatingItem? -- Teemu Keiski MCP, Microsoft MVP (ASP.NET), AspInsiders member ASP.NET Forum Moderator, AspAlliance Columnist
"Sid" <an*******@discussions.microsoft.com> wrote in
messagenews:09****************************@phx.gbl... Hi,
I am trying to use the FindControl method to find a HTML Select control I have in my Datagrid. The syntax I am using is
Dim obj As HTMLSelect Dim str As String
obj = E.Item.FindControl("controlname") str = obj.Value
Only thing is this gives an error saying 'object is not set to a reference of an object', does anyone know if
this is even possible?
Thanks
Sid
.
Ok,
can you show an example of the declarative (aspx) syntax you have and a bit
more of the code?
--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
"Sid" <an*******@discussions.microsoft.com> wrote in message
news:00****************************@phx.gbl... Hi, Thanks for replying, I am using this in the EditItemTemplate and it is being used in the UpdateItem command.
-----Original Message----- Are you using this in ItemCreated or ItemDataBound? If yes, do you checkItemType property that the item is Item or AlternatingItem? -- Teemu Keiski MCP, Microsoft MVP (ASP.NET), AspInsiders member ASP.NET Forum Moderator, AspAlliance Columnist
"Sid" <an*******@discussions.microsoft.com> wrote in
messagenews:09****************************@phx.gbl... Hi,
I am trying to use the FindControl method to find a HTML Select control I have in my Datagrid. The syntax I am using is
Dim obj As HTMLSelect Dim str As String
obj = E.Item.FindControl("controlname") str = obj.Value
Only thing is this gives an error saying 'object is not set to a reference of an object', does anyone know if this is even possible?
Thanks
Sid
.
No problem, this is how my columns are declared in the
datagrid:
<asp:TemplateColumn HeaderText="Heading">
<ITEMTEMPLATE>
<table>
<tbody>
<tr>
<td>
<select name="ddlCountry">
<option value="Wales"
selected="selected">Wales</option>
</select>
</td>
</tr>
</tbody>
</table>
</ITEMTEMPLATE>
<EDITITEMTEMPLATE>
<table>
<tbody>
<tr>
<td>
<select name="ddlCountry">
<option value="Wales"
selected="selected">Wales</option>
</select>
</td>
</tr>
</tbody>
</table>
</EDITITEMTEMPLATE>
</asp:TemplateColumn>
And then I call this in the EditItemCommand:
sub doEdit(sender as object, e as _
Datagridcommandeventargs)
Dim obj as HTMLSelect
dim myStr as string
obj = CType(e.Item.FindControl _
("ddlCountry"), HTMLSelect)
myStr = obj.Value ##Errors here
end Sub
Hope this helps? -----Original Message----- Ok,
can you show an example of the declarative (aspx) syntax
you have and a bitmore of the code?
-- Teemu Keiski MCP, Microsoft MVP (ASP.NET), AspInsiders member ASP.NET Forum Moderator, AspAlliance Columnist
"Sid" <an*******@discussions.microsoft.com> wrote in
messagenews:00****************************@phx.gbl... Hi, Thanks for replying, I am using this in the EditItemTemplate and it is being used in the UpdateItem command.
>-----Original Message----- >Are you using this in ItemCreated or ItemDataBound? If yes, do you check >ItemType property that the item is Item or AlternatingItem? > >-- >Teemu Keiski >MCP, Microsoft MVP (ASP.NET), AspInsiders member >ASP.NET Forum Moderator, AspAlliance Columnist > >"Sid" <an*******@discussions.microsoft.com> wrote in message >news:09****************************@phx.gbl... >> Hi, >> >> I am trying to use the FindControl method to find a
HTML >> Select control I have in my Datagrid. The syntax I am >> using is >> >> Dim obj As HTMLSelect >> Dim str As String >> >> obj = E.Item.FindControl("controlname") >> str = obj.Value >> >> Only thing is this gives an error saying 'object is
not >> set to a reference of an object', does anyone know if this >> is even possible? >> >> Thanks >> >> Sid >> > > >. >
. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: George Durzi |
last post by:
cross posted in datagrid group.
Inside <columns/> in my datagrid, I have the following template column
<asp:templatecolumn HeaderText="To Be Completed By">
<itemtemplate>
<asp:Label...
|
by: Mike Speak |
last post by:
On my page_load, I am populating a Datagrid through the normal manner
(which works) before attempting to pick out the items in one column to
use in another part of my page. This is all within...
|
by: Joe |
last post by:
Hi,
Tried using the FindControl() but no luck in finidng this damn textbox
having id txtFirstName. Can someone help me with this method?
This is what I have been doing but it doesn't work,
...
|
by: BG |
last post by:
i am thinking that creating datagrid at design time will save me a lot of
time when creating programs. however, i ran into a brick wall.
i created a template column at design time. i learned...
|
by: MattB |
last post by:
I have a datagrid that has some controls (TextBoxes and DropDownLists)
that are created dynamically at runtime. I've got the generation working
ok, but now I need to see what was entered or...
|
by: Terry Olsen |
last post by:
I've got a datagrid set up to display data. I've also got an
Edit,Update,Cancel column set up to allow editing of data.
I've got a DropDownList (ID="ddl3")in the EditItemTemplate for a certain...
|
by: zambizzi |
last post by:
....I can't seem to get my hands on a control I'm loading in an editable
datagrid.
Here's my datagrid control:
<asp:datagrid
id="GLRulesGrid"
runat="server"
autogeneratecolumns="False"...
|
by: =?Utf-8?B?TWlrZSBDb2xsaW5z?= |
last post by:
I am trying to get the text of an item in a GridView, but am doing something
wrong. Can someone help me with the correct C# statement I need? Below is my
GridView and my attempt to get the control....
|
by: daniel.hedz |
last post by:
I am generating a usercontrol dynamically successfully, but when I try
to find that usercontrol I get a type mismatch. This is what I am
doing:
//Loading my usercontrol...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
|
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...
| |