Friday, October 8, 2010

New Bug in VS 2008

Hi folks, yesterday while debugging an application i found some strange behaviour by the VS 2008..
I was passing a value into the Query String from a GridView.
The grid's RowCommand
The code looks as follows---


 Private Sub gvItems_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gvItems.RowCommand
        If e.CommandName = "ItemName" Then
            Dim itemid As Integer = Convert.ToInt16((e.CommandArgument).ToString)
            Response.Redirect("~\Inventory\DataEntry\InventoryItems.aspx?ItemId=" & itemid)
        End If
    End Sub



Here the CommandArgument holds the value 45, which in turn should be assigned to Variable- 'ItemId' with datatype int,
So we should Have ItemId = 45

but what i get is this 



i.e ItemId has Value 'ItemId 45' which is a string!

How the hell  is that happening?
Can anyone help me here?