473,395 Members | 1,411 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

GetType DataGridLinkButton

In a DataGrid, I am using the following code in the ItemCommand event
of the DataGrid to find if there is a DataGridLinkButton in the row
which is currently in the editable mode:

Sub MyDG_ItemCommand(....)
Dim ctrl As Control
Dim baby As Control
Dim dgi As DataGridItem

For Each dgi In MyDG.Items
If (dgi.ItemType = ListItemType.EditItem) Then
For Each ctrl In dgi.Controls each ctrl will be a
TableCell
For Each baby In ctrl.Controls 'each baby will be the
Controls in each TableCell
If (baby.GetType =
GetType(System.Web.UI.WebControls.DataGridLinkButt on)) Then
Response.Write("Type: " &
baby.GetType.ToString & "<br>")
End If
Next
Next
End If
Next
End Sub

Note the If condition just above the Response.Write line. That If
condition generates this error:

Type 'System.Web.UI.WebControls.DataGridLinkButton' is not defined.

How do I overcome this error?

I want the Response.Write line to get executed if & only if the
control within a TableCell happens to be a DataGridLinkButton.

Mar 12 '07 #1
1 1527
On Mar 12, 6:44 am, r...@rediffmail.com wrote:
In a DataGrid, I am using the following code in the ItemCommand event
of the DataGrid to find if there is a DataGridLinkButton in the row
which is currently in the editable mode:

Sub MyDG_ItemCommand(....)
Dim ctrl As Control
Dim baby As Control
Dim dgi As DataGridItem

For Each dgi In MyDG.Items
If (dgi.ItemType = ListItemType.EditItem) Then
For Each ctrl In dgi.Controls each ctrl will be a
TableCell
For Each baby In ctrl.Controls 'each baby will be the
Controls in each TableCell
If (baby.GetType =
GetType(System.Web.UI.WebControls.DataGridLinkButt on)) Then
Response.Write("Type: " &
baby.GetType.ToString & "<br>")
End If
Next
Next
End If
Next
End Sub

Note the If condition just above the Response.Write line. That If
condition generates this error:

Type 'System.Web.UI.WebControls.DataGridLinkButton' is not defined.

How do I overcome this error?

I want the Response.Write line to get executed if & only if the
control within a TableCell happens to be a DataGridLinkButton.
Use GetType(LinkButton) instead

Mar 12 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: ron | last post by:
Hi, I am currently using the base class GetType() in the following way and was woundering if there was a different way of looking at types and doing a comparison for equality. Thanks Ron ...
9
by: Yan Vinogradov | last post by:
Hi, Turns out it's possible to spoof another type with Object.GetType method. If you do this: namespace N { class C { public new Type GetType() { return (String.Empty.GetType()); }
2
by: Sen Mathew via .NET 247 | last post by:
Dear all I also have problem with Datagrid Complaining'DataGridLinkButton' must be placed inside a form tag withrunat=server. But My file is an ascx file ie it is a usercontrol. I call this file...
5
by: Matthew | last post by:
I have a nice little Sub that saves data in a class "mySettings" to an XML file. I call it like so: Dim mySettings As mySettings = New mySettings mySettings.value1 = "someText" mySettings.value2...
4
by: Greg Burns | last post by:
What the difference between these two? System.Type.GetType("System.Int32") and GetType(Integer) Or more specifically, why does GetType(Integer) work, but not System.Type.GetType(Integer)?...
4
by: Howard Kaikow | last post by:
For the code below, for both appWord and gappWord, I get the error "Public member 'GetType' on type 'ApplicationClass' not found" I realize the test for appWord is superflous as the parameter...
3
by: Joe Adams | last post by:
Hi All, How can I use GetType(<GenericType>).IsAssignableFrom(<MyType>) I need to now if the <MyType> is the same type of class as the <GenericType> without having to add the generic type...
7
by: Sky | last post by:
I have been looking for a more powerful version of GetType(string) that will find the Type no matter what, and will work even if only supplied "{TypeName}", not the full "{TypeName},{AssemblyName}"...
2
by: Carlos Rodriguez | last post by:
I have the following function in C#public void Undo(IDesignerHost host) { if (!this.componentName.Equals(string.Empty) && (this.member != null)) { IContainer container1 = (IContainer)...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
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...
0
BarryA
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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...
0
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,...
0
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...
0
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...

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.