2009-07-01 1 views
0

코드에서 수동으로 rowcreated에 생성 된 이미지 버튼이 있습니다.내 rowcommand에 내 gridview에 대한 명령 이름이 없습니다.

Dim deletecshr As ImageButton = DirectCast(e.Row.FindControl("deletecshr"), ImageButton) 
      deletecshr.CommandName = "Delete" 
      deletecshr.CommandArgument = emp_no & "," & e.Row.Cells(2).Text & "," & e.Row.Cells(1).Text & "," & cashier_no & "," & manager_no 

는 내가 명령 이름과 인수를 설정합니다 gridveiw_rowdatabound에서

Dim deletecshr As New ImageButton 
    deletecshr.ImageUrl = "\images\bttnDeletemini.gif" 
    deletecshr.ToolTip = "This Will Delete All Cashiers" 
    deletecshr.ID = "deletecshr" 

나는 다음 있습니다.

그러나 rowcommand에서는 commandname 또는 그 밖의 것이 없습니다. 내가 도대체 ​​뭘 잘못하고있는 겁니까? 나는 이것이 이전에 효과가 있었다고 생각한다.

+0

RowCommand 이벤트를 첨부했는지 기억해 봤습니까? –

+0

무엇을 의미합니까? – Eric

답변

2

나는 당신이 이벤트를 첨부하지 않을 것이라고 말할 수 있습니다.

Protected Sub deletecshrCommandEventHandler(sender As Object, e As CommandEventArgs) 
    If e.CommandName = "Delete" Then 

    'Do your stuff 

    End IF 
End Sub 

편집
추가 좀 더 코드와 작은 구문 오류를 수정 :

Dim deletecshr As New ImageButton 
deletecshr.ImageUrl = "\images\bttnDeletemini.gif" 
deletecshr.ToolTip = "This Will Delete All Cashiers" 
deletecshr.ID = "deletecshr" 
AddHandler deletecshr.Command AddressOf deletecshrCommandEventHandler 

당신은 당신의 코드에서이 유사한 방법을해야합니다.

+0

이것은 작동하지 않았습니다. .RowCommand는 이미지 버튼이라는 것입니다. – Eric

+0

죄송합니다 ... 단지 명령 일뿐입니다 ... –

+0

이것은 꽤 좋은 대답입니다. 나는 인수를 얻을 수 없습니다. – Eric

관련 문제