473,597 Members | 2,342 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

access to control in footer template

Hi,How can I access to checkbox control in footer template of datalist and fire the selectedchangei ndex event?
--
Regards mahsa
Nov 18 '05 #1
3 4431
Hi,

you can just declare the event handler for the CheckBox control in aspx
(inline in the footer template e.g into the declarative syntax) or another
way is to locate it in ItemCreated of the dataList and wire the event
handler programmaticall y. Both ways work equally.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke
"mahsa" <ma***@discussi ons.microsoft.c om> wrote in message
news:13******** *************** ***********@mic rosoft.com...
Hi,How can I access to checkbox control in footer template of datalist and fire the selectedchangei ndex event? --
Regards mahsa

Nov 18 '05 #2
Hi,

like I said in my previous post, you must do it in *ItemCreated* (it is
different than ItemDataBound). ItemDataBound is not called for footer (only
for normal and alternating items according to the rows in data source), and
it is called only when DataBind is called for the DataList. You need to get
the code to run on every request, and ItemCreated works exactly that way and
additionally ItemCreated is called for the footer as well (DataListItem's
ItemType in ItemCreated is Footer then)

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke
"mahsa" <ma***@discussi ons.microsoft.c om> wrote in message
news:9C******** *************** ***********@mic rosoft.com...
hi I try this on DataList_ItemDa taBound to find a control int footerIndex = DataList1.Contr ols[0].Controls.Count-1; CheckBox d;
d = DataList1.Contr ols[0].Controls[footerIndex].FindControl("C h_LiftGround") as
CheckBox; if(d != null)
{
d.AutoPostBack= true;
d.CheckedChange d += new System.EventHan dler(this.Ch_Li ftGround_Checke dChanged); }

but if the footer templete is not in item template like this:

<ItemTemplate >
<FooterTemplate >
<asp:CheckBox ID="Ch_LiftGrou nd" Runat="server" Text="Lift Ground Service" class='caption' AutoPostBack=tr ue ></asp:CheckBox> </FooterTemplate>
</ItemTemplate>
this code dosent work and if the footer is in daitemtemplate it dosent work exacty right either do you have any idea?


"Teemu Keiski" wrote:
Hi,

you can just declare the event handler for the CheckBox control in aspx
(inline in the footer template e.g into the declarative syntax) or another way is to locate it in ItemCreated of the dataList and wire the event
handler programmaticall y. Both ways work equally.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke
"mahsa" <ma***@discussi ons.microsoft.c om> wrote in message
news:13******** *************** ***********@mic rosoft.com...
Hi,How can I access to checkbox control in footer template of datalist
and fire the selectedchangei ndex event?
--
Regards mahsa


Nov 18 '05 #3
Hi I have this in DataList1_ItemD ataCreate
CheckBox d;
int footerIndex = DataList1.Contr ols[0].Controls.Count-1;
d = DataList1.Contr ols[0].Controls[footerIndex].FindControl("C h_LiftGround") as CheckBox;
if(d != null)
{
Response.Write( "Found footer DropDownList1 in SelectedIndexCh anged event<br>");
d.CheckedChange d += new System.EventHan dler(this.Ch_Li ftGround_Checke dChanged);
}

but it dosent find check box do I have to put it in
I put it in (e.Item.ItemTyp e == ListItemType.It em || e.Item.ItemType == ListItemType.Al ternatingItem)
dosent find a control what can I do?it shows footerindex=0
whats your idea?

<FooterTemplate >
<tr> <td colspan=2 align=left width=100% runat=server ID="Td1" NAME="Td1">
<asp:CheckBox ID="Ch_LiftGrou nd" Runat="server" AutoPostBack="T rue" Text="Lift Ground Service" class='caption' ></asp:CheckBox></td>
</tr>

"Teemu Keiski" wrote:
Hi,

like I said in my previous post, you must do it in *ItemCreated* (it is
different than ItemDataBound). ItemDataBound is not called for footer (only
for normal and alternating items according to the rows in data source), and
it is called only when DataBind is called for the DataList. You need to get
the code to run on every request, and ItemCreated works exactly that way and
additionally ItemCreated is called for the footer as well (DataListItem's
ItemType in ItemCreated is Footer then)

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke
"mahsa" <ma***@discussi ons.microsoft.c om> wrote in message
news:9C******** *************** ***********@mic rosoft.com...
hi I try this on DataList_ItemDa taBound to find a control int footerIndex

