hi
i have create one usercontrol in that i get one grid view and that usercontrol i have use in my page gridview template.............
my problem is how to handle event of user control grid view?
plase tell me:(
my code
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="topic.ascx.cs" Inherits="Admin_topic" %>
<div style="padding-left:15px">
<asp:GridView ID="gvtopic12" runat="server" AutoGenerateColumns="false" AllowSorting="True"
AllowPaging="false" PageSize="20" PagerSettings-Position="TopAndBottom"
PagerStyle-HorizontalAlign="Right"
CssClass="listTable" GridLines="Both"
DataKeyNames="TopicID" Width="100%"
OnRowDataBound="SetgvCassessColumnValues" onrowdeleting="gvtopic12_RowDeleting"
>
<Columns>
<asp:BoundField ItemStyle-Width="10%" DataField="topicid" HeaderText="Topic Id" />
<asp:BoundField ItemStyle-Width="25%" DataField="topicname" HeaderText="Topic Name" />
<asp:TemplateField HeaderText="Description" ItemStyle-Width="65%" >
<ItemTemplate >
<asp:Literal ID="litdescripitonshow" runat="server" Text='<%# Eval("Topicdescription").ToString() %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Delete?">
<ItemTemplate>
<span onclick="return confirm('Are you sure to Delete the record?')">
<asp:LinkButton ID="lnkB" runat="Server" Text="Delete" CommandName="Delete"><img id="imglog" src="../../images/delete.gif" border="0" /></asp:LinkButton>
</span>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<SelectedRowStyle BackColor="#9B9ECA" />
</asp:GridView>
</div>
and these user control use in parent page
that code is in
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="managetopic.aspx.cs" EnableEventValidation="false" Inherits="Admin_managetopic" MasterPageFile="~/UI/MyCassess/EMWDMain.master" %>
<%@ Register Src="~/UI/Admin/topic.ascx" TagName="Topic" TagPrefix="uc1" %>
<asp:Content ContentPlaceHolderID="head" ID="PAGEhead" runat="server">
<script language="javascript" type="text/javascript" src="../../jsgrid/effects.js"></script>
<script language="javascript" type="text/javascript" src="../../jsgrid/prototype.js"></script>
<script language="javascript" type="text/javascript" src="../../jsgrid/scriptaculous.js"></script>
<script language="javascript" type="text/javascript" src="../../jsgrid/slider.js"></script>
<link href="../../css/Stylesheet-2.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">
var className = 'collapsed';
// fires when the edit button is pushed!
function edit()
{
// create the textboxes
}
function getFileNameFromUrl(url)
{
wholeurl = url;
x = wholeurl.length;
while((wholeurl.substring(x,x-1)) != "/"){ x--; }
return wholeurl.substring(wholeurl.length,x);
}
function toggleDetailsView(link)
{
// change HTML text to open and close
var img = $(link).childElements()[0];
var imgFileName = getFileNameFromUrl(img.src);
img.src = imgFileName == 'tn_plus.GIF' ? 'tn_minus.GIF' : 'tn_plus.GIF';
var element = $(link).next("." + className);
$(element).toggleClassName('expanded');
}
</script>
</asp:Content>
<asp:Content ID="gridcontent" runat="server" ContentPlaceHolderID="cphDetails">
<div>
<div style="text-align:left;">
<a href="newtopic.aspx"><img src="../../images/btn_addnew.png" /> </a>
<div style="clear:both;"></div>
</div>
<asp:GridView ID="gvtopic" runat="server" AutoGenerateColumns="false" AllowSorting="True"
AllowPaging="false" PageSize="20" PagerSettings-Position="TopAndBottom"
PagerStyle-HorizontalAlign="Right"
CssClass="listTable" GridLines="Both"
DataKeyNames="TopicID" Width="100%"
>
<Columns>
<asp:TemplateField HeaderText="Topic Name">
<ItemTemplate>
<a id="openCloseLink" onclick="toggleDetailsView(this)" href="#">
<img src="tn_plus.GIF" style="border: 0px; padding:2px" alt="PLUS" />
</a>
<span class="mainTitleStyle">
<%# Eval("Topicname") %>
</span>
<div id="divDetailsView" runat="server" class="collapsed">
<uc1:Topic ID="topicchild" runat="server" Parenttopic='<%# Bind("TopicID") %>' />
</div>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<SelectedRowStyle BackColor="#9B9ECA" />
</asp:GridView>
</div>
</asp:Content>