Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
2
Reply
display panel in gridview
Dipa Ahuja
Mar 16 2010 9:34 AM
4.5k
Reply
hi.. i wnt to display panel inside gridview.
i have taken button field and commandname of it button is "EDIT" and when it is clicked that panel should be display..
this way..
<ItemTemplate>
<asp:Panel ID="pe" visible="false" runat="server">
<table class="basic" runat="server" id="tbledit" width="400" border="0">
<tr><td>Title:</td>
<td><asp:TextBox ID="txtaname" runat="server" /></td>
</tr>
<tr><td>Description:</td>
<td><asp:TextBox ID="TextBox2" runat="server" /></td>
</tr><tr><td colspan="2" align="center">
<asp:Button ID="btncreate" CssClass="btn" runat="server" Text="Create" OnClick="btncreate_Click" />
<asp:Button ID="btncancel" CssClass="btn" runat="server" Text="Cancel" OnClick="btncancel_Click" />
</td>
</tr>
</table>
</asp:Panel>
</ItemTemplate>
<asp:ButtonField ItemStyle-VerticalAlign="top" ButtonType="Button" CommandName="Edit"/>
.CS
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
int index=Convert.ToInt32(e.CommandArgument);
Panel pn = (Panel)GridView1.Rows[index].FindControl("pe");
if (e.CommandName == "Edit")
{
pn.Visible = true;
}
}
but its not working.... i means when i click on buttonfield it doesnt displaying the panel
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
Listbox items and attributes
set focus from dropdownlist to textbox