= DataList1.Contr ols[0].Controls.Count-1;
CheckBox d;
d =

DataList1.Contr ols[0].Controls[footerIndex].FindControl("C h_LiftGround") as
CheckBox;
if(d != null)
{
d.AutoPostBack= true;
d.CheckedChange d += new

System.EventHan dler(this.Ch_Li ftGround_Checke dChanged);
}

but if the footer templete is not in item template like this:

<ItemTemplate >
<FooterTemplate >
<asp:CheckBox ID="Ch_LiftGrou nd" Runat="server" Text="Lift Ground

Service" class='caption' AutoPostBack=tr ue ></asp:CheckBox>
</FooterTemplate>
</ItemTemplate>
this code dosent work and if the footer is in daitemtemplate it dosent

work exacty right either do you have any idea?



"Teemu Keiski" wrote:
Hi,

you can just declare the event handler for the CheckBox control in aspx
(inline in the footer template e.g into the declarative syntax) or another way is to locate it in ItemCreated of the dataList and wire the event
handler programmaticall y. Both ways work equally.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke
"mahsa" <ma***@discussi ons.microsoft.c om> wrote in message
news:13******** *************** ***********@mic rosoft.com...
> Hi,How can I access to checkbox control in footer template of datalist and fire the selectedchangei ndex event?
> --
> Regards mahsa


Nov 18 '05 #4

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

Similar topics

4
5470
by: Kaung Htut O via DotNetMonster.com | last post by:
Hi to all Is there a way to access Datalist Footer's Control properties from outside of datalist event. Pls note that I mean not a datagrid, only for datalist. Thanks Kaung Htut Oo
1
3538
by: Paul Maidment | last post by:
Hi, I am a bit green when it comes to .net development so please excuse me if this question is obvious or has been asked before... I am trying to programmatically access a label control within a datalist footer template using asp/vb.net. I have been searching through the documentation but can only find reference to
5
5127
by: Paul | last post by:
Hi I need to change the text value of a dropdown list box that is in a template column of a data grid but was not sure how to access it, probably something like datagrid1.control.dropdownlist.text = "" but not sure. -- Paul G Software engineer.
4
7411
by: sck10 | last post by:
Hello, I have a repeater that is bound to a SQL Server table. I would like to place a summary in the footer for the item count and product cost. I have two fields. One for the product name and the other for product cost. <%#Container.DataItem("ProductA")%> <%#Container.DataItem("PriceA")%>
6
2276
by: youvrajasnsm | last post by:
Hi, >I am working on ASP.net,using language . >I am using datagrid control and i filled it through datasource. >I have a column name Price and i want to sum price in Footer Template. >Can anybody tell me How to use of Template column in datagrid and sum in it. Please reply me soon....... With regards Yuvraj Porwal
2
1726
by: pbeeke | last post by:
Can you prefill DataGrid footer template fieldswith items from the same datagrid. For example I am using the footer template in the grid in order to add a new record. THe query that updates the record needs a primary key and an employee number - both of which appear on every row in the datagrid. Does anyone know how I can prefill these two footer fields. Thanks
9
1958
by: Adam Nielsen | last post by:
Hi all, I'm a bit confused about the syntax used to access a nested template class. Essentially I have a bunch of class types to represent different types of records in a database, and I want to store some cache data for each datatype. The simplified code below demonstrates my issue - I think I understand why it doesn't work as is (the structure only declares the storage, I need to instantiate it for each template type) but I'm not...
8
2144
by: xz | last post by:
Why C++ (as well as Java) adopts class-based access control instead of instance-based access control? I had never paid attention to whether an access-control is class-based or instance-based but only intuitively thought that the latter was the one being used. Since it does not seem to make sense to let an instance "a1" of Class "A" to have access to the private data of instance "a2" of the same Class A, does it?
1
5151
by: naasirsom | last post by:
Dear sir, I am using Gridview asp.net 2.0, I have a problem with Gridview Footer Template. I have put Button, Textbox and RequiredValidator in the Footer Template and Want to validate the textbox if it is empty and I used ValidationGroup . I have done all jobs and the page is working but the problem is the button is working the first time but the second time does not postback.
0
7969
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7886
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8272
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8258
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5847
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5431
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2404
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
1494
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1238
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.