Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 22nd, 2015, 07:06 AM
dpk dpk is offline
Registered User
Points: 11, Level: 1
Points: 11, Level: 1 Points: 11, Level: 1 Points: 11, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2015
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Unable to get EditItemTemplate Control in Rowcommand Event

hi frnds,

i need to get the control that exist inside the <EditItemTemplate> from _RowCommand..
but it is not there..
what is wrong..

if I find for hdnID control i am getting it but if I loog for hdnIDEdit then it gives me null.

pls see The line in Bold always giving me NULL.


<asp:TemplateField HeaderText="Title">
<ItemTemplate>
<asp:TextBox ID="txtTitle" runat="server" BackColor="Transparent" ReadOnly="true" BorderStyle="None" Text='<%# Eval("title") %>' />
<asp:HiddenField ID="hdnID" runat="server" Value='<%# Eval("ID") %>' />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtTitleEdit" runat="server" Text='<%# Eval("title") %>' />
<asp:HiddenField ID="hdnIDEdit" runat="server" Value='<%# Eval("ID") %>' />
</EditItemTemplate>
</asp:TemplateField>

====================================

protected void gvListData_RowCommand(object sender, GridViewCommandEventArgs e)
{
Int32 rowIndex = ((GridViewRow)(((LinkButton)e.CommandSource).Namin gContainer)).RowIndex;
if (e.CommandName == "EditMe")
{
gvListData.EditIndex = rowIndex;
SPList oListSelected = getList("/sites/PerfettiSC/Lists/" + ddlListIds.Text);
BindList(oListSelected);
((Panel)(gvListData.Rows[rowIndex].FindControl("pnlUpdate"))).Visible = true;
((Panel)(gvListData.Rows[rowIndex].FindControl("pnlEdit"))).Visible = false;
}

if (e.CommandName == "UpdateMe")
{
gvListData.EditIndex = rowIndex;
HiddenField hdn = (HiddenField)gvListData.Rows[rowIndex].FindControl("hdnIDEdit")
}
}
Reply With Quote
  #2 (permalink)  
Old February 16th, 2015, 01:32 AM
Registered User
Points: 6, Level: 1
Points: 6, Level: 1 Points: 6, Level: 1 Points: 6, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2015
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Please note: If you are under an NDA related to ASP.NET 2.0, please don't post any information here that will violate your NDA. This is a public forum, not associated with the Microsoft beta program.



__________________________________________________ ___________

solitairechamp online patience klondike cards games

Last edited by asalspammer; January 2nd, 2016 at 01:24 AM.
Reply With Quote
  #3 (permalink)  
Old February 16th, 2015, 01:34 PM
Friend of Wrox
Points: 528, Level: 8
Points: 528, Level: 8 Points: 528, Level: 8 Points: 528, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2014
Posts: 136
Thanks: 1
Thanked 10 Times in 10 Posts
Default

I for one would not reinvent the wheel unless absolutely needed to with event. The are already events defined for updating and rowbindding that you could used to do the 2 function that you are trying to do in the rowcommand event
Reply With Quote
  #4 (permalink)  
Old February 16th, 2015, 01:47 PM
Friend of Wrox
Points: 528, Level: 8
Points: 528, Level: 8 Points: 528, Level: 8 Points: 528, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2014
Posts: 136
Thanks: 1
Thanked 10 Times in 10 Posts
Default

Also FindControl only does a search of immediate child controls and not of any grandchild controls. You need to implement a search that find a control no matter where in the control structure it is located. Check out this post Checkbox in GridView
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to get blur event working - chap 16 pitters BOOK: Beginning ASP.NET 4.5 : in C# and VB 8 January 11th, 2014 04:05 PM
Can't find control in GridView RowCommand rsearing ASP.NET 2.0 Professional 8 September 10th, 2011 08:10 PM
Javascript functions from Gridview RowCommand Event Phil Critchley ASP.NET 4 General Discussion 21 May 3rd, 2011 11:55 PM
Click event not firing for Dynamic button control when it has validation control Gayathri79 ASP.NET 3.5 Basics 5 August 20th, 2010 07:58 PM
Unable to fire a click event rfinks ASP.NET 1.0 and 1.1 Basics 2 September 1st, 2006 11:26 PM



All times are GMT -4. The time now is 05:08 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.