ASP.Net Development, Hire.net developer

ASP.Net 2.0, ASP.Net Developers, Hire .Net Developrs

Obtain RowIndex of Asp.Net GridView in the RowCommand Event

There are two methods to get the RowIndex in the RowCommand Event. Let see one-by-one.

Consider you have a LinkButton placed inside the TemplateField section as follows.

<asp:TemplateField HeaderText=”Submit”>
<ItemTemplate>
<asp:LinkButton ID=”lnkbtnSubmit” runat=”server” CommandName=”Submit” Text=’<%# Bind(“Id”) %>’ ></asp:LinkButton>
</ItemTemplate>
<EditItemTemplate>
</EditItemTemplate>
</asp:TemplateField>

Method 1: Using CommandSource object

In the RowCommand Event of the GridView control, write the following code,

protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName.Equals(“Submit”))
{
GridViewRow gvr = (GridViewRow)((LinkButton)e.CommandSource).NamingContainer;
int RowIndex = gvr.RowIndex;
}
}

Method 2: Using CommandArgument property
In the CommandArgument property of the LinkButton, add an inline code to assign the GridViewRow’s container RowIndex value as follows,

<asp:TemplateField HeaderText=”Submit”>
<ItemTemplate>
<asp:LinkButton ID=”lnkbtnSubmit” runat=”server” CommandName=”Submit” Text=’<%# Bind(“Id”) %>’
CommandArgument=’<%# ((GridViewRow) Container).RowIndex %>’ ></asp:LinkButton>
</ItemTemplate>
<EditItemTemplate>
</EditItemTemplate>
</asp:TemplateField>

Then in the RowCommand Event, you can get the RowIndex as follows,
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName.Equals(“Submit”))
{
int RowIndex = Convert.ToInt32(e.CommandArgument).ToString();
}
}

Have a Look at  ASP.Net Development Company

April 9, 2009 Posted by | ASP.Net development | Leave a Comment

MonoDevelop 2.0 and Mono 2.4 released

Mono developers have released Mono 2.4, an update to their open sourcealternative to Microsoft’s .NET framework including that  they also relese version 2.0 of MonoDevelop, an open source Integrated Development Environment (IDE) for programming in C# and other .NET languages on Linux, Mac OS X.

MonoDevelop 2.0 provides improved support for ASP.NET and C# 3.0, an integrated debugger and interoperability improvements for developers who need to share their projects with Visual Studio 2008. MonoDevelop 2.0 allows Linux-based developers to write desktop and ASP.NET Web applications using a variety of languages, including C#, Visual Basic.NET and Java.

For Download from Here

Read more

For More Information about ASP.Net Development Contact Us at

kj@semaphore-software.com

Or


April 6, 2009 Posted by | ASP.Net development | Leave a Comment

What is DotNetInvoice?


DotNetInvoice is a web based invoicing result created by prominent software blogger Rob Walling. It’s a simple, professional, and cost-effective solution to automating your business’ invoicing and it helps you keep tabs on your money.

April 3, 2009 Posted by | ASP.Net development | Leave a Comment

Follow

Get every new post delivered to your Inbox.