View Single Post
  #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