473,586 Members | 2,639 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding attributes to page button of datagrid

Hi,

I want to add one java script function on the click of
page button of datagrid. But how to get UI control of page
button so that i should be able to add attribute for
onClick event.

Please suggest

Sumit
Nov 18 '05 #1
8 4432
Hi Sumit

in the Item_Created event of the datagrid you can trap
the iteration for when the Pager row item is created using
[C#]
if (e.Item.ItemTyp e == ListItemType.Pa ger)

the way asp.net renders the pager row to the browser can
vary - it usually creates a single table-cell and fills
this cell with controls containing the paging buttons.

To extract the attributes collection of the control you
want to access you can use
[C#]
e.Item.Cells[index].Controls[index].Attributes

or e.Item.Cells[index].FindControl(na me)
alex
-----Original Message-----
Hi,

I want to add one java script function on the click of
page button of datagrid. But how to get UI control of pagebutton so that i should be able to add attribute for
onClick event.

Please suggest

Sumit
.

Nov 18 '05 #2
Hi Sumit

in the Item_Created event of the datagrid you can trap
the iteration for when the Pager row item is created using
[C#]
if (e.Item.ItemTyp e == ListItemType.Pa ger)

the way asp.net renders the pager row to the browser can
vary - it usually creates a single table-cell and fills
this cell with controls containing the paging buttons.

To extract the attributes collection of the control you
want to access you can use
[C#]
e.Item.Cells[index].Controls[index].Attributes

or e.Item.Cells[index].FindControl(na me)
alex
-----Original Message-----
Hi,

I want to add one java script function on the click of
page button of datagrid. But how to get UI control of pagebutton so that i should be able to add attribute for
onClick event.

Please suggest

Sumit
.

Nov 18 '05 #3
Hi Alex,

Thanks a lot!
I tried the same thing in DataItembound event of datagrid
but it If condition falied there,,,

Is DataItembound doesnt get Pager item and Item_Created
can have that item??

Please suggest
-----Original Message-----
Hi Sumit

in the Item_Created event of the datagrid you can trap
the iteration for when the Pager row item is created using
[C#]
if (e.Item.ItemTyp e == ListItemType.Pa ger)

the way asp.net renders the pager row to the browser can
vary - it usually creates a single table-cell and fills
this cell with controls containing the paging buttons.

To extract the attributes collection of the control you
want to access you can use
[C#]
e.Item.Cells[index].Controls[index].Attributes

or e.Item.Cells[index].FindControl(na me)
alex
-----Original Message-----
Hi,

I want to add one java script function on the click of
page button of datagrid. But how to get UI control of

page
button so that i should be able to add attribute for
onClick event.

Please suggest

Sumit
.

.

Nov 18 '05 #4
Hi Alex,

Thanks a lot!
I tried the same thing in DataItembound event of datagrid
but it If condition falied there,,,

Is DataItembound doesnt get Pager item and Item_Created
can have that item??

Please suggest
-----Original Message-----
Hi Sumit

in the Item_Created event of the datagrid you can trap
the iteration for when the Pager row item is created using
[C#]
if (e.Item.ItemTyp e == ListItemType.Pa ger)

the way asp.net renders the pager row to the browser can
vary - it usually creates a single table-cell and fills
this cell with controls containing the paging buttons.

To extract the attributes collection of the control you
want to access you can use
[C#]
e.Item.Cells[index].Controls[index].Attributes

or e.Item.Cells[index].FindControl(na me)
alex
-----Original Message-----
Hi,

I want to add one java script function on the click of
page button of datagrid. But how to get UI control of

page
button so that i should be able to add attribute for
onClick event.

Please suggest

Sumit
.

.

Nov 18 '05 #5
yes, the ItemDataBound event doesn't trap the pager item -
you need to use the ItemCreated event.

alex
-----Original Message-----
Hi Alex,

Thanks a lot!
I tried the same thing in DataItembound event of datagridbut it If condition falied there,,,

Is DataItembound doesnt get Pager item and Item_Created
can have that item??

Please suggest
-----Original Message-----
Hi Sumit

in the Item_Created event of the datagrid you can trap
the iteration for when the Pager row item is created using[C#]
if (e.Item.ItemTyp e == ListItemType.Pa ger)

the way asp.net renders the pager row to the browser canvary - it usually creates a single table-cell and fills
this cell with controls containing the paging buttons.

To extract the attributes collection of the control you
want to access you can use
[C#]
e.Item.Cell s[index].Controls[index].Attributes

or e.Item.Cells[index].FindControl(na me)
alex
-----Original Message-----
Hi,

I want to add one java script function on the click of
page button of datagrid. But how to get UI control of

page
button so that i should be able to add attribute for
onClick event.

Please suggest

Sumit
.

.

.

Nov 18 '05 #6
yes, the ItemDataBound event doesn't trap the pager item -
you need to use the ItemCreated event.

alex
-----Original Message-----
Hi Alex,

Thanks a lot!
I tried the same thing in DataItembound event of datagridbut it If condition falied there,,,

Is DataItembound doesnt get Pager item and Item_Created
can have that item??

Please suggest
-----Original Message-----
Hi Sumit

in the Item_Created event of the datagrid you can trap
the iteration for when the Pager row item is created using[C#]
if (e.Item.ItemTyp e == ListItemType.Pa ger)

the way asp.net renders the pager row to the browser canvary - it usually creates a single table-cell and fills
this cell with controls containing the paging buttons.

To extract the attributes collection of the control you
want to access you can use
[C#]
e.Item.Cell s[index].Controls[index].Attributes

or e.Item.Cells[index].FindControl(na me)
alex
-----Original Message-----
Hi,

I want to add one java script function on the click of
page button of datagrid. But how to get UI control of

page
button so that i should be able to add attribute for
onClick event.

Please suggest

Sumit
.

.

.

Nov 18 '05 #7
Yes, Now in Item_Created event, If conditions goes well
but it gives only one cell and one control for that i.e
Label,,but i need to get that page button (1,2,3....)

the code is:

private void dgSearchedAltPa ckages_ItemCrea ted(object
sender, System.Web.UI.W ebControls.Data GridItemEventAr gs e)
{
if (e.Item.ItemTyp e == ListItemType.Pa ger )
{
foreach(Control ctrl in e.Item.Controls )
{
Response.Write( "ctrl type" + ((Label)ctrl.Co ntrols
[0]).GetType() +"<br>");
}
}
}

It prints only Label and no Button UI type??

Please suggest!!

Thanks,
Sumit
-----Original Message-----
yes, the ItemDataBound event doesn't trap the pager item -
you need to use the ItemCreated event.

alex
-----Original Message-----
Hi Alex,

Thanks a lot!
I tried the same thing in DataItembound event of

datagrid
but it If condition falied there,,,

Is DataItembound doesnt get Pager item and Item_Created
can have that item??

Please suggest
-----Original Message-----
Hi Sumit

in the Item_Created event of the datagrid you can trap
the iteration for when the Pager row item is createdusing[C#]
if (e.Item.ItemTyp e == ListItemType.Pa ger)

the way asp.net renders the pager row to the browsercanvary - it usually creates a single table-cell and fills
this cell with controls containing the paging buttons.

To extract the attributes collection of the control you
want to access you can use
[C#]
e.Item.Cel ls[index].Controls[index].Attributes

or e.Item.Cells[index].FindControl(na me)
alex
-----Original Message-----
Hi,

I want to add one java script function on the click of
page button of datagrid. But how to get UI control of
page
button so that i should be able to add attribute for
onClick event.

Please suggest

Sumit
.

.

.

.

Nov 18 '05 #8
Hi,

Thanks a lot!!
It is done!!

Sumit
-----Original Message-----
yes, the ItemDataBound event doesn't trap the pager item -
you need to use the ItemCreated event.

alex
-----Original Message-----
Hi Alex,

Thanks a lot!
I tried the same thing in DataItembound event of

datagrid
but it If condition falied there,,,

Is DataItembound doesnt get Pager item and Item_Created
can have that item??

Please suggest
-----Original Message-----
Hi Sumit

in the Item_Created event of the datagrid you can trap
the iteration for when the Pager row item is createdusing[C#]
if (e.Item.ItemTyp e == ListItemType.Pa ger)

the way asp.net renders the pager row to the browsercanvary - it usually creates a single table-cell and fills
this cell with controls containing the paging buttons.

To extract the attributes collection of the control you
want to access you can use
[C#]
e.Item.Cel ls[index].Controls[index].Attributes

or e.Item.Cells[index].FindControl(na me)
alex
-----Original Message-----
Hi,

I want to add one java script function on the click of
page button of datagrid. But how to get UI control of
page
button so that i should be able to add attribute for
onClick event.

Please suggest

Sumit
.

.

.

.

Nov 18 '05 #9

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

Similar topics

2
3624
by: Clayton Hamilton | last post by:
I have a DataGrid on a webform bound to a Datasource and can successfully use <ItemTemplate> to create edit/update/cancel functionality for user maintenance of data. I use separate logic to delete a row. Everything works just fine. BUT I would like to add a button to (for example) the DataGrid header, which when pressed will add a new...
3
4866
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that the best method? Do you have a sample of how to do this?
0
321
by: sumit | last post by:
Hi, I want to add one java script function on the click of page button of datagrid. But how to get UI control of page button so that i should be able to add attribute for onClick event. Please suggest Sumit
4
5580
by: Dmitry Korolyov [MVP] | last post by:
When we use btnSubmit.Attributes = "javascript: this.disabled=true;" to make the button disabled and prevent users from clicking it again while form data still posting, there is no longer postback. I.e. the button does go disabled, but the form does not invoke submit() method. Of course, it does work fine without this property. Clues?
1
3268
by: Andrew | last post by:
Hey all, I am very new to ASP.Net (and .Net in general), but that isn't stopping the boss from wanting to begin new projects in it. This latest project has me kinda stumped and after a couple days of struggling, I figure asking you all (the experts) will keep me from going down some dark and dangerous road. The project I have is a fairly...
19
2453
by: Sjaakie Helderhorst | last post by:
Hello, I need to add a Javascript event (onClick) to a servercontrol (asp:checkbox). Checkbox is named 'cbDoMail'. Assumed that 'cbDoMail.Attributes.Add("onClick", "doJavascriptThing()") would do the job, unfortunately it didn't. Can anyone point me in the right direction? Thanks!
4
1903
by: Craig G | last post by:
i was using the following on a serverside button on a form If (Not Page.IsPostBack) Then Me.BtnDelete.Attributes.Add("onclick","return confirm('Are you sure you want to delete?');") End If but was wondering how i would go about doing the same for a button within a column? i cannot see btnDelete in the code-behind page
5
1932
by: Samy | last post by:
Hi There, I have a label in a datagrid which I make it a input type = radio in ItemDataBound so that radio buttons are shown in the datagrid. This is how I have it... ASPX... <asp:Label ID="_selectedRBtn" Runat="server"></asp:Label> ASPX.CS
2
3105
by: Muzzy | last post by:
Hi, I've used information on these newsgroups to build many pages. So I thought that now that I have my script working (something that I've been working on for about a week), I should post it so that it may help others. If posting this script is against the rules in this group then please accept my appologies. I developped this script so...
0
8202
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. ...
1
7959
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6614
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...
1
5710
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...
0
5390
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...
0
3837
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
3865
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
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
1449
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.