I have a Standard .net 2.0 data grid which uses a XMLDatasource. The datasource is set dynamically by passing in XML string to the "Data" property of the XMLdatasource on a button click event.
This workd fine the first time around but not on subsequent button clicks.
i.e. eventhough the xml passed in changes the grid only diplays the initial output.
Is there something i need to do in order to make sure the grid refreshes to show the correct values??
current code
aspx grid code
<asp:GridView ID="GridView1"
Runat="server"
DataSourceID="XmlDataSource5"
AutoGenerateColumns="False" AllowPaging="True"
style="width:100%; height:100%;"
AutoGenerateSelectButton="True"
EnableViewState="False">
<SelectedRowStyle BackColor="Red" />
<Columns>
<asp:BoundField DataField="TYPE" HeaderText="TYPE" SortExpression="TYPE" />
<asp:BoundField DataField="DESCRIPTION" HeaderText="DESCRIPTION" SortExpression="DESCRIPTION" />
</Columns>
</asp:GridView>
vb.net code
Private Sub btnTest_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnTest.Click
XmlDataSource5.Data = _testLib.GetGridXML(_Num)
GridView1.DataBind()
End Sub
where _testLib.GetGridXML is a function that returns an XML string based on the _Num passed in.