I have created a page with a WebImageButton within a WebDataGrid. When the button is pushed, it does a full page postback instead of just the grid. I add the OnItemCommand="grdClasses_ItemCommand" code to my markup and it causes the page to abend. What am I doing wrong? I will attach some of my code behind and the grid markup. Thanks.
Code Behind...
Dim adapter As New SqlClient.SqlDataAdapter(sql.ToString, cn)
Dim ds As DataSet = New DataSet("Classes")
adapter.Fill(ds)
If ds.Tables(0).Rows.Count > 0 Then
With grdClasses
.DataSource = ds
.DataMember =
""
.DataBind()
End With
End If
Mark Up...
<ig:WebDataGrid ID="grdClasses" runat="server" AutoGenerateColumns="False"
EnableDataViewState="True" Height="350px" Width="769px" OnItemCommand="grdClasses_ItemCommand">
<Columns>
<ig:BoundDataField DataFieldName="id" Hidden="True" Key="id">
<Header Text="BoundColumn_0" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="classdate" Key="classdate">
<Header Text="Class Date" />
<ig:BoundDataField DataFieldName="cost" Key="cost" DataFormatString="{0:C}">
<Header Text="Cost" />
<ig:TemplateDataField Key="register">
<ItemTemplate>
<igtxt:WebImageButton ID="cmdClass" runat="server" Text="Register">
</igtxt:WebImageButton>
</ItemTemplate>
<Header Text="Register" />
</ig:TemplateDataField>
</Columns>
</ig:WebDataGrid>
Hi bpabmeyer,
If you have any other questions please feel free to contact me.