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

asp:button column click event

Hi,
I am having a asp button column which onclick should open another page.
My code is in C# and goes like this.

private void dtICHQryDetails_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if ((e.Item.ItemType == ListItemType.AlternatingItem) || (e.Item.ItemType == ListItemType.Item))
{
string strReqNo = e.Item.Cells[0].Text;
if (int.Parse(e.Item.Cells[0].Text) > 0)
{
e.Item.Cells[8].Attributes.Add("onclick", "javascript:OpenICHQryItem('" + strReqNo + "');");
e.Item.Attributes.Add("onclick", "javascript:OpenICHQryItem('" + strReqNo + "');");
}
}
}

javascript:
function OpenICHQryItem(txtReqNo)
{
location.href = "SRPICHOUTBIL.aspx?reqno=" + txtReqNo;
}

asp button column is the 8th cell in the grid.
Also e.Item.Attributes.Add(....) statement works,
but e.Item.Cells[8].Attributes.Add(..) doesn't work...

Can you please tell me how to solve this.

Thanks
May 31 '07 #1
3 2072
Plater
7,872 Expert 4TB
Where are you adding the asp:button?
Just add the handler to it then?
May 31 '07 #2
what handler should I add to the button??
Jun 3 '07 #3
Plater
7,872 Expert 4TB
well you said that like e.Item.Cells[8] should be a button right? Where is it told that it's a button? Wherever that is, add the .Attributes.Add() statement?

Does e.Item.Cells[8] have a .Controls ? because if it does, check it. It might be that the actual BUTTON control is a sub control of e.Item.Cells[8]
So you might have do something like e.Item.Cells[8].Controls[0].Attributes.Add()
Jun 4 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: JCE | last post by:
I need to programmatically invoke an asp:Button click event from a javascript function. The page containing the script and the button is the HTML page associated with a WebUserControl-derived...
4
by: hb | last post by:
Hi, When I add an asp:button (ex: id=btnLog) on home.aspx, I need to create btnLog_Click() event in home.aspx.cs, and also link this event and the button in OnInit() method by adding:...
8
by: tatemononai | last post by:
I had a beautiful script that was running, well, just beautifully. But then I decided to take a button that fired an event and place it inside a <asp:table. The event WILL NOT FIRE INSIDE THE...
7
by: Lam | last post by:
I want to dynamic generate a asp:button in C# class, not in the HTML code so that it can call the methods in the c# class, I try to use "Response.Write("<asp:button...>") it didn't show the button...
3
by: JV | last post by:
This is for anyone who has tackled the accessibility issue on their web site (and if you haven't, I bet you will in future). Apparently the asp:button control always renders as '<input...
5
by: csgraham74 | last post by:
Hi guys, I posted regarding this issue the other day but i still dont have an answer to my problem. Basically i have imported asp.net pages from dreamweaver into visual studio. Ive added a...
1
by: R.A.M. | last post by:
Hello, I have very simple problem which I present here second time, because I haven't got a solution. I need to process asp:Button click at server. I have written (my experience is little) in...
2
by: =?Utf-8?B?RGF0YXNvcnQ=?= | last post by:
Is it possible to add a stored proc to a table adapter and execute the proc inside an ASP button click event? I have a table adapter called Claimers and a sp called AddWatch. On the onclick...
1
by: mazdotnet | last post by:
Hi all, I'm really stuck trying to figure the following out. I have been working on a shopping portal where you can select products from a list inside a repeater on the bottom of the page and...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
0
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,...

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.