Hi,
you can handle all events which are raised from common type of controls
Here I'm giving some idea how to handle multiple control events in single handler
<table width="300"><tr>
<td>
<asp:linkbutton id="LinkButton2" runat="server" commandargument="First" onclick="LinkButton2_Click" xmlns:asp="#unknown">First</asp:linkbutton></td>
<td>
<asp:linkbutton id="LinkButton3" runat="server" commandargument="Prev" onclick="LinkButton2_Click" xmlns:asp="#unknown">Prev</asp:linkbutton></td>
<td valign="bottom">
</td></tr></table>
Like in the above code i've too many linkbuttons in my webcontrol
I can handle all events in my single handler like if any linke clicks
it can raise only LinkButton2_Click event
And in my single I write code for all linkbutton features
protected void LinkButton2_Click(object sender, EventArgs e)
{
if (((LinkButton)sender).CommandArgument.ToString() == "First")
{
ReqPageNo = "1";
}
if (((LinkButton)sender).CommandArgument.ToString() == "Prev")
{
if (int.Parse(crntpage.Value) == 1)
{
ReqPageNo = "1";
}
else
{
ReqPageNo = (int.Parse(crntpage.Value) - 1).ToString();
}
}
if (((LinkButton)sender).CommandArgument.ToString() == "Next")
{
if (int.Parse(crntpage.Value) == int.Parse (TotalPageNo))
{
ReqPageNo = TotalPageNo;
}
else
{
ReqPageNo = (int.Parse(crntpage.Value) + 1).ToString();
}
}
if (((LinkButton)sender).CommandArgument.ToString() == "Last")
{
ReqPageNo = TotalPageNo;
}
Click(this, e);
}
Like this you can handle any event in single handler
I hope you understood what I said
All the Best