Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ITemplate

Reply
Thread Tools

ITemplate

 
 
Ben Schumacher
Guest
Posts: n/a
 
      10-13-2006
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


 
Reply With Quote
 
 
 
 
bruce barker \(sqlwork.com\)
Guest
Posts: n/a
 
      10-13-2006
your template should implement IPostBackEventHander. you can raise the
event.

-- bruce (sqlwork.com)


"Ben Schumacher" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
 
Teemu Keiski
Guest
Posts: n/a
 
      10-13-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
Ben Schumacher
Guest
Posts: n/a
 
      10-13-2006
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)" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> your template should implement IPostBackEventHander. you can raise the
> event.
>
> -- bruce (sqlwork.com)
>
>
> "Ben Schumacher" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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
>>
>>

>
>

 
Reply With Quote
 
Ben Schumacher
Guest
Posts: n/a
 
      10-13-2006
Is there any chance you could convert your blog example to VB.Net?

Thanks so much,

Ben




"Teemu Keiski" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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
>>
>>

>
>



 
Reply With Quote
 
Teemu Keiski
Guest
Posts: n/a
 
      10-13-2006
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Is there any chance you could convert your blog example to VB.Net?
>
> Thanks so much,
>
> Ben
>
>
>
>
> "Teemu Keiski" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> 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
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie:Access custom Itemplate(not datagrid/repeater/datalist) control values on postback Luhar Powell via .NET 247 ASP .Net 0 04-01-2005 04:58 PM
Itemplate viewstate =?Utf-8?B?QW1pbmU=?= ASP .Net 1 01-17-2005 05:33 PM
Datagrid binding to Itemplate Dropdown box Andrea Williams ASP .Net 1 08-05-2004 05:07 AM
DropDownList / <select> value not setting in Itemplate cosine... zero ASP .Net 0 06-11-2004 06:52 PM
Itemplate not accepting postback in data-bound templated control cosine... zero ASP .Net 0 06-09-2004 06:49 PM



Advertisments