473,395 Members | 1,815 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.

CommandName and CommandArguments not persisting in TemplateField

I created a DataGrid with a templated field:
<asp:TemplateField HeaderText="Status">
<ItemTemplate>
<asp:DropDownList ID="ddlScreenStatus"
runat="server" Style="z-index: 100; ">
</asp:DropDownList>
<asp:Button ID="ButtonSet" runat="server"
Style="z-index: 102;" Text="Button" />
</ItemTemplate>
<ItemStyle Width="98px" />
</asp:TemplateField>

For the Button, I set its text and CommandArgument in the RowCreated
event handler:

protected void GVMatchingScreens_RowCreated(object sender,
GridViewRowEventArgs e)
{
.. . .
Button setStatus = map.SetStatusButton;
setStatus.Text = "SetHere";
setStatus.CommandName = "SetStatus";
setStatus.CommandArgument = e.Row.RowIndex.ToString();
}
}
}

I see on the screen, the button's text has been set to "SetHere"
When I click the button on the screen, though, and step through the
command handler,

protected void GVMatchingScreens_RowCommand(object sender,
GridViewCommandEventArgs e)
{

// Set up location we'll need for all commands
int useRow;
useRow =
MapPageRowToData((GridView)sender,Int32.Parse(e.Co mmandArgument.ToString()));

I get a vluhurg in e.CommandArgument.ToString(). Somehow,
e.CommandArgument, and e.CommandName are null when the row command
event is fired.

This works for a regular bound control, but not one in a TemplateField.
Anyone have any thoughts?

Mar 31 '06 #1
0 1157

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

Similar topics

2
by: Citoyen du Monde | last post by:
Trying to get some ideas on a simple javascript project (to teach myself the language). I want to develop a client-side vocabulary practice application that would allow users to enter their own...
2
by: sck10 | last post by:
Hello, I am trying to programically make the following TemplateField ("MyTemplate") visible when the user clicks on the "Edit" Button using the PreRender handle event. My question is, how do...
5
by: Dick | last post by:
I have a GridView bound to an ObjectDataSource. I have a Button that calls GridView.DataBind. I want the row that is selected before the DataBind to still be selected afterwards. This happens...
6
by: Class | last post by:
Hi all, I create a gridview dynamicly because I don't know the columns in advance. I use the Templatefield to create a linkbutton. Everything fine..I have the postbackurl and it works. But now...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.