I have a template field in a GridView that contains two ImageButtons.
When the user clicks one of the buttons, the GridView's RowCommand
event is fired and I can get the CommandName. All that is fine.
However, e.CommandArgument is an empty string, presumably because the
CommandArgument property of the ImageButtons is not set.
Is there some way, in the markup, to set the CommandArgument to the row
index?
<ItemTemplate>
<asp:ImageButton ID="btnSave" runat="server"
CommandName="Save" ImageUrl="~/Images/Diskette.gif"
CommandArgument="SOMETHING HERE" />
<asp:ImageButton ID="Email" runat="server"
CommandName="Email" ImageUrl="~/Images/Envelope.gif"
CommandArgument="SOMETHING HERE" />
</ItemTemplate>
TIA,
David 2 6010
Here is one example doing it in code: http://msdn2.microsoft.com/en-us/lib...owcommand.aspx
It is set in RowCreated event.
--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU http://blogs.aspadvice.com/joteke
"David" <do**@translogisticsinc.comwrote in message
news:11*********************@b28g2000cwb.googlegro ups.com...
>I have a template field in a GridView that contains two ImageButtons.
When the user clicks one of the buttons, the GridView's RowCommand
event is fired and I can get the CommandName. All that is fine.
However, e.CommandArgument is an empty string, presumably because the
CommandArgument property of the ImageButtons is not set.
Is there some way, in the markup, to set the CommandArgument to the row
index?
<ItemTemplate>
<asp:ImageButton ID="btnSave" runat="server"
CommandName="Save" ImageUrl="~/Images/Diskette.gif"
CommandArgument="SOMETHING HERE" />
<asp:ImageButton ID="Email" runat="server"
CommandName="Email" ImageUrl="~/Images/Envelope.gif"
CommandArgument="SOMETHING HERE" />
</ItemTemplate>
TIA,
David
Thank you for your reply. I had already planned on doing it in the
RowCreated event. I was just hoping there was some way to do it in the
markup.
Thanks again.
David
Teemu Keiski wrote:
Here is one example doing it in code: http://msdn2.microsoft.com/en-us/lib...owcommand.aspx
It is set in RowCreated event.
--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU http://blogs.aspadvice.com/joteke
"David" <do**@translogisticsinc.comwrote in message
news:11*********************@b28g2000cwb.googlegro ups.com...
I have a template field in a GridView that contains two ImageButtons.
When the user clicks one of the buttons, the GridView's RowCommand
event is fired and I can get the CommandName. All that is fine.
However, e.CommandArgument is an empty string, presumably because the
CommandArgument property of the ImageButtons is not set.
Is there some way, in the markup, to set the CommandArgument to the row
index?
<ItemTemplate>
<asp:ImageButton ID="btnSave" runat="server"
CommandName="Save" ImageUrl="~/Images/Diskette.gif"
CommandArgument="SOMETHING HERE" />
<asp:ImageButton ID="Email" runat="server"
CommandName="Email" ImageUrl="~/Images/Envelope.gif"
CommandArgument="SOMETHING HERE" />
</ItemTemplate>
TIA,
David
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Kyle K. |
last post by:
(Note: Windows XP Pro SP2 + Visual Studio .NET 2005 + SQL Server 2000)
I have a GridView that is populated with data. That last 2 columns are
button fields (image buttons) that have a CommandName...
|
by: cartmann |
last post by:
Hi,
I have a gridview with a template column. In the template column i have two
commandbuttons. When clicking the buttons I enter the cmd_click event - but
how do I read in which row the button...
|
by: |
last post by:
Hi all,
I am trying to have a linkbutton control with the commandname property set.
However, when I invoke it, the CommandArgument property ends up coming to be
blank. However, if I click on the...
|
by: mesut |
last post by:
hit there,
I have a problem getting the rownumbers when I use the template field
<asp:button control.
I don't get the rownumbers when I use this control. When I use a
buttonfield control then I...
|
by: David Lozzi |
last post by:
Howdy,
I have a gridview with a linkbutton in a template column (code is below).
When the linkbutton is clicked i want to display a little confirm right in
the gridview to confirm deleting the...
|
by: Ken Fine |
last post by:
I'm making an administrative interface that lists records in a GridView.
For *each* row in the gridview, I would there to be two interface elements
in addition to some information associated with...
|
by: =?Utf-8?B?UGF1bA==?= |
last post by:
Hi I have a gridview with one of the columns as a template column with a
button. When the user selects the button is there a way to get the row
number in the button_Click event? Another one of...
|
by: =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= |
last post by:
I'm adding subheadings to a gridview. Each sub head has a few link buttons.
I'm adding the controls in the rowdatabound event code follows: sorry about
the length here. I have to be missing...
|
by: =?Utf-8?B?ZWdzZGFy?= |
last post by:
Hi, I have created a second gridview when customer clicks on select link with
this code:
Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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...
|
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...
|
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,...
|
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...
|
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,...
| |