473,545 Members | 2,092 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6604
your template should implement IPostBackEventH ander. you can raise the
event.

-- bruce (sqlwork.com)
"Ben Schumacher" <bs*********@na vegate.comwrote in message
news:uq******** *****@TK2MSFTNG P05.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*********@na vegate.comwrote in message
news:uq******** *****@TK2MSFTNG P05.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 GridViewTemplat e

Inherits Page

Implements ITemplate

Dim templateType As DataControlRowT ype

Dim controlid1 As String

Sub New(ByVal type As DataControlRowT ype, ByVal id1 As String)

templateType = type

controlid1 = id1

End Sub

Public Sub InstantiateIn(B yVal container As System.Web.UI.C ontrol) Implements ITemplate.Insta ntiateIn

Select Case templateType

Case DataControlRowT ype.DataRow

Dim oCheckBox As New CheckBox

oCheckBox.ID = controlid1

oCheckBox.AutoP ostBack = True

container.Contr ols.Add(oCheckB ox)

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 GridViewTemplat e(DataControlRo wType.DataRow, "chkSelect" )

End With

GridControl.Col umns.Add(oTempl ateField)
So, how do i raise the event (checkchanged) from within my GridViewTemplat e Class and then hadle that even from within the page that contains the GridControl.

Thanks so much!

"bruce barker (sqlwork.com)" <b_************ *************@s qlwork.comwrote in message news:ex******** ******@TK2MSFTN GP04.phx.gbl...
your template should implement IPostBackEventH ander. you can raise the
event.

-- bruce (sqlwork.com)
"Ben Schumacher" <bs*********@na vegate.comwrote in message
news:uq******** *****@TK2MSFTNG P05.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****@aspalli ance.comwrote in message
news:uZ******** ******@TK2MSFTN GP03.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*********@na vegate.comwrote in message
news:uq******** *****@TK2MSFTNG P05.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*********@na vegate.comwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
Is there any chance you could convert your blog example to VB.Net?

Thanks so much,

Ben


"Teemu Keiski" <jo****@aspalli ance.comwrote in message
news:uZ******** ******@TK2MSFTN GP03.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*********@na vegate.comwrote in message
news:uq******* ******@TK2MSFTN GP05.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
364
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 ) doesn't seem to force a postback. I've put this in OnInit, OnPreRender, OnLoad... nothing. Currently I'm trying this:
0
1189
by: cosine... zero | last post by:
<select id="ZoneID" Multiple=False DataSource=<%# UserList.DataSource.Tables("Zones") %> DataTextField="NewsZoneText" DataValueField="NewsZoneID" value=<%# Container.DataItem("NewsZoneID") %> runat=server /> NewsZoneID -is- an integer, but even a ToString() on the dataitem does not set the value.
0
270
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; public ITemplate HeadingStyle {
0
1707
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 follows, TemplateColumn tc = new TemplateColumn(); ITemplate iTemplate = LoadTemplate("DropDownList_Countries.ascx"); tc.EditItemTemplate =...
2
4685
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
1547
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 SmallProductViewTemplate : ITemplate { public void InstantiateIn(Control container) { HyperLink productImage = new HyperLink();
0
1275
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 assigning it to datalist by creating web server control template dynamilly. My problem is as no of field return very .how can I change...
2
4910
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:// www.developerfusion.co.uk/show/4721). TIA for any ideas. Regards DC
1
1499
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 Footer. Here is example of my Content property 1 <Browsable(False), Description("The template property"),...
0
7473
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7408
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...
0
7763
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 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...
0
5976
agi2029
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...
0
3458
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...
0
3444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1891
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1020
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
712
bsmnconsultancy
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...

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.