473,396 Members | 1,879 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,396 software developers and data experts.

ITemplate

Ok smart guys and gals ...

I have a GridView control with a dynamically created checkbox column. The
checkbox is created using ITemplate interface. In my class that implements
the ITemplate interface I set the AutoPostBack property of the checkbox to
True. When the checkbox is clicked, I want to handle the CheckChanged event
of the checkbox on the webform (.aspx) that contains the GridView control.
I can easily use the addhandler instruction in the ITemplate interface class
to handle the CheckChanged event, but how do I bubble the event out to the
actual .aspx page that contains the gridview control????????????

I have been googling for hours. It seems no one has any idea how to do
this. I would be so incredibly grateful for any insight into my problem.

Ben
Oct 13 '06 #1
5 6596
your template should implement IPostBackEventHander. you can raise the
event.

-- bruce (sqlwork.com)
"Ben Schumacher" <bs*********@navegate.comwrote in message
news:uq*************@TK2MSFTNGP05.phx.gbl...
Ok smart guys and gals ...

I have a GridView control with a dynamically created checkbox column. The
checkbox is created using ITemplate interface. In my class that
implements the ITemplate interface I set the AutoPostBack property of the
checkbox to True. When the checkbox is clicked, I want to handle the
CheckChanged event of the checkbox on the webform (.aspx) that contains
the GridView control. I can easily use the addhandler instruction in the
ITemplate interface class to handle the CheckChanged event, but how do I
bubble the event out to the actual .aspx page that contains the gridview
control????????????

I have been googling for hours. It seems no one has any idea how to do
this. I would be so incredibly grateful for any insight into my problem.

Ben


Oct 13 '06 #2
Hi,

I replied to your question with a blog post containing some sample code

http://aspadvice.com/blogs/joteke/ar...-GridView.aspx

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

"Ben Schumacher" <bs*********@navegate.comwrote in message
news:uq*************@TK2MSFTNGP05.phx.gbl...
Ok smart guys and gals ...

I have a GridView control with a dynamically created checkbox column. The
checkbox is created using ITemplate interface. In my class that
implements the ITemplate interface I set the AutoPostBack property of the
checkbox to True. When the checkbox is clicked, I want to handle the
CheckChanged event of the checkbox on the webform (.aspx) that contains
the GridView control. I can easily use the addhandler instruction in the
ITemplate interface class to handle the CheckChanged event, but how do I
bubble the event out to the actual .aspx page that contains the gridview
control????????????

I have been googling for hours. It seems no one has any idea how to do
this. I would be so incredibly grateful for any insight into my problem.

Ben


Oct 13 '06 #3
Could you elaborate a little?

Here is what i have so far in my template class ...

Public Class GridViewTemplate

Inherits Page

Implements ITemplate

Dim templateType As DataControlRowType

Dim controlid1 As String

Sub New(ByVal type As DataControlRowType, ByVal id1 As String)

templateType = type

controlid1 = id1

End Sub

Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) Implements ITemplate.InstantiateIn

Select Case templateType

Case DataControlRowType.DataRow

Dim oCheckBox As New CheckBox

oCheckBox.ID = controlid1

oCheckBox.AutoPostBack = True

container.Controls.Add(oCheckBox)

oCheckBox = Nothing

Case Else

' Unexpected Handler ...

End Select

End Sub

End Class
Then in the page is add the checkbox column with ...

oTemplateField = New TemplateField

With oTemplateField

oTemplateField.ItemTemplate = New GridViewTemplate(DataControlRowType.DataRow, "chkSelect")

End With

GridControl.Columns.Add(oTemplateField)
So, how do i raise the event (checkchanged) from within my GridViewTemplate Class and then hadle that even from within the page that contains the GridControl.

Thanks so much!

"bruce barker (sqlwork.com)" <b_*************************@sqlwork.comwrote in message news:ex**************@TK2MSFTNGP04.phx.gbl...
your template should implement IPostBackEventHander. you can raise the
event.

-- bruce (sqlwork.com)
"Ben Schumacher" <bs*********@navegate.comwrote in message
news:uq*************@TK2MSFTNGP05.phx.gbl...
>Ok smart guys and gals ...

I have a GridView control with a dynamically created checkbox column. The
checkbox is created using ITemplate interface. In my class that
implements the ITemplate interface I set the AutoPostBack property of the
checkbox to True. When the checkbox is clicked, I want to handle the
CheckChanged event of the checkbox on the webform (.aspx) that contains
the GridView control. I can easily use the addhandler instruction in the
ITemplate interface class to handle the CheckChanged event, but how do I
bubble the event out to the actual .aspx page that contains the gridview
control????????????

