Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onitemcommand problem

Status
Not open for further replies.

TerryDad2

Programmer
Jul 10, 2002
29
US
I am having difficulty finding out why the onitemcommand doesn't call the RetrieveFile sub when the button is clicked, but does when the onsortcommand is fired. Here is the code.


Sub SortGrid(source As Object, e As DataGridSortCommandEventArgs)
RunQueryAndBind(e.SortExpression)
End Sub
Sub RetrieveFile(sender As Object, e As DataGridCommandEventArgs)
if e.CommandName = "Retrieve" then
...
end if
end sub

<asp:DataGrid id=&quot;grdFiles&quot; runat=&quot;server&quot;
....
onSortCommand=&quot;SortGrid&quot; OnItemCommand=&quot;RetrieveFile&quot;>
<columns>
...
<asp:ButtonColumn HeaderText=&quot;Download&quot;
ButtonType=&quot;PushButton&quot;
Text=&quot;Download&quot;
CommandName=&quot;Retrieve&quot;
/>
</columns>
</asp:DataGrid>
 
Terry: You've hit on a fairly common problem, have seen several posts over the months by folks asking the same thing. Paul(link9) I believed addressed this issue some time in the past but with the search down right now not practical to go look for it.

Replacing the pushbutton with a linkbutton would eliminate your problem but I suppose you'd prefer to have the button, if nothing more than for aesthetic purposes.

Hopefully we can get this answered - I look forward to the solution.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top