I have been googling for hours. It seems no one has any idea how to do
this. I would be so incredibly grateful for any insight into my problem.

Ben

Oct 13 '06 #4
Is there any chance you could convert your blog example to VB.Net?

Thanks so much,

Ben


"Teemu Keiski" <jo****@aspalliance.comwrote in message
news:uZ**************@TK2MSFTNGP03.phx.gbl...
Hi,

I replied to your question with a blog post containing some sample code

http://aspadvice.com/blogs/joteke/ar...-GridView.aspx

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

"Ben Schumacher" <bs*********@navegate.comwrote in message
news:uq*************@TK2MSFTNGP05.phx.gbl...
>Ok smart guys and gals ...

I have a GridView control with a dynamically created checkbox column.
The checkbox is created using ITemplate interface. In my class that
implements the ITemplate interface I set the AutoPostBack property of the
checkbox to True. When the checkbox is clicked, I want to handle the
CheckChanged event of the checkbox on the webform (.aspx) that contains
the GridView control. I can easily use the addhandler instruction in the
ITemplate interface class to handle the CheckChanged event, but how do I
bubble the event out to the actual .aspx page that contains the gridview
control????????????

I have been googling for hours. It seems no one has any idea how to do
this. I would be so incredibly grateful for any insight into my problem.

Ben



Oct 13 '06 #5
You can use converter at

http://authors.aspalliance.com/aldotnet

It's just that event implementation is bit different in VB.NET (while in
v2.0 optimized event implementation also exists) so that part you need to
practise yourself.

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
"Ben Schumacher" <bs*********@navegate.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Is there any chance you could convert your blog example to VB.Net?

Thanks so much,

Ben


"Teemu Keiski" <jo****@aspalliance.comwrote in message
news:uZ**************@TK2MSFTNGP03.phx.gbl...
>Hi,

I replied to your question with a blog post containing some sample code

http://aspadvice.com/blogs/joteke/ar...-GridView.aspx

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

"Ben Schumacher" <bs*********@navegate.comwrote in message
news:uq*************@TK2MSFTNGP05.phx.gbl...
>>Ok smart guys and gals ...

I have a GridView control with a dynamically created checkbox column.
The checkbox is created using ITemplate interface. In my class that
implements the ITemplate interface I set the AutoPostBack property of
the checkbox to True. When the checkbox is clicked, I want to handle
the CheckChanged event of the checkbox on the webform (.aspx) that
contains the GridView control. I can easily use the addhandler
instruction in the ITemplate interface class to handle the CheckChanged
event, but how do I bubble the event out to the actual .aspx page that
contains the gridview control????????????

I have been googling for hours. It seems no one has any idea how to do
this. I would be so incredibly grateful for any insight into my
problem.

Ben




Oct 13 '06 #6

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

Similar topics

0
by: cosine... zero | last post by:
Hi! I've got a databound templated control that I want the itemplate class itself to be postback aware to process form data. But calling Page.RegisterRequiresPostBack( instantiatedtemplate )...
0
by: cosine... zero | last post by:
<select id="ZoneID" Multiple=False DataSource=<%# UserList.DataSource.Tables("Zones") %> DataTextField="NewsZoneText" DataValueField="NewsZoneID" value=<%# Container.DataItem("NewsZoneID") %>...
0
by: Steve Richter | last post by:
trying to understand how to support templates in server controls ... a few quick questions on the following snippet of code pulled from a server control class: ITemplate _headingStyle; ...
0
by: vicgroups | last post by:
Hello, I am adding columns to the datagrid programmatically. And I have created a countries drop down list in an ascx file. I have added the countries drop down list to the datagrid column as...
2
by: Demetri | last post by:
Umm...this wont work Public Class MyTemplat Inherits ITemplat End Clas I get an error stating that classes can only inherit from classes C# allows you to do this simpl
0
by: LaptopHeaven | last post by:
I am having some trouble. How would one load a custom UserControl fro within a class which impements the ITemplate interface. Currently I have the following: public class...
0
by: imranabdulaziz | last post by:
Hi all, I am using asp.net2.0 and C# VS2005. I am creating asp.net web server control templates Dynamically . My requirement is such that sp return very no of field( 4 or 5 or 6 …). Now I am...
2
by: DC | last post by:
Hi, I am trying to implement a simple template control (to be used as TemplateItem etc. in GridView). Does someone see why my code fails? I give up for now and try a different approach (http://...
1
by: wojski696969 | last post by:
Hi, i've made my own Custom Server Control, wich inherits from WebControl class. Inside of my control I've create three ITemplate properties wich should be used as containers for Head, Content and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
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,...
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
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
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...
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.