Ask a Question related to ASP.NET General, Design and Development.
-
James Norton-Jones #1
Putting a string onto a stream to be read into a DataGrid
Hi,
Am I trying to hold the data of a DataGrid in a label so that when the form
is reposted the DataGrid can be repopulated. The problem I am having is that
I don't understand how to get the text into a stream in order to be able to
use DataSetOutcomes1.ReadXML(MyStream).
Thanks in advance,
James
Web Form:
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="course_new.aspx.vb"
Inherits="_1137InsetBookingSystem.course_new"%>
<!-- #INCLUDE file="headeraspx.inc" -->
<!-- #INCLUDE file="tableheader.inc" -->
<form id="FormNewCourse" method="post" runat="server">
<table cellSpacing="0" cols="3" cellPadding="0" width="100%" border="0">
<tr>
<td vAlign="top"><asp:label id="lblCourseTitle" runat="server"
Font-Bold="True">Course Title</asp:label></td>
<td><asp:textbox id="txtCourseTitle" runat="server"></asp:textbox></td>
<td> </td>
</tr>
<tr>
<td colSpan="3"><asp:label id="lblCourseTutorList" runat="server"
Font-Bold="True">Course Tutor(s)</asp:label></td>
</tr>
<tr>
<td vAlign="top"> </td>
<td><asp:textbox id="txtCourseTutor" runat="server"></asp:textbox></td>
<td><asp:button id="cmdAdd" runat="server" Text="Add" BackColor="#F6CD7A"
BorderStyle="Solid" BorderWidth="1px"
Width="80px"></asp:button></td>
</tr>
<tr>
<td> </td>
<td><asp:textbox id="txtTutorList" runat="server" Rows="5"
TextMode="MultiLine"></asp:textbox></td>
<td> </td>
</tr>
<tr>
<td colSpan="3"><asp:label id="lblLearningOutcomes" runat="server"
Font-Bold="True">Learning Outcomes</asp:label></td>
</TD></tr>
<tr>
<td> </td>
<td><asp:textbox id="txtOutcome" runat="server"></asp:textbox></td>
<td><asp:button id="cmdAddOutcome" runat="server" Text="Add"
BackColor="#F6CD7A" BorderStyle="Solid"
BorderWidth="1px" Width="80px"
CausesValidation="False"></asp:button></td>
</tr>
<tr>
<td> </td>
<td><asp:datagrid id=DataGridOutcomes runat="server" GridLines="None"
AutoGenerateColumns="False" DataMember="Outcomes" DataSource="<%#
DatasetOutcomes1 %>">
<HeaderStyle Font-Bold="True"></HeaderStyle>
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<ul>
<li>
</li>
</ul>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="Name" SortExpression="Name"
HeaderText="Name"></asp:BoundColumn>
<asp:BoundColumn DataField="DisplayOrder"
SortExpression="DisplayOrder" HeaderText="DisplayOrder"></asp:BoundColumn>
<asp:ButtonColumn Text="Delete"
ButtonType="PushButton"></asp:ButtonColumn>
<asp:ButtonColumn Text="Edit"
ButtonType="PushButton"></asp:ButtonColumn>
</Columns>
</asp:datagrid></td>
<td> </td>
</tr>
<tr>
<td colSpan="3"><asp:label id="lblOutcomes"
runat="server"></asp:label></td>
</tr>
</table>
</form>
<!-- #INCLUDE file="tablefooter.inc" -->
<!-- #INCLUDE file="footer.inc" -->
Code Bind:
Imports System
Imports System.IO
Imports System.Xml
Public Class course_new
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.DatasetOutcomes1 = New _1137InsetBookingSystem.DatasetOutcomes
CType(Me.DatasetOutcomes1,
System.ComponentModel.ISupportInitialize).BeginIni t()
'
'DatasetOutcomes1
'
Me.DatasetOutcomes1.DataSetName = "DatasetOutcomes"
Me.DatasetOutcomes1.Locale = New
System.Globalization.CultureInfo("en-GB")
CType(Me.DatasetOutcomes1,
System.ComponentModel.ISupportInitialize).EndInit( )
End Sub
Protected WithEvents lblCourseTitle As System.Web.UI.WebControls.Label
Protected WithEvents txtCourseTitle As System.Web.UI.WebControls.TextBox
Protected WithEvents txtCourseTutor As System.Web.UI.WebControls.TextBox
Protected WithEvents txtTutorList As System.Web.UI.WebControls.TextBox
Protected WithEvents cmdAdd As System.Web.UI.WebControls.Button
Protected WithEvents txtOutcome As System.Web.UI.WebControls.TextBox
Protected WithEvents cmdAddOutcome As System.Web.UI.WebControls.Button
Protected WithEvents lblCourseTutorList As
System.Web.UI.WebControls.Label
Protected WithEvents lblLearningOutcomes As
System.Web.UI.WebControls.Label
Protected WithEvents DataGridOutcomes As
System.Web.UI.WebControls.DataGrid
Protected WithEvents DatasetOutcomes1 As
_1137InsetBookingSystem.DatasetOutcomes
Protected WithEvents lblOutcomes As System.Web.UI.WebControls.Label
'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Public gstrTableTitle As String = "Create Course"
Public gstrTableAttribs As String
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not Page.IsPostBack Then
Me.DataGridOutcomes.DataBind()
Else
Dim str As String = Me.lblOutcomes.Text
Dim MyStream As StreamReader
If str.Length > 0 Then
MyStream = New StreamReader(str)
Me.DatasetOutcomes1.ReadXml(MyStream)
End If
'Me.DatasetOutcomes1.GetXml()
'
End If
End Sub
Private Sub UpdateOutcomes()
Me.DataGridOutcomes.DataSource = Me.DatasetOutcomes1
Me.DataGridOutcomes.DataBind()
End Sub
Private Sub cmdAdd_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdAdd.Click
If InStr(Me.txtTutorList.Text, Me.txtCourseTutor.Text) < 1 Then
If Me.txtTutorList.Text.Length > 0 Then
Me.txtTutorList.Text = Me.txtTutorList.Text & ";" & vbCrLf &
Me.txtCourseTutor.Text
Else
Me.txtTutorList.Text = Me.txtCourseTutor.Text
End If
End If
End Sub
Private Sub cmdAddOutcome_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles cmdAddOutcome.Click
Dim dr As DatasetOutcomes.OutcomesRow
dr = Me.DatasetOutcomes1.Outcomes.NewRow()
dr.Item("Name") = Me.txtOutcome.Text
dr.Item("DisplayOrder") = Me.DatasetOutcomes1.Outcomes.Rows.Count
'DatasetOutcomes1.Outcomes.Rows.InsertAt(dr,
Me.DatasetOutcomes1.Outcomes.Rows.Count)
DatasetOutcomes1.Outcomes.Rows.Add(dr)
Me.DataGridOutcomes.DataBind()
Me.lblOutcomes.Text = Me.DatasetOutcomes1.GetXml
End Sub
End Class
James Norton-Jones Guest
-
Putting an image in the footer of a datagrid.
Is there anyway to put an image in the footer of a bound column in a datagrid ? TIA Jeffrey. -
putting a DataGrid Item in a web user control into Editmode from the parent page.
Hello I am trying to put a Datagrid which is in a web user control into edit mode from the parent page. Basically I am doing this... in... -
Replicate rows problem. (TXH CDR:45 Error: Could not read from received stream)
Hi. I have replicate source-tables to target-tables. Some records not replicates. In ATS file i see such error: TXH Source ID:21 /... -
Putting several peices of data in each cell of a datagrid
You might want to concatenate the fields at the SQL Query level. If you really want to do the combining at the datagrid level then you could indeed... -
Upload file and read contents from the stream?
I would like to provide an interface for users to upload a csv (or other text file). I would like to read the contents of the CSV while it is... -
John Saunders #2
Re: Putting a string onto a stream to be read into a DataGrid
Most of the time, your code can follow this pattern:
Private Sub Page_Load(ByVal sender As System.Object, ByVal a As
System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
myDataSet = GetDataSetSomeHow()
myDataGrid.DataSource = myDataSet
myDataGrid.DataMember = "FirstTable"
DataBind()
End If
End Sub
When the page is posted back, the grid (or other controls) will populate
itself from ViewState.
--
John Saunders
Internet Engineer
[email]john.saunders@surfcontrol.com[/email]
"James Norton-Jones" <james.norton-jones@stopford.com> wrote in message
news:3f28da96$0$25420$afc38c87@news.easynet.co.uk. ..form> Hi,
>
> Am I trying to hold the data of a DataGrid in a label so that when thethat> is reposted the DataGrid can be repopulated. The problem I am having isto> I don't understand how to get the text into a stream in order to be ableBackColor="#F6CD7A"> use DataSetOutcomes1.ReadXML(MyStream).
>
> Thanks in advance,
>
> James
>
>
> Web Form:
>
> <%@ Page Language="vb" AutoEventWireup="false"
> Codebehind="course_new.aspx.vb"
> Inherits="_1137InsetBookingSystem.course_new"%>
> <!-- #INCLUDE file="headeraspx.inc" -->
> <!-- #INCLUDE file="tableheader.inc" -->
> <form id="FormNewCourse" method="post" runat="server">
> <table cellSpacing="0" cols="3" cellPadding="0" width="100%" border="0">
> <tr>
> <td vAlign="top"><asp:label id="lblCourseTitle" runat="server"
> Font-Bold="True">Course Title</asp:label></td>
> <td><asp:textbox id="txtCourseTitle" runat="server"></asp:textbox></td>
> <td> </td>
> </tr>
> <tr>
> <td colSpan="3"><asp:label id="lblCourseTutorList" runat="server"
> Font-Bold="True">Course Tutor(s)</asp:label></td>
> </tr>
> <tr>
> <td vAlign="top"> </td>
> <td><asp:textbox id="txtCourseTutor" runat="server"></asp:textbox></td>
> <td><asp:button id="cmdAdd" runat="server" Text="Add"System.Web.UI.WebControls.TextBox> BorderStyle="Solid" BorderWidth="1px"
> Width="80px"></asp:button></td>
> </tr>
> <tr>
> <td> </td>
> <td><asp:textbox id="txtTutorList" runat="server" Rows="5"
> TextMode="MultiLine"></asp:textbox></td>
> <td> </td>
> </tr>
> <tr>
> <td colSpan="3"><asp:label id="lblLearningOutcomes" runat="server"
> Font-Bold="True">Learning Outcomes</asp:label></td>
> </TD></tr>
> <tr>
> <td> </td>
> <td><asp:textbox id="txtOutcome" runat="server"></asp:textbox></td>
> <td><asp:button id="cmdAddOutcome" runat="server" Text="Add"
> BackColor="#F6CD7A" BorderStyle="Solid"
> BorderWidth="1px" Width="80px"
> CausesValidation="False"></asp:button></td>
> </tr>
> <tr>
> <td> </td>
> <td><asp:datagrid id=DataGridOutcomes runat="server" GridLines="None"
> AutoGenerateColumns="False" DataMember="Outcomes" DataSource="<%#
> DatasetOutcomes1 %>">
> <HeaderStyle Font-Bold="True"></HeaderStyle>
> <Columns>
> <asp:TemplateColumn>
> <ItemTemplate>
> <ul>
> <li>
> </li>
> </ul>
> </ItemTemplate>
> </asp:TemplateColumn>
> <asp:BoundColumn DataField="Name" SortExpression="Name"
> HeaderText="Name"></asp:BoundColumn>
> <asp:BoundColumn DataField="DisplayOrder"
> SortExpression="DisplayOrder" HeaderText="DisplayOrder"></asp:BoundColumn>
> <asp:ButtonColumn Text="Delete"
> ButtonType="PushButton"></asp:ButtonColumn>
> <asp:ButtonColumn Text="Edit"
> ButtonType="PushButton"></asp:ButtonColumn>
> </Columns>
> </asp:datagrid></td>
> <td> </td>
> </tr>
> <tr>
> <td colSpan="3"><asp:label id="lblOutcomes"
> runat="server"></asp:label></td>
> </tr>
> </table>
> </form>
> <!-- #INCLUDE file="tablefooter.inc" -->
> <!-- #INCLUDE file="footer.inc" -->
>
>
> Code Bind:
>
> Imports System
> Imports System.IO
> Imports System.Xml
>
>
> Public Class course_new
> Inherits System.Web.UI.Page
>
> #Region " Web Form Designer Generated Code "
>
> 'This call is required by the Web Form Designer.
> <System.Diagnostics.DebuggerStepThrough()> Private Sub
> InitializeComponent()
> Me.DatasetOutcomes1 = New _1137InsetBookingSystem.DatasetOutcomes
> CType(Me.DatasetOutcomes1,
> System.ComponentModel.ISupportInitialize).BeginIni t()
> '
> 'DatasetOutcomes1
> '
> Me.DatasetOutcomes1.DataSetName = "DatasetOutcomes"
> Me.DatasetOutcomes1.Locale = New
> System.Globalization.CultureInfo("en-GB")
> CType(Me.DatasetOutcomes1,
> System.ComponentModel.ISupportInitialize).EndInit( )
>
> End Sub
> Protected WithEvents lblCourseTitle As System.Web.UI.WebControls.Label
> Protected WithEvents txtCourseTitle AsSystem.Web.UI.WebControls.TextBox> Protected WithEvents txtCourseTutor AsForm> Protected WithEvents txtTutorList As System.Web.UI.WebControls.TextBox
> Protected WithEvents cmdAdd As System.Web.UI.WebControls.Button
> Protected WithEvents txtOutcome As System.Web.UI.WebControls.TextBox
> Protected WithEvents cmdAddOutcome As System.Web.UI.WebControls.Button
> Protected WithEvents lblCourseTutorList As
> System.Web.UI.WebControls.Label
> Protected WithEvents lblLearningOutcomes As
> System.Web.UI.WebControls.Label
> Protected WithEvents DataGridOutcomes As
> System.Web.UI.WebControls.DataGrid
> Protected WithEvents DatasetOutcomes1 As
> _1137InsetBookingSystem.DatasetOutcomes
> Protected WithEvents lblOutcomes As System.Web.UI.WebControls.Label
>
> 'NOTE: The following placeholder declaration is required by the Web&> Designer.
> 'Do not delete or move it.
> Private designerPlaceholderDeclaration As System.Object
>
> Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Init
> 'CODEGEN: This method call is required by the Web Form Designer
> 'Do not modify it using the code editor.
> InitializeComponent()
> End Sub
>
> #End Region
> Public gstrTableTitle As String = "Create Course"
> Public gstrTableAttribs As String
>
> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
> 'Put user code to initialize the page here
> If Not Page.IsPostBack Then
> Me.DataGridOutcomes.DataBind()
> Else
> Dim str As String = Me.lblOutcomes.Text
> Dim MyStream As StreamReader
>
> If str.Length > 0 Then
> MyStream = New StreamReader(str)
> Me.DatasetOutcomes1.ReadXml(MyStream)
>
> End If
>
>
>
> 'Me.DatasetOutcomes1.GetXml()
> '
>
> End If
> End Sub
>
> Private Sub UpdateOutcomes()
> Me.DataGridOutcomes.DataSource = Me.DatasetOutcomes1
> Me.DataGridOutcomes.DataBind()
> End Sub
>
> Private Sub cmdAdd_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles cmdAdd.Click
>
> If InStr(Me.txtTutorList.Text, Me.txtCourseTutor.Text) < 1 Then
> If Me.txtTutorList.Text.Length > 0 Then
> Me.txtTutorList.Text = Me.txtTutorList.Text & ";" & vbCrLf> Me.txtCourseTutor.Text
> Else
> Me.txtTutorList.Text = Me.txtCourseTutor.Text
> End If
> End If
> End Sub
>
> Private Sub cmdAddOutcome_Click(ByVal sender As System.Object, ByVal e
> As System.EventArgs) Handles cmdAddOutcome.Click
> Dim dr As DatasetOutcomes.OutcomesRow
>
> dr = Me.DatasetOutcomes1.Outcomes.NewRow()
> dr.Item("Name") = Me.txtOutcome.Text
> dr.Item("DisplayOrder") = Me.DatasetOutcomes1.Outcomes.Rows.Count
> 'DatasetOutcomes1.Outcomes.Rows.InsertAt(dr,
> Me.DatasetOutcomes1.Outcomes.Rows.Count)
>
> DatasetOutcomes1.Outcomes.Rows.Add(dr)
> Me.DataGridOutcomes.DataBind()
>
> Me.lblOutcomes.Text = Me.DatasetOutcomes1.GetXml
>
> End Sub
>
> End Class
>
>
>
John Saunders Guest
-
James Norton-Jones #3
Re: Putting a string onto a stream to be read into a DataGrid
DatasetCourse is linked to an xml schema to define the data structure and
the data its self is an xml doc. There is no database behind it, hence the
need to repopulate from the xml data on postback.
Schema:
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="DatasetOutcomes"
targetNamespace="http://tempuri.org/DatasetOutcomes.xsd"
elementFormDefault="qualified"
attributeFormDefault="qualified"
xmlns="http://http://localhost/1137InsetBookingSystem/DatasetOutcomes.xsd"
xmlns:mstns="http://tempuri.org/DatasetOutcomes.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="DatasetOutcomes" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="Outcomes">
<xs:complexType>
<xs:sequence>
<xs:element name="Description" type="xs:string" minOccurs="0" />
<xs:element name="DisplayOrder" type="xs:int" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:key name="DatasetOutcomesKey1" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:Outcomes" />
<xs:field xpath="mstns:Description" />
</xs:key>
</xs:element>
</xs:schema>
"John Saunders" <john.saunders@surfcontrol.com> wrote in message
news:u1L3ox2VDHA.1600@TK2MSFTNGP09.phx.gbl...populate> James,
>
> I'm glad you solved your problem, but I'm wondering how you use
> DatasetCourse on postbacks?
> --
> John Saunders
> Internet Engineer
> [email]john.saunders@surfcontrol.com[/email]
>
> "James Norton-Jones" <james.norton-jones@stopford.com> wrote in message
> news:3f28fa69$0$25429$afc38c87@news.easynet.co.uk. ..> > Managed to solve it using:
> > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles MyBase.Load
> > 'Put user code to initialize the page here
> > If Not Page.IsPostBack Then
> >
> > Me.DataGridOutcomes.DataBind()
> > Else
> > 'Create the XML fragment to be parsed.
> > Dim xmlFrag As String = Me.lblOutcomes.Text
> >
> > If xmlFrag.Length > 0 Then
> >
> > 'Create the XmlNamespaceManager.
> > Dim nt As NameTable = New NameTable
> > Dim nsmgr As XmlNamespaceManager = New
> > XmlNamespaceManager(nt)
> >
> > 'Create the XmlParserContext.
> > Dim context As XmlParserContext = New
> > XmlParserContext(Nothing, nsmgr, Nothing, XmlSpace.None)
> >
> > 'Create the reader.
> > Dim xmlTR As XmlTextReader = New XmlTextReader(xmlFrag,
> > XmlNodeType.Element, context)
> >
> > Me.DatasetCourse.ReadXml(xmlTR)
> >
> > End If
> > End If
> > End Sub
> >
> >
> > "John Saunders" <john.saunders@surfcontrol.com> wrote in message
> > news:OPTf5I1VDHA.1832@TK2MSFTNGP09.phx.gbl...> > > Most of the time, your code can follow this pattern:
> > >
> > > Private Sub Page_Load(ByVal sender As System.Object, ByVal a As
> > > System.EventArgs) Handles MyBase.Load
> > > If Not Page.IsPostBack Then
> > > myDataSet = GetDataSetSomeHow()
> > > myDataGrid.DataSource = myDataSet
> > > myDataGrid.DataMember = "FirstTable"
> > >
> > > DataBind()
> > > End If
> > > End Sub
> > >
> > > When the page is posted back, the grid (or other controls) willmessage> > > itself from ViewState.
> > > --
> > > John Saunders
> > > Internet Engineer
> > > [email]john.saunders@surfcontrol.com[/email]
> > >
> > >
> > > "James Norton-Jones" <james.norton-jones@stopford.com> wrote inthe> > > news:3f28da96$0$25420$afc38c87@news.easynet.co.uk. ..
> > > > Hi,
> > > >
> > > > Am I trying to hold the data of a DataGrid in a label so that whenrunat="server"> is> > > form
> > > > is reposted the DataGrid can be repopulated. The problem I am having> able> > > that
> > > > I don't understand how to get the text into a stream in order to be> > border="0">> > > to
> > > > use DataSetOutcomes1.ReadXML(MyStream).
> > > >
> > > > Thanks in advance,
> > > >
> > > > James
> > > >
> > > >
> > > > Web Form:
> > > >
> > > > <%@ Page Language="vb" AutoEventWireup="false"
> > > > Codebehind="course_new.aspx.vb"
> > > > Inherits="_1137InsetBookingSystem.course_new"%>
> > > > <!-- #INCLUDE file="headeraspx.inc" -->
> > > > <!-- #INCLUDE file="tableheader.inc" -->
> > > > <form id="FormNewCourse" method="post" runat="server">
> > > > <table cellSpacing="0" cols="3" cellPadding="0" width="100%"> > runat="server"></asp:textbox></td>> > > > <tr>
> > > > <td vAlign="top"><asp:label id="lblCourseTitle" runat="server"
> > > > Font-Bold="True">Course Title</asp:label></td>
> > > > <td><asp:textbox id="txtCourseTitle"> > runat="server"></asp:textbox></td>> > > > <td> </td>
> > > > </tr>
> > > > <tr>
> > > > <td colSpan="3"><asp:label id="lblCourseTutorList" runat="server"
> > > > Font-Bold="True">Course Tutor(s)</asp:label></td>
> > > > </tr>
> > > > <tr>
> > > > <td vAlign="top"> </td>
> > > > <td><asp:textbox id="txtCourseTutor"> > > > <td><asp:button id="cmdAdd" runat="server" Text="Add"
> > > BackColor="#F6CD7A"
> > > > BorderStyle="Solid" BorderWidth="1px"
> > > > Width="80px"></asp:button></td>
> > > > </tr>
> > > > <tr>
> > > > <td> </td>
> > > > <td><asp:textbox id="txtTutorList" runat="server" Rows="5"
> > > > TextMode="MultiLine"></asp:textbox></td>
> > > > <td> </td>
> > > > </tr>
> > > > <tr>
> > > > <td colSpan="3"><asp:label id="lblLearningOutcomes"runat="server"></asp:textbox></td>> > > > Font-Bold="True">Learning Outcomes</asp:label></td>
> > > > </TD></tr>
> > > > <tr>
> > > > <td> </td>
> > > > <td><asp:textbox id="txtOutcome"As> GridLines="None"> > > > <td><asp:button id="cmdAddOutcome" runat="server" Text="Add"
> > > > BackColor="#F6CD7A" BorderStyle="Solid"
> > > > BorderWidth="1px" Width="80px"
> > > > CausesValidation="False"></asp:button></td>
> > > > </tr>
> > > > <tr>
> > > > <td> </td>
> > > > <td><asp:datagrid id=DataGridOutcomes runat="server"> System.Web.UI.WebControls.TextBox> > HeaderText="DisplayOrder"></asp:BoundColumn>> > > > AutoGenerateColumns="False" DataMember="Outcomes" DataSource="<%#
> > > > DatasetOutcomes1 %>">
> > > > <HeaderStyle Font-Bold="True"></HeaderStyle>
> > > > <Columns>
> > > > <asp:TemplateColumn>
> > > > <ItemTemplate>
> > > > <ul>
> > > > <li>
> > > > </li>
> > > > </ul>
> > > > </ItemTemplate>
> > > > </asp:TemplateColumn>
> > > > <asp:BoundColumn DataField="Name" SortExpression="Name"
> > > > HeaderText="Name"></asp:BoundColumn>
> > > > <asp:BoundColumn DataField="DisplayOrder"
> > > > SortExpression="DisplayOrder"> > _1137InsetBookingSystem.DatasetOutcomes> > > > <asp:ButtonColumn Text="Delete"
> > > > ButtonType="PushButton"></asp:ButtonColumn>
> > > > <asp:ButtonColumn Text="Edit"
> > > > ButtonType="PushButton"></asp:ButtonColumn>
> > > > </Columns>
> > > > </asp:datagrid></td>
> > > > <td> </td>
> > > > </tr>
> > > > <tr>
> > > > <td colSpan="3"><asp:label id="lblOutcomes"
> > > > runat="server"></asp:label></td>
> > > > </tr>
> > > > </table>
> > > > </form>
> > > > <!-- #INCLUDE file="tablefooter.inc" -->
> > > > <!-- #INCLUDE file="footer.inc" -->
> > > >
> > > >
> > > > Code Bind:
> > > >
> > > > Imports System
> > > > Imports System.IO
> > > > Imports System.Xml
> > > >
> > > >
> > > > Public Class course_new
> > > > Inherits System.Web.UI.Page
> > > >
> > > > #Region " Web Form Designer Generated Code "
> > > >
> > > > 'This call is required by the Web Form Designer.
> > > > <System.Diagnostics.DebuggerStepThrough()> Private Sub
> > > > InitializeComponent()
> > > > Me.DatasetOutcomes1 = New> > System.Web.UI.WebControls.Label> > > > CType(Me.DatasetOutcomes1,
> > > > System.ComponentModel.ISupportInitialize).BeginIni t()
> > > > '
> > > > 'DatasetOutcomes1
> > > > '
> > > > Me.DatasetOutcomes1.DataSetName = "DatasetOutcomes"
> > > > Me.DatasetOutcomes1.Locale = New
> > > > System.Globalization.CultureInfo("en-GB")
> > > > CType(Me.DatasetOutcomes1,
> > > > System.ComponentModel.ISupportInitialize).EndInit( )
> > > >
> > > > End Sub
> > > > Protected WithEvents lblCourseTitle As> > System.Web.UI.WebControls.TextBox> > > > Protected WithEvents txtCourseTitle As
> > > System.Web.UI.WebControls.TextBox
> > > > Protected WithEvents txtCourseTutor As
> > > System.Web.UI.WebControls.TextBox
> > > > Protected WithEvents txtTutorList As> > > > Protected WithEvents cmdAdd As System.Web.UI.WebControls.Button
> > > > Protected WithEvents txtOutcome As> System.Web.UI.WebControls.Label> > System.Web.UI.WebControls.Button> > > > Protected WithEvents cmdAddOutcome As> > > > Protected WithEvents lblCourseTutorList As
> > > > System.Web.UI.WebControls.Label
> > > > Protected WithEvents lblLearningOutcomes As
> > > > System.Web.UI.WebControls.Label
> > > > Protected WithEvents DataGridOutcomes As
> > > > System.Web.UI.WebControls.DataGrid
> > > > Protected WithEvents DatasetOutcomes1 As
> > > > _1137InsetBookingSystem.DatasetOutcomes
> > > > Protected WithEvents lblOutcomes As> Web> > > >
> > > > 'NOTE: The following placeholder declaration is required by the> Designer> > > Form
> > > > Designer.
> > > > 'Do not delete or move it.
> > > > Private designerPlaceholderDeclaration As System.Object
> > > >
> > > > Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
> > > > System.EventArgs) Handles MyBase.Init
> > > > 'CODEGEN: This method call is required by the Web Form> > > > 'Do not modify it using the code editor.
> > > > InitializeComponent()
> > > > End Sub
> > > >
> > > > #End Region
> > > > Public gstrTableTitle As String = "Create Course"
> > > > Public gstrTableAttribs As String
> > > >
> > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> > > > System.EventArgs) Handles MyBase.Load
> > > > 'Put user code to initialize the page here
> > > > If Not Page.IsPostBack Then
> > > > Me.DataGridOutcomes.DataBind()
> > > > Else
> > > > Dim str As String = Me.lblOutcomes.Text
> > > > Dim MyStream As StreamReader
> > > >
> > > > If str.Length > 0 Then
> > > > MyStream = New StreamReader(str)
> > > > Me.DatasetOutcomes1.ReadXml(MyStream)
> > > >
> > > > End If
> > > >
> > > >
> > > >
> > > > 'Me.DatasetOutcomes1.GetXml()
> > > > '
> > > >
> > > > End If
> > > > End Sub
> > > >
> > > > Private Sub UpdateOutcomes()
> > > > Me.DataGridOutcomes.DataSource = Me.DatasetOutcomes1
> > > > Me.DataGridOutcomes.DataBind()
> > > > End Sub
> > > >
> > > > Private Sub cmdAdd_Click(ByVal sender As System.Object, ByVal e> Then> > > > System.EventArgs) Handles cmdAdd.Click
> > > >
> > > > If InStr(Me.txtTutorList.Text, Me.txtCourseTutor.Text) < 1> ByVal> > vbCrLf> > > > If Me.txtTutorList.Text.Length > 0 Then
> > > > Me.txtTutorList.Text = Me.txtTutorList.Text & ";" &> > > &
> > > > Me.txtCourseTutor.Text
> > > > Else
> > > > Me.txtTutorList.Text = Me.txtCourseTutor.Text
> > > > End If
> > > > End If
> > > > End Sub
> > > >
> > > > Private Sub cmdAddOutcome_Click(ByVal sender As System.Object,>> > e> > Me.DatasetOutcomes1.Outcomes.Rows.Count> > > > As System.EventArgs) Handles cmdAddOutcome.Click
> > > > Dim dr As DatasetOutcomes.OutcomesRow
> > > >
> > > > dr = Me.DatasetOutcomes1.Outcomes.NewRow()
> > > > dr.Item("Name") = Me.txtOutcome.Text
> > > > dr.Item("DisplayOrder") => >> > > > 'DatasetOutcomes1.Outcomes.Rows.InsertAt(dr,
> > > > Me.DatasetOutcomes1.Outcomes.Rows.Count)
> > > >
> > > > DatasetOutcomes1.Outcomes.Rows.Add(dr)
> > > > Me.DataGridOutcomes.DataBind()
> > > >
> > > > Me.lblOutcomes.Text = Me.DatasetOutcomes1.GetXml
> > > >
> > > > End Sub
> > > >
> > > > End Class
> > > >
> > > >
> > > >
> > >
> > >
> >
>
James Norton-Jones Guest
-
John Saunders #4
Re: Putting a string onto a stream to be read into a DataGrid
Ok, I don't think I've ever used an updateable XML file yet, so I didn't see
that. In order to update even a single row, you have to read in the entire
file.
Please pardon me for being dense, was your question ever actually answered?
:-)
If I were you, I think I'd store DatasetCourse in Session state. On the
other hand, if you're going to be making multiple changes to the data per
session, I think I'd keep it in Session, but flush to disk whenever a change
was made. That way, if the session expires (seen as Session("DatasetCourse")
Is Nothing), then you can re-load it from the disk file (which you'll need
to uniquely name, without resorting to the Session ID!)
--
John Saunders
Internet Engineer
[email]john.saunders@surfcontrol.com[/email]
"James Norton-Jones" <james.norton-jones@stopford.com> wrote in message
news:3f2a3163$0$25422$afc38c87@news.easynet.co.uk. ..XmlTextReader(xmlFrag,> DatasetCourse is linked to an xml schema to define the data structure and
> the data its self is an xml doc. There is no database behind it, hence the
> need to repopulate from the xml data on postback.
>
>
> Schema:
> <?xml version="1.0" encoding="utf-8" ?>
> <xs:schema id="DatasetOutcomes"
> targetNamespace="http://tempuri.org/DatasetOutcomes.xsd"
> elementFormDefault="qualified"
> attributeFormDefault="qualified"
> xmlns="http://http://localhost/1137InsetBookingSystem/DatasetOutcomes.xsd"
> xmlns:mstns="http://tempuri.org/DatasetOutcomes.xsd"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
> <xs:element name="DatasetOutcomes" msdata:IsDataSet="true">
> <xs:complexType>
> <xs:choice maxOccurs="unbounded">
> <xs:element name="Outcomes">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="Description" type="xs:string" minOccurs="0" />
> <xs:element name="DisplayOrder" type="xs:int" minOccurs="0" />
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:choice>
> </xs:complexType>
> <xs:key name="DatasetOutcomesKey1" msdata:PrimaryKey="true">
> <xs:selector xpath=".//mstns:Outcomes" />
> <xs:field xpath="mstns:Description" />
> </xs:key>
> </xs:element>
> </xs:schema>
>
>
> "John Saunders" <john.saunders@surfcontrol.com> wrote in message
> news:u1L3ox2VDHA.1600@TK2MSFTNGP09.phx.gbl...> > James,
> >
> > I'm glad you solved your problem, but I'm wondering how you use
> > DatasetCourse on postbacks?
> > --
> > John Saunders
> > Internet Engineer
> > [email]john.saunders@surfcontrol.com[/email]
> >
> > "James Norton-Jones" <james.norton-jones@stopford.com> wrote in message
> > news:3f28fa69$0$25429$afc38c87@news.easynet.co.uk. ..> > > Managed to solve it using:
> > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> > > System.EventArgs) Handles MyBase.Load
> > > 'Put user code to initialize the page here
> > > If Not Page.IsPostBack Then
> > >
> > > Me.DataGridOutcomes.DataBind()
> > > Else
> > > 'Create the XML fragment to be parsed.
> > > Dim xmlFrag As String = Me.lblOutcomes.Text
> > >
> > > If xmlFrag.Length > 0 Then
> > >
> > > 'Create the XmlNamespaceManager.
> > > Dim nt As NameTable = New NameTable
> > > Dim nsmgr As XmlNamespaceManager = New
> > > XmlNamespaceManager(nt)
> > >
> > > 'Create the XmlParserContext.
> > > Dim context As XmlParserContext = New
> > > XmlParserContext(Nothing, nsmgr, Nothing, XmlSpace.None)
> > >
> > > 'Create the reader.
> > > Dim xmlTR As XmlTextReader = Newhaving> populate> > > XmlNodeType.Element, context)
> > >
> > > Me.DatasetCourse.ReadXml(xmlTR)
> > >
> > > End If
> > > End If
> > > End Sub
> > >
> > >
> > > "John Saunders" <john.saunders@surfcontrol.com> wrote in message
> > > news:OPTf5I1VDHA.1832@TK2MSFTNGP09.phx.gbl...
> > > > Most of the time, your code can follow this pattern:
> > > >
> > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal a As
> > > > System.EventArgs) Handles MyBase.Load
> > > > If Not Page.IsPostBack Then
> > > > myDataSet = GetDataSetSomeHow()
> > > > myDataGrid.DataSource = myDataSet
> > > > myDataGrid.DataMember = "FirstTable"
> > > >
> > > > DataBind()
> > > > End If
> > > > End Sub
> > > >
> > > > When the page is posted back, the grid (or other controls) will> message> > > > itself from ViewState.
> > > > --
> > > > John Saunders
> > > > Internet Engineer
> > > > [email]john.saunders@surfcontrol.com[/email]
> > > >
> > > >
> > > > "James Norton-Jones" <james.norton-jones@stopford.com> wrote in> the> > > > news:3f28da96$0$25420$afc38c87@news.easynet.co.uk. ..
> > > > > Hi,
> > > > >
> > > > > Am I trying to hold the data of a DataGrid in a label so that when> > > > form
> > > > > is reposted the DataGrid can be repopulated. The problem I ambe> > is> > > > that
> > > > > I don't understand how to get the text into a stream in order torunat="server"> > able> > > > to
> > > > > use DataSetOutcomes1.ReadXML(MyStream).
> > > > >
> > > > > Thanks in advance,
> > > > >
> > > > > James
> > > > >
> > > > >
> > > > > Web Form:
> > > > >
> > > > > <%@ Page Language="vb" AutoEventWireup="false"
> > > > > Codebehind="course_new.aspx.vb"
> > > > > Inherits="_1137InsetBookingSystem.course_new"%>
> > > > > <!-- #INCLUDE file="headeraspx.inc" -->
> > > > > <!-- #INCLUDE file="tableheader.inc" -->
> > > > > <form id="FormNewCourse" method="post" runat="server">
> > > > > <table cellSpacing="0" cols="3" cellPadding="0" width="100%"
> > > border="0">
> > > > > <tr>
> > > > > <td vAlign="top"><asp:label id="lblCourseTitle" runat="server"
> > > > > Font-Bold="True">Course Title</asp:label></td>
> > > > > <td><asp:textbox id="txtCourseTitle"
> > > runat="server"></asp:textbox></td>
> > > > > <td> </td>
> > > > > </tr>
> > > > > <tr>
> > > > > <td colSpan="3"><asp:label id="lblCourseTutorList"System.Web.UI.WebControls.Button> runat="server"> > > > > Font-Bold="True">Course Tutor(s)</asp:label></td>
> > > > > </tr>
> > > > > <tr>
> > > > > <td vAlign="top"> </td>
> > > > > <td><asp:textbox id="txtCourseTutor"
> > > runat="server"></asp:textbox></td>
> > > > > <td><asp:button id="cmdAdd" runat="server" Text="Add"
> > > > BackColor="#F6CD7A"
> > > > > BorderStyle="Solid" BorderWidth="1px"
> > > > > Width="80px"></asp:button></td>
> > > > > </tr>
> > > > > <tr>
> > > > > <td> </td>
> > > > > <td><asp:textbox id="txtTutorList" runat="server" Rows="5"
> > > > > TextMode="MultiLine"></asp:textbox></td>
> > > > > <td> </td>
> > > > > </tr>
> > > > > <tr>
> > > > > <td colSpan="3"><asp:label id="lblLearningOutcomes"> runat="server"></asp:textbox></td>> > > > > Font-Bold="True">Learning Outcomes</asp:label></td>
> > > > > </TD></tr>
> > > > > <tr>
> > > > > <td> </td>
> > > > > <td><asp:textbox id="txtOutcome"> > GridLines="None"> > > > > <td><asp:button id="cmdAddOutcome" runat="server" Text="Add"
> > > > > BackColor="#F6CD7A" BorderStyle="Solid"
> > > > > BorderWidth="1px" Width="80px"
> > > > > CausesValidation="False"></asp:button></td>
> > > > > </tr>
> > > > > <tr>
> > > > > <td> </td>
> > > > > <td><asp:datagrid id=DataGridOutcomes runat="server"> > > > > AutoGenerateColumns="False" DataMember="Outcomes" DataSource="<%#
> > > > > DatasetOutcomes1 %>">
> > > > > <HeaderStyle Font-Bold="True"></HeaderStyle>
> > > > > <Columns>
> > > > > <asp:TemplateColumn>
> > > > > <ItemTemplate>
> > > > > <ul>
> > > > > <li>
> > > > > </li>
> > > > > </ul>
> > > > > </ItemTemplate>
> > > > > </asp:TemplateColumn>
> > > > > <asp:BoundColumn DataField="Name" SortExpression="Name"
> > > > > HeaderText="Name"></asp:BoundColumn>
> > > > > <asp:BoundColumn DataField="DisplayOrder"
> > > > > SortExpression="DisplayOrder"
> > > HeaderText="DisplayOrder"></asp:BoundColumn>
> > > > > <asp:ButtonColumn Text="Delete"
> > > > > ButtonType="PushButton"></asp:ButtonColumn>
> > > > > <asp:ButtonColumn Text="Edit"
> > > > > ButtonType="PushButton"></asp:ButtonColumn>
> > > > > </Columns>
> > > > > </asp:datagrid></td>
> > > > > <td> </td>
> > > > > </tr>
> > > > > <tr>
> > > > > <td colSpan="3"><asp:label id="lblOutcomes"
> > > > > runat="server"></asp:label></td>
> > > > > </tr>
> > > > > </table>
> > > > > </form>
> > > > > <!-- #INCLUDE file="tablefooter.inc" -->
> > > > > <!-- #INCLUDE file="footer.inc" -->
> > > > >
> > > > >
> > > > > Code Bind:
> > > > >
> > > > > Imports System
> > > > > Imports System.IO
> > > > > Imports System.Xml
> > > > >
> > > > >
> > > > > Public Class course_new
> > > > > Inherits System.Web.UI.Page
> > > > >
> > > > > #Region " Web Form Designer Generated Code "
> > > > >
> > > > > 'This call is required by the Web Form Designer.
> > > > > <System.Diagnostics.DebuggerStepThrough()> Private Sub
> > > > > InitializeComponent()
> > > > > Me.DatasetOutcomes1 = New
> > > _1137InsetBookingSystem.DatasetOutcomes
> > > > > CType(Me.DatasetOutcomes1,
> > > > > System.ComponentModel.ISupportInitialize).BeginIni t()
> > > > > '
> > > > > 'DatasetOutcomes1
> > > > > '
> > > > > Me.DatasetOutcomes1.DataSetName = "DatasetOutcomes"
> > > > > Me.DatasetOutcomes1.Locale = New
> > > > > System.Globalization.CultureInfo("en-GB")
> > > > > CType(Me.DatasetOutcomes1,
> > > > > System.ComponentModel.ISupportInitialize).EndInit( )
> > > > >
> > > > > End Sub
> > > > > Protected WithEvents lblCourseTitle As
> > > System.Web.UI.WebControls.Label
> > > > > Protected WithEvents txtCourseTitle As
> > > > System.Web.UI.WebControls.TextBox
> > > > > Protected WithEvents txtCourseTutor As
> > > > System.Web.UI.WebControls.TextBox
> > > > > Protected WithEvents txtTutorList As
> > > System.Web.UI.WebControls.TextBox
> > > > > Protected WithEvents cmdAdd Asthe> > System.Web.UI.WebControls.TextBox> > > > > Protected WithEvents txtOutcome As> > System.Web.UI.WebControls.Label> > > > > Protected WithEvents cmdAddOutcome As
> > > System.Web.UI.WebControls.Button
> > > > > Protected WithEvents lblCourseTutorList As
> > > > > System.Web.UI.WebControls.Label
> > > > > Protected WithEvents lblLearningOutcomes As
> > > > > System.Web.UI.WebControls.Label
> > > > > Protected WithEvents DataGridOutcomes As
> > > > > System.Web.UI.WebControls.DataGrid
> > > > > Protected WithEvents DatasetOutcomes1 As
> > > > > _1137InsetBookingSystem.DatasetOutcomes
> > > > > Protected WithEvents lblOutcomes As> > > > >
> > > > > 'NOTE: The following placeholder declaration is required byAs> > Web> > > > Form
> > > > > Designer.
> > > > > 'Do not delete or move it.
> > > > > Private designerPlaceholderDeclaration As System.Object
> > > > >
> > > > > Private Sub Page_Init(ByVal sender As System.Object, ByVal eAs> > Designer> > > > > System.EventArgs) Handles MyBase.Init
> > > > > 'CODEGEN: This method call is required by the Web Form> > > > > 'Do not modify it using the code editor.
> > > > > InitializeComponent()
> > > > > End Sub
> > > > >
> > > > > #End Region
> > > > > Public gstrTableTitle As String = "Create Course"
> > > > > Public gstrTableAttribs As String
> > > > >
> > > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal ee> > > > > System.EventArgs) Handles MyBase.Load
> > > > > 'Put user code to initialize the page here
> > > > > If Not Page.IsPostBack Then
> > > > > Me.DataGridOutcomes.DataBind()
> > > > > Else
> > > > > Dim str As String = Me.lblOutcomes.Text
> > > > > Dim MyStream As StreamReader
> > > > >
> > > > > If str.Length > 0 Then
> > > > > MyStream = New StreamReader(str)
> > > > > Me.DatasetOutcomes1.ReadXml(MyStream)
> > > > >
> > > > > End If
> > > > >
> > > > >
> > > > >
> > > > > 'Me.DatasetOutcomes1.GetXml()
> > > > > '
> > > > >
> > > > > End If
> > > > > End Sub
> > > > >
> > > > > Private Sub UpdateOutcomes()
> > > > > Me.DataGridOutcomes.DataSource = Me.DatasetOutcomes1
> > > > > Me.DataGridOutcomes.DataBind()
> > > > > End Sub
> > > > >
> > > > > Private Sub cmdAdd_Click(ByVal sender As System.Object, ByVal&> As> > Then> > > > > System.EventArgs) Handles cmdAdd.Click
> > > > >
> > > > > If InStr(Me.txtTutorList.Text, Me.txtCourseTutor.Text) < 1> > > > > If Me.txtTutorList.Text.Length > 0 Then
> > > > > Me.txtTutorList.Text = Me.txtTutorList.Text & ";">> > ByVal> > > vbCrLf
> > > > &
> > > > > Me.txtCourseTutor.Text
> > > > > Else
> > > > > Me.txtTutorList.Text = Me.txtCourseTutor.Text
> > > > > End If
> > > > > End If
> > > > > End Sub
> > > > >
> > > > > Private Sub cmdAddOutcome_Click(ByVal sender As System.Object,> >> > > e
> > > > > As System.EventArgs) Handles cmdAddOutcome.Click
> > > > > Dim dr As DatasetOutcomes.OutcomesRow
> > > > >
> > > > > dr = Me.DatasetOutcomes1.Outcomes.NewRow()
> > > > > dr.Item("Name") = Me.txtOutcome.Text
> > > > > dr.Item("DisplayOrder") =
> > > Me.DatasetOutcomes1.Outcomes.Rows.Count
> > > > > 'DatasetOutcomes1.Outcomes.Rows.InsertAt(dr,
> > > > > Me.DatasetOutcomes1.Outcomes.Rows.Count)
> > > > >
> > > > > DatasetOutcomes1.Outcomes.Rows.Add(dr)
> > > > > Me.DataGridOutcomes.DataBind()
> > > > >
> > > > > Me.lblOutcomes.Text = Me.DatasetOutcomes1.GetXml
> > > > >
> > > > > End Sub
> > > > >
> > > > > End Class
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
John Saunders Guest
-
James Norton-Jones #5
Re: Putting a string onto a stream to be read into a DataGrid
Session:
Not able to do that as it will run on multiple servers.
"John Saunders" <john.saunders@surfcontrol.com> wrote in message
news:uhyw7eBWDHA.1896@TK2MSFTNGP12.phx.gbl...see> Ok, I don't think I've ever used an updateable XML file yet, so I didn'tanswered?> that. In order to update even a single row, you have to read in the entire
> file.
>
> Please pardon me for being dense, was your question ever actuallychange> :-)
>
> If I were you, I think I'd store DatasetCourse in Session state. On the
> other hand, if you're going to be making multiple changes to the data per
> session, I think I'd keep it in Session, but flush to disk whenever aSession("DatasetCourse")> was made. That way, if the session expires (seen asand> Is Nothing), then you can re-load it from the disk file (which you'll need
> to uniquely name, without resorting to the Session ID!)
> --
> John Saunders
> Internet Engineer
> [email]john.saunders@surfcontrol.com[/email]
>
> "James Norton-Jones" <james.norton-jones@stopford.com> wrote in message
> news:3f2a3163$0$25422$afc38c87@news.easynet.co.uk. ..> > DatasetCourse is linked to an xml schema to define the data structurethe> > the data its self is an xml doc. There is no database behind it, hencexmlns="http://http://localhost/1137InsetBookingSystem/DatasetOutcomes.xsd"> > need to repopulate from the xml data on postback.
> >
> >
> > Schema:
> > <?xml version="1.0" encoding="utf-8" ?>
> > <xs:schema id="DatasetOutcomes"
> > targetNamespace="http://tempuri.org/DatasetOutcomes.xsd"
> > elementFormDefault="qualified"
> > attributeFormDefault="qualified"
> >message> > xmlns:mstns="http://tempuri.org/DatasetOutcomes.xsd"
> > xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
> > <xs:element name="DatasetOutcomes" msdata:IsDataSet="true">
> > <xs:complexType>
> > <xs:choice maxOccurs="unbounded">
> > <xs:element name="Outcomes">
> > <xs:complexType>
> > <xs:sequence>
> > <xs:element name="Description" type="xs:string" minOccurs="0" />
> > <xs:element name="DisplayOrder" type="xs:int" minOccurs="0" />
> > </xs:sequence>
> > </xs:complexType>
> > </xs:element>
> > </xs:choice>
> > </xs:complexType>
> > <xs:key name="DatasetOutcomesKey1" msdata:PrimaryKey="true">
> > <xs:selector xpath=".//mstns:Outcomes" />
> > <xs:field xpath="mstns:Description" />
> > </xs:key>
> > </xs:element>
> > </xs:schema>
> >
> >
> > "John Saunders" <john.saunders@surfcontrol.com> wrote in message
> > news:u1L3ox2VDHA.1600@TK2MSFTNGP09.phx.gbl...> > > James,
> > >
> > > I'm glad you solved your problem, but I'm wondering how you use
> > > DatasetCourse on postbacks?
> > > --
> > > John Saunders
> > > Internet Engineer
> > > [email]john.saunders@surfcontrol.com[/email]
> > >
> > > "James Norton-Jones" <james.norton-jones@stopford.com> wrote inwhen> XmlTextReader(xmlFrag,> > > news:3f28fa69$0$25429$afc38c87@news.easynet.co.uk. ..
> > > > Managed to solve it using:
> > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> > > > System.EventArgs) Handles MyBase.Load
> > > > 'Put user code to initialize the page here
> > > > If Not Page.IsPostBack Then
> > > >
> > > > Me.DataGridOutcomes.DataBind()
> > > > Else
> > > > 'Create the XML fragment to be parsed.
> > > > Dim xmlFrag As String = Me.lblOutcomes.Text
> > > >
> > > > If xmlFrag.Length > 0 Then
> > > >
> > > > 'Create the XmlNamespaceManager.
> > > > Dim nt As NameTable = New NameTable
> > > > Dim nsmgr As XmlNamespaceManager = New
> > > > XmlNamespaceManager(nt)
> > > >
> > > > 'Create the XmlParserContext.
> > > > Dim context As XmlParserContext = New
> > > > XmlParserContext(Nothing, nsmgr, Nothing, XmlSpace.None)
> > > >
> > > > 'Create the reader.
> > > > Dim xmlTR As XmlTextReader = New> > populate> > > > XmlNodeType.Element, context)
> > > >
> > > > Me.DatasetCourse.ReadXml(xmlTR)
> > > >
> > > > End If
> > > > End If
> > > > End Sub
> > > >
> > > >
> > > > "John Saunders" <john.saunders@surfcontrol.com> wrote in message
> > > > news:OPTf5I1VDHA.1832@TK2MSFTNGP09.phx.gbl...
> > > > > Most of the time, your code can follow this pattern:
> > > > >
> > > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal a As
> > > > > System.EventArgs) Handles MyBase.Load
> > > > > If Not Page.IsPostBack Then
> > > > > myDataSet = GetDataSetSomeHow()
> > > > > myDataGrid.DataSource = myDataSet
> > > > > myDataGrid.DataMember = "FirstTable"
> > > > >
> > > > > DataBind()
> > > > > End If
> > > > > End Sub
> > > > >
> > > > > When the page is posted back, the grid (or other controls) will> > message> > > > > itself from ViewState.
> > > > > --
> > > > > John Saunders
> > > > > Internet Engineer
> > > > > [email]john.saunders@surfcontrol.com[/email]
> > > > >
> > > > >
> > > > > "James Norton-Jones" <james.norton-jones@stopford.com> wrote in> > > > > news:3f28da96$0$25420$afc38c87@news.easynet.co.uk. ..
> > > > > > Hi,
> > > > > >
> > > > > > Am I trying to hold the data of a DataGrid in a label so thatrunat="server"> having> > the> > > > > form
> > > > > > is reposted the DataGrid can be repopulated. The problem I am> be> > > is
> > > > > that
> > > > > > I don't understand how to get the text into a stream in order to> > > able
> > > > > to
> > > > > > use DataSetOutcomes1.ReadXML(MyStream).
> > > > > >
> > > > > > Thanks in advance,
> > > > > >
> > > > > > James
> > > > > >
> > > > > >
> > > > > > Web Form:
> > > > > >
> > > > > > <%@ Page Language="vb" AutoEventWireup="false"
> > > > > > Codebehind="course_new.aspx.vb"
> > > > > > Inherits="_1137InsetBookingSystem.course_new"%>
> > > > > > <!-- #INCLUDE file="headeraspx.inc" -->
> > > > > > <!-- #INCLUDE file="tableheader.inc" -->
> > > > > > <form id="FormNewCourse" method="post" runat="server">
> > > > > > <table cellSpacing="0" cols="3" cellPadding="0" width="100%"
> > > > border="0">
> > > > > > <tr>
> > > > > > <td vAlign="top"><asp:label id="lblCourseTitle"DataSource="<%#> runat="server"> > > > > > Font-Bold="True">Course Title</asp:label></td>
> > > > > > <td><asp:textbox id="txtCourseTitle"
> > > > runat="server"></asp:textbox></td>
> > > > > > <td> </td>
> > > > > > </tr>
> > > > > > <tr>
> > > > > > <td colSpan="3"><asp:label id="lblCourseTutorList"> > runat="server"> > > > > > Font-Bold="True">Course Tutor(s)</asp:label></td>
> > > > > > </tr>
> > > > > > <tr>
> > > > > > <td vAlign="top"> </td>
> > > > > > <td><asp:textbox id="txtCourseTutor"
> > > > runat="server"></asp:textbox></td>
> > > > > > <td><asp:button id="cmdAdd" runat="server" Text="Add"
> > > > > BackColor="#F6CD7A"
> > > > > > BorderStyle="Solid" BorderWidth="1px"
> > > > > > Width="80px"></asp:button></td>
> > > > > > </tr>
> > > > > > <tr>
> > > > > > <td> </td>
> > > > > > <td><asp:textbox id="txtTutorList" runat="server" Rows="5"
> > > > > > TextMode="MultiLine"></asp:textbox></td>
> > > > > > <td> </td>
> > > > > > </tr>
> > > > > > <tr>
> > > > > > <td colSpan="3"><asp:label id="lblLearningOutcomes"> > runat="server"></asp:textbox></td>> > > > > > Font-Bold="True">Learning Outcomes</asp:label></td>
> > > > > > </TD></tr>
> > > > > > <tr>
> > > > > > <td> </td>
> > > > > > <td><asp:textbox id="txtOutcome"> > > > > > <td><asp:button id="cmdAddOutcome" runat="server" Text="Add"
> > > > > > BackColor="#F6CD7A" BorderStyle="Solid"
> > > > > > BorderWidth="1px" Width="80px"
> > > > > > CausesValidation="False"></asp:button></td>
> > > > > > </tr>
> > > > > > <tr>
> > > > > > <td> </td>
> > > > > > <td><asp:datagrid id=DataGridOutcomes runat="server"
> > > GridLines="None"
> > > > > > AutoGenerateColumns="False" DataMember="Outcomes"ByVal> System.Web.UI.WebControls.Button> > > > > > DatasetOutcomes1 %>">
> > > > > > <HeaderStyle Font-Bold="True"></HeaderStyle>
> > > > > > <Columns>
> > > > > > <asp:TemplateColumn>
> > > > > > <ItemTemplate>
> > > > > > <ul>
> > > > > > <li>
> > > > > > </li>
> > > > > > </ul>
> > > > > > </ItemTemplate>
> > > > > > </asp:TemplateColumn>
> > > > > > <asp:BoundColumn DataField="Name" SortExpression="Name"
> > > > > > HeaderText="Name"></asp:BoundColumn>
> > > > > > <asp:BoundColumn DataField="DisplayOrder"
> > > > > > SortExpression="DisplayOrder"
> > > > HeaderText="DisplayOrder"></asp:BoundColumn>
> > > > > > <asp:ButtonColumn Text="Delete"
> > > > > > ButtonType="PushButton"></asp:ButtonColumn>
> > > > > > <asp:ButtonColumn Text="Edit"
> > > > > > ButtonType="PushButton"></asp:ButtonColumn>
> > > > > > </Columns>
> > > > > > </asp:datagrid></td>
> > > > > > <td> </td>
> > > > > > </tr>
> > > > > > <tr>
> > > > > > <td colSpan="3"><asp:label id="lblOutcomes"
> > > > > > runat="server"></asp:label></td>
> > > > > > </tr>
> > > > > > </table>
> > > > > > </form>
> > > > > > <!-- #INCLUDE file="tablefooter.inc" -->
> > > > > > <!-- #INCLUDE file="footer.inc" -->
> > > > > >
> > > > > >
> > > > > > Code Bind:
> > > > > >
> > > > > > Imports System
> > > > > > Imports System.IO
> > > > > > Imports System.Xml
> > > > > >
> > > > > >
> > > > > > Public Class course_new
> > > > > > Inherits System.Web.UI.Page
> > > > > >
> > > > > > #Region " Web Form Designer Generated Code "
> > > > > >
> > > > > > 'This call is required by the Web Form Designer.
> > > > > > <System.Diagnostics.DebuggerStepThrough()> Private Sub
> > > > > > InitializeComponent()
> > > > > > Me.DatasetOutcomes1 = New
> > > > _1137InsetBookingSystem.DatasetOutcomes
> > > > > > CType(Me.DatasetOutcomes1,
> > > > > > System.ComponentModel.ISupportInitialize).BeginIni t()
> > > > > > '
> > > > > > 'DatasetOutcomes1
> > > > > > '
> > > > > > Me.DatasetOutcomes1.DataSetName = "DatasetOutcomes"
> > > > > > Me.DatasetOutcomes1.Locale = New
> > > > > > System.Globalization.CultureInfo("en-GB")
> > > > > > CType(Me.DatasetOutcomes1,
> > > > > > System.ComponentModel.ISupportInitialize).EndInit( )
> > > > > >
> > > > > > End Sub
> > > > > > Protected WithEvents lblCourseTitle As
> > > > System.Web.UI.WebControls.Label
> > > > > > Protected WithEvents txtCourseTitle As
> > > > > System.Web.UI.WebControls.TextBox
> > > > > > Protected WithEvents txtCourseTutor As
> > > > > System.Web.UI.WebControls.TextBox
> > > > > > Protected WithEvents txtTutorList As
> > > > System.Web.UI.WebControls.TextBox
> > > > > > Protected WithEvents cmdAdd As> the> > > > > > Protected WithEvents txtOutcome As
> > > System.Web.UI.WebControls.TextBox
> > > > > > Protected WithEvents cmdAddOutcome As
> > > > System.Web.UI.WebControls.Button
> > > > > > Protected WithEvents lblCourseTutorList As
> > > > > > System.Web.UI.WebControls.Label
> > > > > > Protected WithEvents lblLearningOutcomes As
> > > > > > System.Web.UI.WebControls.Label
> > > > > > Protected WithEvents DataGridOutcomes As
> > > > > > System.Web.UI.WebControls.DataGrid
> > > > > > Protected WithEvents DatasetOutcomes1 As
> > > > > > _1137InsetBookingSystem.DatasetOutcomes
> > > > > > Protected WithEvents lblOutcomes As
> > > System.Web.UI.WebControls.Label
> > > > > >
> > > > > > 'NOTE: The following placeholder declaration is required by> As> > > Web
> > > > > Form
> > > > > > Designer.
> > > > > > 'Do not delete or move it.
> > > > > > Private designerPlaceholderDeclaration As System.Object
> > > > > >
> > > > > > Private Sub Page_Init(ByVal sender As System.Object, ByVal e> As> > > > > > System.EventArgs) Handles MyBase.Init
> > > > > > 'CODEGEN: This method call is required by the Web Form
> > > Designer
> > > > > > 'Do not modify it using the code editor.
> > > > > > InitializeComponent()
> > > > > > End Sub
> > > > > >
> > > > > > #End Region
> > > > > > Public gstrTableTitle As String = "Create Course"
> > > > > > Public gstrTableAttribs As String
> > > > > >
> > > > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e> > > > > > System.EventArgs) Handles MyBase.Load
> > > > > > 'Put user code to initialize the page here
> > > > > > If Not Page.IsPostBack Then
> > > > > > Me.DataGridOutcomes.DataBind()
> > > > > > Else
> > > > > > Dim str As String = Me.lblOutcomes.Text
> > > > > > Dim MyStream As StreamReader
> > > > > >
> > > > > > If str.Length > 0 Then
> > > > > > MyStream = New StreamReader(str)
> > > > > > Me.DatasetOutcomes1.ReadXml(MyStream)
> > > > > >
> > > > > > End If
> > > > > >
> > > > > >
> > > > > >
> > > > > > 'Me.DatasetOutcomes1.GetXml()
> > > > > > '
> > > > > >
> > > > > > End If
> > > > > > End Sub
> > > > > >
> > > > > > Private Sub UpdateOutcomes()
> > > > > > Me.DataGridOutcomes.DataSource = Me.DatasetOutcomes1
> > > > > > Me.DataGridOutcomes.DataBind()
> > > > > > End Sub
> > > > > >
> > > > > > Private Sub cmdAdd_Click(ByVal sender As System.Object,1> e> > As> > > > > > System.EventArgs) Handles cmdAdd.Click
> > > > > >
> > > > > > If InStr(Me.txtTutorList.Text, Me.txtCourseTutor.Text) <";"> > > Then
> > > > > > If Me.txtTutorList.Text.Length > 0 Then
> > > > > > Me.txtTutorList.Text = Me.txtTutorList.Text &System.Object,> &> > > > vbCrLf
> > > > > &
> > > > > > Me.txtCourseTutor.Text
> > > > > > Else
> > > > > > Me.txtTutorList.Text = Me.txtCourseTutor.Text
> > > > > > End If
> > > > > > End If
> > > > > > End Sub
> > > > > >
> > > > > > Private Sub cmdAddOutcome_Click(ByVal sender As>> >> > > ByVal
> > > > e
> > > > > > As System.EventArgs) Handles cmdAddOutcome.Click
> > > > > > Dim dr As DatasetOutcomes.OutcomesRow
> > > > > >
> > > > > > dr = Me.DatasetOutcomes1.Outcomes.NewRow()
> > > > > > dr.Item("Name") = Me.txtOutcome.Text
> > > > > > dr.Item("DisplayOrder") =
> > > > Me.DatasetOutcomes1.Outcomes.Rows.Count
> > > > > > 'DatasetOutcomes1.Outcomes.Rows.InsertAt(dr,
> > > > > > Me.DatasetOutcomes1.Outcomes.Rows.Count)
> > > > > >
> > > > > > DatasetOutcomes1.Outcomes.Rows.Add(dr)
> > > > > > Me.DataGridOutcomes.DataBind()
> > > > > >
> > > > > > Me.lblOutcomes.Text = Me.DatasetOutcomes1.GetXml
> > > > > >
> > > > > > End Sub
> > > > > >
> > > > > > End Class
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
James Norton-Jones Guest
-
John Saunders #6
Re: Putting a string onto a stream to be read into a DataGrid
Runs on multiple servers - and no Sql Server database to store session state
in.
--
John Saunders
Internet Engineer
[email]john.saunders@surfcontrol.com[/email]
"James Norton-Jones" <james.norton-jones@stopford.com> wrote in message
news:3f2a4401$0$10773$afc38c87@news.easynet.co.uk. ..entire> Session:
>
> Not able to do that as it will run on multiple servers.
>
> "John Saunders" <john.saunders@surfcontrol.com> wrote in message
> news:uhyw7eBWDHA.1896@TK2MSFTNGP12.phx.gbl...> see> > Ok, I don't think I've ever used an updateable XML file yet, so I didn't> > that. In order to update even a single row, you have to read in theper> answered?> > file.
> >
> > Please pardon me for being dense, was your question ever actually> > :-)
> >
> > If I were you, I think I'd store DatasetCourse in Session state. On the
> > other hand, if you're going to be making multiple changes to the dataneed> change> > session, I think I'd keep it in Session, but flush to disk whenever a> Session("DatasetCourse")> > was made. That way, if the session expires (seen as> > Is Nothing), then you can re-load it from the disk file (which you'll/>> and> > to uniquely name, without resorting to the Session ID!)
> > --
> > John Saunders
> > Internet Engineer
> > [email]john.saunders@surfcontrol.com[/email]
> >
> > "James Norton-Jones" <james.norton-jones@stopford.com> wrote in message
> > news:3f2a3163$0$25422$afc38c87@news.easynet.co.uk. ..> > > DatasetCourse is linked to an xml schema to define the data structure> the> > > the data its self is an xml doc. There is no database behind it, hence> xmlns="http://http://localhost/1137InsetBookingSystem/DatasetOutcomes.xsd"> > > need to repopulate from the xml data on postback.
> > >
> > >
> > > Schema:
> > > <?xml version="1.0" encoding="utf-8" ?>
> > > <xs:schema id="DatasetOutcomes"
> > > targetNamespace="http://tempuri.org/DatasetOutcomes.xsd"
> > > elementFormDefault="qualified"
> > > attributeFormDefault="qualified"
> > >> > > xmlns:mstns="http://tempuri.org/DatasetOutcomes.xsd"
> > > xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > > xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
> > > <xs:element name="DatasetOutcomes" msdata:IsDataSet="true">
> > > <xs:complexType>
> > > <xs:choice maxOccurs="unbounded">
> > > <xs:element name="Outcomes">
> > > <xs:complexType>
> > > <xs:sequence>
> > > <xs:element name="Description" type="xs:string" minOccurs="0"As> message> > > <xs:element name="DisplayOrder" type="xs:int" minOccurs="0" />
> > > </xs:sequence>
> > > </xs:complexType>
> > > </xs:element>
> > > </xs:choice>
> > > </xs:complexType>
> > > <xs:key name="DatasetOutcomesKey1" msdata:PrimaryKey="true">
> > > <xs:selector xpath=".//mstns:Outcomes" />
> > > <xs:field xpath="mstns:Description" />
> > > </xs:key>
> > > </xs:element>
> > > </xs:schema>
> > >
> > >
> > > "John Saunders" <john.saunders@surfcontrol.com> wrote in message
> > > news:u1L3ox2VDHA.1600@TK2MSFTNGP09.phx.gbl...
> > > > James,
> > > >
> > > > I'm glad you solved your problem, but I'm wondering how you use
> > > > DatasetCourse on postbacks?
> > > > --
> > > > John Saunders
> > > > Internet Engineer
> > > > [email]john.saunders@surfcontrol.com[/email]
> > > >
> > > > "James Norton-Jones" <james.norton-jones@stopford.com> wrote in> > > > news:3f28fa69$0$25429$afc38c87@news.easynet.co.uk. ..
> > > > > Managed to solve it using:
> > > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal eto> when> > XmlTextReader(xmlFrag,> > > > > System.EventArgs) Handles MyBase.Load
> > > > > 'Put user code to initialize the page here
> > > > > If Not Page.IsPostBack Then
> > > > >
> > > > > Me.DataGridOutcomes.DataBind()
> > > > > Else
> > > > > 'Create the XML fragment to be parsed.
> > > > > Dim xmlFrag As String = Me.lblOutcomes.Text
> > > > >
> > > > > If xmlFrag.Length > 0 Then
> > > > >
> > > > > 'Create the XmlNamespaceManager.
> > > > > Dim nt As NameTable = New NameTable
> > > > > Dim nsmgr As XmlNamespaceManager = New
> > > > > XmlNamespaceManager(nt)
> > > > >
> > > > > 'Create the XmlParserContext.
> > > > > Dim context As XmlParserContext = New
> > > > > XmlParserContext(Nothing, nsmgr, Nothing, XmlSpace.None)
> > > > >
> > > > > 'Create the reader.
> > > > > Dim xmlTR As XmlTextReader = New> > > > > XmlNodeType.Element, context)
> > > > >
> > > > > Me.DatasetCourse.ReadXml(xmlTR)
> > > > >
> > > > > End If
> > > > > End If
> > > > > End Sub
> > > > >
> > > > >
> > > > > "John Saunders" <john.saunders@surfcontrol.com> wrote in message
> > > > > news:OPTf5I1VDHA.1832@TK2MSFTNGP09.phx.gbl...
> > > > > > Most of the time, your code can follow this pattern:
> > > > > >
> > > > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal a As
> > > > > > System.EventArgs) Handles MyBase.Load
> > > > > > If Not Page.IsPostBack Then
> > > > > > myDataSet = GetDataSetSomeHow()
> > > > > > myDataGrid.DataSource = myDataSet
> > > > > > myDataGrid.DataMember = "FirstTable"
> > > > > >
> > > > > > DataBind()
> > > > > > End If
> > > > > > End Sub
> > > > > >
> > > > > > When the page is posted back, the grid (or other controls) will
> > > populate
> > > > > > itself from ViewState.
> > > > > > --
> > > > > > John Saunders
> > > > > > Internet Engineer
> > > > > > [email]john.saunders@surfcontrol.com[/email]
> > > > > >
> > > > > >
> > > > > > "James Norton-Jones" <james.norton-jones@stopford.com> wrote in
> > > message
> > > > > > news:3f28da96$0$25420$afc38c87@news.easynet.co.uk. ..
> > > > > > > Hi,
> > > > > > >
> > > > > > > Am I trying to hold the data of a DataGrid in a label so that> > having> > > the
> > > > > > form
> > > > > > > is reposted the DataGrid can be repopulated. The problem I am> > > > is
> > > > > > that
> > > > > > > I don't understand how to get the text into a stream in orderText="Add"> runat="server"> > be> > > > able
> > > > > > to
> > > > > > > use DataSetOutcomes1.ReadXML(MyStream).
> > > > > > >
> > > > > > > Thanks in advance,
> > > > > > >
> > > > > > > James
> > > > > > >
> > > > > > >
> > > > > > > Web Form:
> > > > > > >
> > > > > > > <%@ Page Language="vb" AutoEventWireup="false"
> > > > > > > Codebehind="course_new.aspx.vb"
> > > > > > > Inherits="_1137InsetBookingSystem.course_new"%>
> > > > > > > <!-- #INCLUDE file="headeraspx.inc" -->
> > > > > > > <!-- #INCLUDE file="tableheader.inc" -->
> > > > > > > <form id="FormNewCourse" method="post" runat="server">
> > > > > > > <table cellSpacing="0" cols="3" cellPadding="0" width="100%"
> > > > > border="0">
> > > > > > > <tr>
> > > > > > > <td vAlign="top"><asp:label id="lblCourseTitle"> > runat="server"> > > > > > > Font-Bold="True">Course Title</asp:label></td>
> > > > > > > <td><asp:textbox id="txtCourseTitle"
> > > > > runat="server"></asp:textbox></td>
> > > > > > > <td> </td>
> > > > > > > </tr>
> > > > > > > <tr>
> > > > > > > <td colSpan="3"><asp:label id="lblCourseTutorList"> > > > > > > Font-Bold="True">Course Tutor(s)</asp:label></td>
> > > > > > > </tr>
> > > > > > > <tr>
> > > > > > > <td vAlign="top"> </td>
> > > > > > > <td><asp:textbox id="txtCourseTutor"
> > > > > runat="server"></asp:textbox></td>
> > > > > > > <td><asp:button id="cmdAdd" runat="server" Text="Add"
> > > > > > BackColor="#F6CD7A"
> > > > > > > BorderStyle="Solid" BorderWidth="1px"
> > > > > > > Width="80px"></asp:button></td>
> > > > > > > </tr>
> > > > > > > <tr>
> > > > > > > <td> </td>
> > > > > > > <td><asp:textbox id="txtTutorList" runat="server" Rows="5"
> > > > > > > TextMode="MultiLine"></asp:textbox></td>
> > > > > > > <td> </td>
> > > > > > > </tr>
> > > > > > > <tr>
> > > > > > > <td colSpan="3"><asp:label id="lblLearningOutcomes"
> > > runat="server"
> > > > > > > Font-Bold="True">Learning Outcomes</asp:label></td>
> > > > > > > </TD></tr>
> > > > > > > <tr>
> > > > > > > <td> </td>
> > > > > > > <td><asp:textbox id="txtOutcome"
> > > runat="server"></asp:textbox></td>
> > > > > > > <td><asp:button id="cmdAddOutcome" runat="server"by> DataSource="<%#> > > > > > > BackColor="#F6CD7A" BorderStyle="Solid"
> > > > > > > BorderWidth="1px" Width="80px"
> > > > > > > CausesValidation="False"></asp:button></td>
> > > > > > > </tr>
> > > > > > > <tr>
> > > > > > > <td> </td>
> > > > > > > <td><asp:datagrid id=DataGridOutcomes runat="server"
> > > > GridLines="None"
> > > > > > > AutoGenerateColumns="False" DataMember="Outcomes"> > System.Web.UI.WebControls.Button> > > > > > > DatasetOutcomes1 %>">
> > > > > > > <HeaderStyle Font-Bold="True"></HeaderStyle>
> > > > > > > <Columns>
> > > > > > > <asp:TemplateColumn>
> > > > > > > <ItemTemplate>
> > > > > > > <ul>
> > > > > > > <li>
> > > > > > > </li>
> > > > > > > </ul>
> > > > > > > </ItemTemplate>
> > > > > > > </asp:TemplateColumn>
> > > > > > > <asp:BoundColumn DataField="Name" SortExpression="Name"
> > > > > > > HeaderText="Name"></asp:BoundColumn>
> > > > > > > <asp:BoundColumn DataField="DisplayOrder"
> > > > > > > SortExpression="DisplayOrder"
> > > > > HeaderText="DisplayOrder"></asp:BoundColumn>
> > > > > > > <asp:ButtonColumn Text="Delete"
> > > > > > > ButtonType="PushButton"></asp:ButtonColumn>
> > > > > > > <asp:ButtonColumn Text="Edit"
> > > > > > > ButtonType="PushButton"></asp:ButtonColumn>
> > > > > > > </Columns>
> > > > > > > </asp:datagrid></td>
> > > > > > > <td> </td>
> > > > > > > </tr>
> > > > > > > <tr>
> > > > > > > <td colSpan="3"><asp:label id="lblOutcomes"
> > > > > > > runat="server"></asp:label></td>
> > > > > > > </tr>
> > > > > > > </table>
> > > > > > > </form>
> > > > > > > <!-- #INCLUDE file="tablefooter.inc" -->
> > > > > > > <!-- #INCLUDE file="footer.inc" -->
> > > > > > >
> > > > > > >
> > > > > > > Code Bind:
> > > > > > >
> > > > > > > Imports System
> > > > > > > Imports System.IO
> > > > > > > Imports System.Xml
> > > > > > >
> > > > > > >
> > > > > > > Public Class course_new
> > > > > > > Inherits System.Web.UI.Page
> > > > > > >
> > > > > > > #Region " Web Form Designer Generated Code "
> > > > > > >
> > > > > > > 'This call is required by the Web Form Designer.
> > > > > > > <System.Diagnostics.DebuggerStepThrough()> Private Sub
> > > > > > > InitializeComponent()
> > > > > > > Me.DatasetOutcomes1 = New
> > > > > _1137InsetBookingSystem.DatasetOutcomes
> > > > > > > CType(Me.DatasetOutcomes1,
> > > > > > > System.ComponentModel.ISupportInitialize).BeginIni t()
> > > > > > > '
> > > > > > > 'DatasetOutcomes1
> > > > > > > '
> > > > > > > Me.DatasetOutcomes1.DataSetName = "DatasetOutcomes"
> > > > > > > Me.DatasetOutcomes1.Locale = New
> > > > > > > System.Globalization.CultureInfo("en-GB")
> > > > > > > CType(Me.DatasetOutcomes1,
> > > > > > > System.ComponentModel.ISupportInitialize).EndInit( )
> > > > > > >
> > > > > > > End Sub
> > > > > > > Protected WithEvents lblCourseTitle As
> > > > > System.Web.UI.WebControls.Label
> > > > > > > Protected WithEvents txtCourseTitle As
> > > > > > System.Web.UI.WebControls.TextBox
> > > > > > > Protected WithEvents txtCourseTutor As
> > > > > > System.Web.UI.WebControls.TextBox
> > > > > > > Protected WithEvents txtTutorList As
> > > > > System.Web.UI.WebControls.TextBox
> > > > > > > Protected WithEvents cmdAdd As> > > > > > > Protected WithEvents txtOutcome As
> > > > System.Web.UI.WebControls.TextBox
> > > > > > > Protected WithEvents cmdAddOutcome As
> > > > > System.Web.UI.WebControls.Button
> > > > > > > Protected WithEvents lblCourseTutorList As
> > > > > > > System.Web.UI.WebControls.Label
> > > > > > > Protected WithEvents lblLearningOutcomes As
> > > > > > > System.Web.UI.WebControls.Label
> > > > > > > Protected WithEvents DataGridOutcomes As
> > > > > > > System.Web.UI.WebControls.DataGrid
> > > > > > > Protected WithEvents DatasetOutcomes1 As
> > > > > > > _1137InsetBookingSystem.DatasetOutcomes
> > > > > > > Protected WithEvents lblOutcomes As
> > > > System.Web.UI.WebControls.Label
> > > > > > >
> > > > > > > 'NOTE: The following placeholder declaration is requirede> > the> > > > Web
> > > > > > Form
> > > > > > > Designer.
> > > > > > > 'Do not delete or move it.
> > > > > > > Private designerPlaceholderDeclaration As System.Object
> > > > > > >
> > > > > > > Private Sub Page_Init(ByVal sender As System.Object, ByVale> > As> > > > > > > System.EventArgs) Handles MyBase.Init
> > > > > > > 'CODEGEN: This method call is required by the Web Form
> > > > Designer
> > > > > > > 'Do not modify it using the code editor.
> > > > > > > InitializeComponent()
> > > > > > > End Sub
> > > > > > >
> > > > > > > #End Region
> > > > > > > Public gstrTableTitle As String = "Create Course"
> > > > > > > Public gstrTableAttribs As String
> > > > > > >
> > > > > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal<> ByVal> > As> > > > > > > System.EventArgs) Handles MyBase.Load
> > > > > > > 'Put user code to initialize the page here
> > > > > > > If Not Page.IsPostBack Then
> > > > > > > Me.DataGridOutcomes.DataBind()
> > > > > > > Else
> > > > > > > Dim str As String = Me.lblOutcomes.Text
> > > > > > > Dim MyStream As StreamReader
> > > > > > >
> > > > > > > If str.Length > 0 Then
> > > > > > > MyStream = New StreamReader(str)
> > > > > > > Me.DatasetOutcomes1.ReadXml(MyStream)
> > > > > > >
> > > > > > > End If
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > 'Me.DatasetOutcomes1.GetXml()
> > > > > > > '
> > > > > > >
> > > > > > > End If
> > > > > > > End Sub
> > > > > > >
> > > > > > > Private Sub UpdateOutcomes()
> > > > > > > Me.DataGridOutcomes.DataSource = Me.DatasetOutcomes1
> > > > > > > Me.DataGridOutcomes.DataBind()
> > > > > > > End Sub
> > > > > > >
> > > > > > > Private Sub cmdAdd_Click(ByVal sender As System.Object,> > e> > > As
> > > > > > > System.EventArgs) Handles cmdAdd.Click
> > > > > > >
> > > > > > > If InStr(Me.txtTutorList.Text, Me.txtCourseTutor.Text)> 1> ";"> > > > Then
> > > > > > > If Me.txtTutorList.Text.Length > 0 Then
> > > > > > > Me.txtTutorList.Text = Me.txtTutorList.Text &> System.Object,> > &> > > > > vbCrLf
> > > > > > &
> > > > > > > Me.txtCourseTutor.Text
> > > > > > > Else
> > > > > > > Me.txtTutorList.Text = Me.txtCourseTutor.Text
> > > > > > > End If
> > > > > > > End If
> > > > > > > End Sub
> > > > > > >
> > > > > > > Private Sub cmdAddOutcome_Click(ByVal sender As>> >> > > > ByVal
> > > > > e
> > > > > > > As System.EventArgs) Handles cmdAddOutcome.Click
> > > > > > > Dim dr As DatasetOutcomes.OutcomesRow
> > > > > > >
> > > > > > > dr = Me.DatasetOutcomes1.Outcomes.NewRow()
> > > > > > > dr.Item("Name") = Me.txtOutcome.Text
> > > > > > > dr.Item("DisplayOrder") =
> > > > > Me.DatasetOutcomes1.Outcomes.Rows.Count
> > > > > > > 'DatasetOutcomes1.Outcomes.Rows.InsertAt(dr,
> > > > > > > Me.DatasetOutcomes1.Outcomes.Rows.Count)
> > > > > > >
> > > > > > > DatasetOutcomes1.Outcomes.Rows.Add(dr)
> > > > > > > Me.DataGridOutcomes.DataBind()
> > > > > > >
> > > > > > > Me.lblOutcomes.Text = Me.DatasetOutcomes1.GetXml
> > > > > > >
> > > > > > > End Sub
> > > > > > >
> > > > > > > End Class
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
John Saunders Guest
-
James Norton-Jones #7
Re: Putting a string onto a stream to be read into a DataGrid
It will eventually be written to a SQL DB but each of the data grid items
will relate to the new course record. As such the course details need top be
completed on the form.Once all the course details have been captured the
data will be split into several tables. Each of the outcome rows will relate
to one course record and will be held in a table call tblCourseOutcomes. I
did want to get into a situation of create temp record in the DB.
"John Saunders" <john.saunders@surfcontrol.com> wrote in message
news:OZvwKnBWDHA.1872@TK2MSFTNGP12.phx.gbl...state> Runs on multiple servers - and no Sql Server database to store sessiondidn't> in.
> --
> John Saunders
> Internet Engineer
> [email]john.saunders@surfcontrol.com[/email]
>
> "James Norton-Jones" <james.norton-jones@stopford.com> wrote in message
> news:3f2a4401$0$10773$afc38c87@news.easynet.co.uk. ..> > Session:
> >
> > Not able to do that as it will run on multiple servers.
> >
> > "John Saunders" <john.saunders@surfcontrol.com> wrote in message
> > news:uhyw7eBWDHA.1896@TK2MSFTNGP12.phx.gbl...> > > Ok, I don't think I've ever used an updateable XML file yet, so Ithe> entire> > see> > > that. In order to update even a single row, you have to read in the> > answered?> > > file.
> > >
> > > Please pardon me for being dense, was your question ever actually> > > :-)
> > >
> > > If I were you, I think I'd store DatasetCourse in Session state. Onmessage> per> > > other hand, if you're going to be making multiple changes to the data> need> > change> > > session, I think I'd keep it in Session, but flush to disk whenever a> > Session("DatasetCourse")> > > was made. That way, if the session expires (seen as> > > Is Nothing), then you can re-load it from the disk file (which you'll> > > to uniquely name, without resorting to the Session ID!)
> > > --
> > > John Saunders
> > > Internet Engineer
> > > [email]john.saunders@surfcontrol.com[/email]
> > >
> > > "James Norton-Jones" <james.norton-jones@stopford.com> wrote instructure> > > news:3f2a3163$0$25422$afc38c87@news.easynet.co.uk. ..
> > > > DatasetCourse is linked to an xml schema to define the datahence> > and> > > > the data its self is an xml doc. There is no database behind it,xmlns="http://http://localhost/1137InsetBookingSystem/DatasetOutcomes.xsd"> > the> >> > > > need to repopulate from the xml data on postback.
> > > >
> > > >
> > > > Schema:
> > > > <?xml version="1.0" encoding="utf-8" ?>
> > > > <xs:schema id="DatasetOutcomes"
> > > > targetNamespace="http://tempuri.org/DatasetOutcomes.xsd"
> > > > elementFormDefault="qualified"
> > > > attributeFormDefault="qualified"
> > > >/>> />> > > > xmlns:mstns="http://tempuri.org/DatasetOutcomes.xsd"
> > > > xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > > > xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
> > > > <xs:element name="DatasetOutcomes" msdata:IsDataSet="true">
> > > > <xs:complexType>
> > > > <xs:choice maxOccurs="unbounded">
> > > > <xs:element name="Outcomes">
> > > > <xs:complexType>
> > > > <xs:sequence>
> > > > <xs:element name="Description" type="xs:string" minOccurs="0"> > > > <xs:element name="DisplayOrder" type="xs:int" minOccurs="0"As> As> > message> > > > </xs:sequence>
> > > > </xs:complexType>
> > > > </xs:element>
> > > > </xs:choice>
> > > > </xs:complexType>
> > > > <xs:key name="DatasetOutcomesKey1" msdata:PrimaryKey="true">
> > > > <xs:selector xpath=".//mstns:Outcomes" />
> > > > <xs:field xpath="mstns:Description" />
> > > > </xs:key>
> > > > </xs:element>
> > > > </xs:schema>
> > > >
> > > >
> > > > "John Saunders" <john.saunders@surfcontrol.com> wrote in message
> > > > news:u1L3ox2VDHA.1600@TK2MSFTNGP09.phx.gbl...
> > > > > James,
> > > > >
> > > > > I'm glad you solved your problem, but I'm wondering how you use
> > > > > DatasetCourse on postbacks?
> > > > > --
> > > > > John Saunders
> > > > > Internet Engineer
> > > > > [email]john.saunders@surfcontrol.com[/email]
> > > > >
> > > > > "James Norton-Jones" <james.norton-jones@stopford.com> wrote in> > > > > news:3f28fa69$0$25429$afc38c87@news.easynet.co.uk. ..
> > > > > > Managed to solve it using:
> > > > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e> > > > > > System.EventArgs) Handles MyBase.Load
> > > > > > 'Put user code to initialize the page here
> > > > > > If Not Page.IsPostBack Then
> > > > > >
> > > > > > Me.DataGridOutcomes.DataBind()
> > > > > > Else
> > > > > > 'Create the XML fragment to be parsed.
> > > > > > Dim xmlFrag As String = Me.lblOutcomes.Text
> > > > > >
> > > > > > If xmlFrag.Length > 0 Then
> > > > > >
> > > > > > 'Create the XmlNamespaceManager.
> > > > > > Dim nt As NameTable = New NameTable
> > > > > > Dim nsmgr As XmlNamespaceManager = New
> > > > > > XmlNamespaceManager(nt)
> > > > > >
> > > > > > 'Create the XmlParserContext.
> > > > > > Dim context As XmlParserContext = New
> > > > > > XmlParserContext(Nothing, nsmgr, Nothing, XmlSpace.None)
> > > > > >
> > > > > > 'Create the reader.
> > > > > > Dim xmlTR As XmlTextReader = New
> > > XmlTextReader(xmlFrag,
> > > > > > XmlNodeType.Element, context)
> > > > > >
> > > > > > Me.DatasetCourse.ReadXml(xmlTR)
> > > > > >
> > > > > > End If
> > > > > > End If
> > > > > > End Sub
> > > > > >
> > > > > >
> > > > > > "John Saunders" <john.saunders@surfcontrol.com> wrote in message
> > > > > > news:OPTf5I1VDHA.1832@TK2MSFTNGP09.phx.gbl...
> > > > > > > Most of the time, your code can follow this pattern:
> > > > > > >
> > > > > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal awill> > > > > > > System.EventArgs) Handles MyBase.Load
> > > > > > > If Not Page.IsPostBack Then
> > > > > > > myDataSet = GetDataSetSomeHow()
> > > > > > > myDataGrid.DataSource = myDataSet
> > > > > > > myDataGrid.DataMember = "FirstTable"
> > > > > > >
> > > > > > > DataBind()
> > > > > > > End If
> > > > > > > End Sub
> > > > > > >
> > > > > > > When the page is posted back, the grid (or other controls)in> > > > populate
> > > > > > > itself from ViewState.
> > > > > > > --
> > > > > > > John Saunders
> > > > > > > Internet Engineer
> > > > > > > [email]john.saunders@surfcontrol.com[/email]
> > > > > > >
> > > > > > >
> > > > > > > "James Norton-Jones" <james.norton-jones@stopford.com> wrotethat> > > > message
> > > > > > > news:3f28da96$0$25420$afc38c87@news.easynet.co.uk. ..
> > > > > > > > Hi,
> > > > > > > >
> > > > > > > > Am I trying to hold the data of a DataGrid in a label soam> > when> > > > the
> > > > > > > form
> > > > > > > > is reposted the DataGrid can be repopulated. The problem Iorder> > > having
> > > > > is
> > > > > > > that
> > > > > > > > I don't understand how to get the text into a stream inwidth="100%"> to> > > be
> > > > > able
> > > > > > > to
> > > > > > > > use DataSetOutcomes1.ReadXML(MyStream).
> > > > > > > >
> > > > > > > > Thanks in advance,
> > > > > > > >
> > > > > > > > James
> > > > > > > >
> > > > > > > >
> > > > > > > > Web Form:
> > > > > > > >
> > > > > > > > <%@ Page Language="vb" AutoEventWireup="false"
> > > > > > > > Codebehind="course_new.aspx.vb"
> > > > > > > > Inherits="_1137InsetBookingSystem.course_new"%>
> > > > > > > > <!-- #INCLUDE file="headeraspx.inc" -->
> > > > > > > > <!-- #INCLUDE file="tableheader.inc" -->
> > > > > > > > <form id="FormNewCourse" method="post" runat="server">
> > > > > > > > <table cellSpacing="0" cols="3" cellPadding="0"Rows="5"> > runat="server"> > > > > > border="0">
> > > > > > > > <tr>
> > > > > > > > <td vAlign="top"><asp:label id="lblCourseTitle"> > > > > > > > Font-Bold="True">Course Title</asp:label></td>
> > > > > > > > <td><asp:textbox id="txtCourseTitle"
> > > > > > runat="server"></asp:textbox></td>
> > > > > > > > <td> </td>
> > > > > > > > </tr>
> > > > > > > > <tr>
> > > > > > > > <td colSpan="3"><asp:label id="lblCourseTutorList"
> > > runat="server"
> > > > > > > > Font-Bold="True">Course Tutor(s)</asp:label></td>
> > > > > > > > </tr>
> > > > > > > > <tr>
> > > > > > > > <td vAlign="top"> </td>
> > > > > > > > <td><asp:textbox id="txtCourseTutor"
> > > > > > runat="server"></asp:textbox></td>
> > > > > > > > <td><asp:button id="cmdAdd" runat="server" Text="Add"
> > > > > > > BackColor="#F6CD7A"
> > > > > > > > BorderStyle="Solid" BorderWidth="1px"
> > > > > > > > Width="80px"></asp:button></td>
> > > > > > > > </tr>
> > > > > > > > <tr>
> > > > > > > > <td> </td>
> > > > > > > > <td><asp:textbox id="txtTutorList" runat="server"SortExpression="Name"> Text="Add"> > > > > > > > TextMode="MultiLine"></asp:textbox></td>
> > > > > > > > <td> </td>
> > > > > > > > </tr>
> > > > > > > > <tr>
> > > > > > > > <td colSpan="3"><asp:label id="lblLearningOutcomes"
> > > > runat="server"
> > > > > > > > Font-Bold="True">Learning Outcomes</asp:label></td>
> > > > > > > > </TD></tr>
> > > > > > > > <tr>
> > > > > > > > <td> </td>
> > > > > > > > <td><asp:textbox id="txtOutcome"
> > > > runat="server"></asp:textbox></td>
> > > > > > > > <td><asp:button id="cmdAddOutcome" runat="server"> > DataSource="<%#> > > > > > > > BackColor="#F6CD7A" BorderStyle="Solid"
> > > > > > > > BorderWidth="1px" Width="80px"
> > > > > > > > CausesValidation="False"></asp:button></td>
> > > > > > > > </tr>
> > > > > > > > <tr>
> > > > > > > > <td> </td>
> > > > > > > > <td><asp:datagrid id=DataGridOutcomes runat="server"
> > > > > GridLines="None"
> > > > > > > > AutoGenerateColumns="False" DataMember="Outcomes"> > > > > > > > DatasetOutcomes1 %>">
> > > > > > > > <HeaderStyle Font-Bold="True"></HeaderStyle>
> > > > > > > > <Columns>
> > > > > > > > <asp:TemplateColumn>
> > > > > > > > <ItemTemplate>
> > > > > > > > <ul>
> > > > > > > > <li>
> > > > > > > > </li>
> > > > > > > > </ul>
> > > > > > > > </ItemTemplate>
> > > > > > > > </asp:TemplateColumn>
> > > > > > > > <asp:BoundColumn DataField="Name"ByVal> by> > > > > > > > HeaderText="Name"></asp:BoundColumn>
> > > > > > > > <asp:BoundColumn DataField="DisplayOrder"
> > > > > > > > SortExpression="DisplayOrder"
> > > > > > HeaderText="DisplayOrder"></asp:BoundColumn>
> > > > > > > > <asp:ButtonColumn Text="Delete"
> > > > > > > > ButtonType="PushButton"></asp:ButtonColumn>
> > > > > > > > <asp:ButtonColumn Text="Edit"
> > > > > > > > ButtonType="PushButton"></asp:ButtonColumn>
> > > > > > > > </Columns>
> > > > > > > > </asp:datagrid></td>
> > > > > > > > <td> </td>
> > > > > > > > </tr>
> > > > > > > > <tr>
> > > > > > > > <td colSpan="3"><asp:label id="lblOutcomes"
> > > > > > > > runat="server"></asp:label></td>
> > > > > > > > </tr>
> > > > > > > > </table>
> > > > > > > > </form>
> > > > > > > > <!-- #INCLUDE file="tablefooter.inc" -->
> > > > > > > > <!-- #INCLUDE file="footer.inc" -->
> > > > > > > >
> > > > > > > >
> > > > > > > > Code Bind:
> > > > > > > >
> > > > > > > > Imports System
> > > > > > > > Imports System.IO
> > > > > > > > Imports System.Xml
> > > > > > > >
> > > > > > > >
> > > > > > > > Public Class course_new
> > > > > > > > Inherits System.Web.UI.Page
> > > > > > > >
> > > > > > > > #Region " Web Form Designer Generated Code "
> > > > > > > >
> > > > > > > > 'This call is required by the Web Form Designer.
> > > > > > > > <System.Diagnostics.DebuggerStepThrough()> Private Sub
> > > > > > > > InitializeComponent()
> > > > > > > > Me.DatasetOutcomes1 = New
> > > > > > _1137InsetBookingSystem.DatasetOutcomes
> > > > > > > > CType(Me.DatasetOutcomes1,
> > > > > > > > System.ComponentModel.ISupportInitialize).BeginIni t()
> > > > > > > > '
> > > > > > > > 'DatasetOutcomes1
> > > > > > > > '
> > > > > > > > Me.DatasetOutcomes1.DataSetName = "DatasetOutcomes"
> > > > > > > > Me.DatasetOutcomes1.Locale = New
> > > > > > > > System.Globalization.CultureInfo("en-GB")
> > > > > > > > CType(Me.DatasetOutcomes1,
> > > > > > > > System.ComponentModel.ISupportInitialize).EndInit( )
> > > > > > > >
> > > > > > > > End Sub
> > > > > > > > Protected WithEvents lblCourseTitle As
> > > > > > System.Web.UI.WebControls.Label
> > > > > > > > Protected WithEvents txtCourseTitle As
> > > > > > > System.Web.UI.WebControls.TextBox
> > > > > > > > Protected WithEvents txtCourseTutor As
> > > > > > > System.Web.UI.WebControls.TextBox
> > > > > > > > Protected WithEvents txtTutorList As
> > > > > > System.Web.UI.WebControls.TextBox
> > > > > > > > Protected WithEvents cmdAdd As
> > > System.Web.UI.WebControls.Button
> > > > > > > > Protected WithEvents txtOutcome As
> > > > > System.Web.UI.WebControls.TextBox
> > > > > > > > Protected WithEvents cmdAddOutcome As
> > > > > > System.Web.UI.WebControls.Button
> > > > > > > > Protected WithEvents lblCourseTutorList As
> > > > > > > > System.Web.UI.WebControls.Label
> > > > > > > > Protected WithEvents lblLearningOutcomes As
> > > > > > > > System.Web.UI.WebControls.Label
> > > > > > > > Protected WithEvents DataGridOutcomes As
> > > > > > > > System.Web.UI.WebControls.DataGrid
> > > > > > > > Protected WithEvents DatasetOutcomes1 As
> > > > > > > > _1137InsetBookingSystem.DatasetOutcomes
> > > > > > > > Protected WithEvents lblOutcomes As
> > > > > System.Web.UI.WebControls.Label
> > > > > > > >
> > > > > > > > 'NOTE: The following placeholder declaration is required> > > the
> > > > > Web
> > > > > > > Form
> > > > > > > > Designer.
> > > > > > > > 'Do not delete or move it.
> > > > > > > > Private designerPlaceholderDeclaration As System.Object
> > > > > > > >
> > > > > > > > Private Sub Page_Init(ByVal sender As System.Object,Form> e> > > As
> > > > > > > > System.EventArgs) Handles MyBase.Init
> > > > > > > > 'CODEGEN: This method call is required by the WebByVal> > > > > Designer
> > > > > > > > 'Do not modify it using the code editor.
> > > > > > > > InitializeComponent()
> > > > > > > > End Sub
> > > > > > > >
> > > > > > > > #End Region
> > > > > > > > Public gstrTableTitle As String = "Create Course"
> > > > > > > > Public gstrTableAttribs As String
> > > > > > > >
> > > > > > > > Private Sub Page_Load(ByVal sender As System.Object,Me.txtCourseTutor.Text)> e> > ByVal> > > As
> > > > > > > > System.EventArgs) Handles MyBase.Load
> > > > > > > > 'Put user code to initialize the page here
> > > > > > > > If Not Page.IsPostBack Then
> > > > > > > > Me.DataGridOutcomes.DataBind()
> > > > > > > > Else
> > > > > > > > Dim str As String = Me.lblOutcomes.Text
> > > > > > > > Dim MyStream As StreamReader
> > > > > > > >
> > > > > > > > If str.Length > 0 Then
> > > > > > > > MyStream = New StreamReader(str)
> > > > > > > > Me.DatasetOutcomes1.ReadXml(MyStream)
> > > > > > > >
> > > > > > > > End If
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > 'Me.DatasetOutcomes1.GetXml()
> > > > > > > > '
> > > > > > > >
> > > > > > > > End If
> > > > > > > > End Sub
> > > > > > > >
> > > > > > > > Private Sub UpdateOutcomes()
> > > > > > > > Me.DataGridOutcomes.DataSource = Me.DatasetOutcomes1
> > > > > > > > Me.DataGridOutcomes.DataBind()
> > > > > > > > End Sub
> > > > > > > >
> > > > > > > > Private Sub cmdAdd_Click(ByVal sender As System.Object,> > > e
> > > > As
> > > > > > > > System.EventArgs) Handles cmdAdd.Click
> > > > > > > >
> > > > > > > > If InStr(Me.txtTutorList.Text,&> <> > 1> > > > > Then
> > > > > > > > If Me.txtTutorList.Text.Length > 0 Then
> > > > > > > > Me.txtTutorList.Text = Me.txtTutorList.TextMe.txtCourseTutor.Text> > ";"> > > &
> > > > > > vbCrLf
> > > > > > > &
> > > > > > > > Me.txtCourseTutor.Text
> > > > > > > > Else
> > > > > > > > Me.txtTutorList.Text =>> > System.Object,> > > > > > > > End If
> > > > > > > > End If
> > > > > > > > End Sub
> > > > > > > >
> > > > > > > > Private Sub cmdAddOutcome_Click(ByVal sender As> >> > > > > ByVal
> > > > > > e
> > > > > > > > As System.EventArgs) Handles cmdAddOutcome.Click
> > > > > > > > Dim dr As DatasetOutcomes.OutcomesRow
> > > > > > > >
> > > > > > > > dr = Me.DatasetOutcomes1.Outcomes.NewRow()
> > > > > > > > dr.Item("Name") = Me.txtOutcome.Text
> > > > > > > > dr.Item("DisplayOrder") =
> > > > > > Me.DatasetOutcomes1.Outcomes.Rows.Count
> > > > > > > > 'DatasetOutcomes1.Outcomes.Rows.InsertAt(dr,
> > > > > > > > Me.DatasetOutcomes1.Outcomes.Rows.Count)
> > > > > > > >
> > > > > > > > DatasetOutcomes1.Outcomes.Rows.Add(dr)
> > > > > > > > Me.DataGridOutcomes.DataBind()
> > > > > > > >
> > > > > > > > Me.lblOutcomes.Text = Me.DatasetOutcomes1.GetXml
> > > > > > > >
> > > > > > > > End Sub
> > > > > > > >
> > > > > > > > End Class
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
James Norton-Jones Guest
-
John Saunders #8
Re: Putting a string onto a stream to be read into a DataGrid
Oh, if there is a Sql Server database, had you considered using the
"SQLServer" mode of the <sessionState> element in web.config? I haven't
tried it - perhaps it's too slow.
--
John Saunders
Internet Engineer
[email]john.saunders@surfcontrol.com[/email]
"James Norton-Jones" <james.norton-jones@stopford.com> wrote in message
news:3f2a4dd0$0$10785$afc38c87@news.easynet.co.uk. ..be> It will eventually be written to a SQL DB but each of the data grid items
> will relate to the new course record. As such the course details need toprelate> completed on the form.Once all the course details have been captured the
> data will be split into several tables. Each of the outcome rows willdata> to one course record and will be held in a table call tblCourseOutcomes. I
> did want to get into a situation of create temp record in the DB.
>
>
> "John Saunders" <john.saunders@surfcontrol.com> wrote in message
> news:OZvwKnBWDHA.1872@TK2MSFTNGP12.phx.gbl...> state> > Runs on multiple servers - and no Sql Server database to store session> didn't> > in.
> > --
> > John Saunders
> > Internet Engineer
> > [email]john.saunders@surfcontrol.com[/email]
> >
> > "James Norton-Jones" <james.norton-jones@stopford.com> wrote in message
> > news:3f2a4401$0$10773$afc38c87@news.easynet.co.uk. ..> > > Session:
> > >
> > > Not able to do that as it will run on multiple servers.
> > >
> > > "John Saunders" <john.saunders@surfcontrol.com> wrote in message
> > > news:uhyw7eBWDHA.1896@TK2MSFTNGP12.phx.gbl...
> > > > Ok, I don't think I've ever used an updateable XML file yet, so I> the> > entire> > > see
> > > > that. In order to update even a single row, you have to read in the> > > > file.
> > > >
> > > > Please pardon me for being dense, was your question ever actually
> > > answered?
> > > > :-)
> > > >
> > > > If I were you, I think I'd store DatasetCourse in Session state. On> > > > other hand, if you're going to be making multiple changes to thea> > per> > > > session, I think I'd keep it in Session, but flush to disk wheneveryou'll> > > change
> > > > was made. That way, if the session expires (seen as
> > > Session("DatasetCourse")
> > > > Is Nothing), then you can re-load it from the disk file (whichminOccurs="0"> message> > need> > > > to uniquely name, without resorting to the Session ID!)
> > > > --
> > > > John Saunders
> > > > Internet Engineer
> > > > [email]john.saunders@surfcontrol.com[/email]
> > > >
> > > > "James Norton-Jones" <james.norton-jones@stopford.com> wrote in> structure> > > > news:3f2a3163$0$25422$afc38c87@news.easynet.co.uk. ..
> > > > > DatasetCourse is linked to an xml schema to define the data> hence> > > and
> > > > > the data its self is an xml doc. There is no database behind it,> xmlns="http://http://localhost/1137InsetBookingSystem/DatasetOutcomes.xsd"> > > the
> > > > > need to repopulate from the xml data on postback.
> > > > >
> > > > >
> > > > > Schema:
> > > > > <?xml version="1.0" encoding="utf-8" ?>
> > > > > <xs:schema id="DatasetOutcomes"
> > > > > targetNamespace="http://tempuri.org/DatasetOutcomes.xsd"
> > > > > elementFormDefault="qualified"
> > > > > attributeFormDefault="qualified"
> > > > >
> > >> > > > > xmlns:mstns="http://tempuri.org/DatasetOutcomes.xsd"
> > > > > xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > > > > xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
> > > > > <xs:element name="DatasetOutcomes" msdata:IsDataSet="true">
> > > > > <xs:complexType>
> > > > > <xs:choice maxOccurs="unbounded">
> > > > > <xs:element name="Outcomes">
> > > > > <xs:complexType>
> > > > > <xs:sequence>
> > > > > <xs:element name="Description" type="xs:string"e> />> > />> > > > > <xs:element name="DisplayOrder" type="xs:int" minOccurs="0"> > > > > </xs:sequence>
> > > > > </xs:complexType>
> > > > > </xs:element>
> > > > > </xs:choice>
> > > > > </xs:complexType>
> > > > > <xs:key name="DatasetOutcomesKey1" msdata:PrimaryKey="true">
> > > > > <xs:selector xpath=".//mstns:Outcomes" />
> > > > > <xs:field xpath="mstns:Description" />
> > > > > </xs:key>
> > > > > </xs:element>
> > > > > </xs:schema>
> > > > >
> > > > >
> > > > > "John Saunders" <john.saunders@surfcontrol.com> wrote in message
> > > > > news:u1L3ox2VDHA.1600@TK2MSFTNGP09.phx.gbl...
> > > > > > James,
> > > > > >
> > > > > > I'm glad you solved your problem, but I'm wondering how you use
> > > > > > DatasetCourse on postbacks?
> > > > > > --
> > > > > > John Saunders
> > > > > > Internet Engineer
> > > > > > [email]john.saunders@surfcontrol.com[/email]
> > > > > >
> > > > > > "James Norton-Jones" <james.norton-jones@stopford.com> wrote in
> > > message
> > > > > > news:3f28fa69$0$25429$afc38c87@news.easynet.co.uk. ..
> > > > > > > Managed to solve it using:
> > > > > > > Private Sub Page_Load(ByVal sender As System.Object, ByValmessage> > As> > > > > > > System.EventArgs) Handles MyBase.Load
> > > > > > > 'Put user code to initialize the page here
> > > > > > > If Not Page.IsPostBack Then
> > > > > > >
> > > > > > > Me.DataGridOutcomes.DataBind()
> > > > > > > Else
> > > > > > > 'Create the XML fragment to be parsed.
> > > > > > > Dim xmlFrag As String = Me.lblOutcomes.Text
> > > > > > >
> > > > > > > If xmlFrag.Length > 0 Then
> > > > > > >
> > > > > > > 'Create the XmlNamespaceManager.
> > > > > > > Dim nt As NameTable = New NameTable
> > > > > > > Dim nsmgr As XmlNamespaceManager = New
> > > > > > > XmlNamespaceManager(nt)
> > > > > > >
> > > > > > > 'Create the XmlParserContext.
> > > > > > > Dim context As XmlParserContext = New
> > > > > > > XmlParserContext(Nothing, nsmgr, Nothing, XmlSpace.None)
> > > > > > >
> > > > > > > 'Create the reader.
> > > > > > > Dim xmlTR As XmlTextReader = New
> > > > XmlTextReader(xmlFrag,
> > > > > > > XmlNodeType.Element, context)
> > > > > > >
> > > > > > > Me.DatasetCourse.ReadXml(xmlTR)
> > > > > > >
> > > > > > > End If
> > > > > > > End If
> > > > > > > End Sub
> > > > > > >
> > > > > > >
> > > > > > > "John Saunders" <john.saunders@surfcontrol.com> wrote in"DatasetOutcomes"> As> > > > > > > news:OPTf5I1VDHA.1832@TK2MSFTNGP09.phx.gbl...
> > > > > > > > Most of the time, your code can follow this pattern:
> > > > > > > >
> > > > > > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal a> will> > > > > > > > System.EventArgs) Handles MyBase.Load
> > > > > > > > If Not Page.IsPostBack Then
> > > > > > > > myDataSet = GetDataSetSomeHow()
> > > > > > > > myDataGrid.DataSource = myDataSet
> > > > > > > > myDataGrid.DataMember = "FirstTable"
> > > > > > > >
> > > > > > > > DataBind()
> > > > > > > > End If
> > > > > > > > End Sub
> > > > > > > >
> > > > > > > > When the page is posted back, the grid (or other controls)> in> > > > > populate
> > > > > > > > itself from ViewState.
> > > > > > > > --
> > > > > > > > John Saunders
> > > > > > > > Internet Engineer
> > > > > > > > [email]john.saunders@surfcontrol.com[/email]
> > > > > > > >
> > > > > > > >
> > > > > > > > "James Norton-Jones" <james.norton-jones@stopford.com> wrote> that> > > > > message
> > > > > > > > news:3f28da96$0$25420$afc38c87@news.easynet.co.uk. ..
> > > > > > > > > Hi,
> > > > > > > > >
> > > > > > > > > Am I trying to hold the data of a DataGrid in a label so> am> > > when
> > > > > the
> > > > > > > > form
> > > > > > > > > is reposted the DataGrid can be repopulated. The problem I> order> > > > having
> > > > > > is
> > > > > > > > that
> > > > > > > > > I don't understand how to get the text into a stream in> width="100%"> > to> > > > be
> > > > > > able
> > > > > > > > to
> > > > > > > > > use DataSetOutcomes1.ReadXML(MyStream).
> > > > > > > > >
> > > > > > > > > Thanks in advance,
> > > > > > > > >
> > > > > > > > > James
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > Web Form:
> > > > > > > > >
> > > > > > > > > <%@ Page Language="vb" AutoEventWireup="false"
> > > > > > > > > Codebehind="course_new.aspx.vb"
> > > > > > > > > Inherits="_1137InsetBookingSystem.course_new"%>
> > > > > > > > > <!-- #INCLUDE file="headeraspx.inc" -->
> > > > > > > > > <!-- #INCLUDE file="tableheader.inc" -->
> > > > > > > > > <form id="FormNewCourse" method="post" runat="server">
> > > > > > > > > <table cellSpacing="0" cols="3" cellPadding="0"> Rows="5"> > > > > > > border="0">
> > > > > > > > > <tr>
> > > > > > > > > <td vAlign="top"><asp:label id="lblCourseTitle"
> > > runat="server"
> > > > > > > > > Font-Bold="True">Course Title</asp:label></td>
> > > > > > > > > <td><asp:textbox id="txtCourseTitle"
> > > > > > > runat="server"></asp:textbox></td>
> > > > > > > > > <td> </td>
> > > > > > > > > </tr>
> > > > > > > > > <tr>
> > > > > > > > > <td colSpan="3"><asp:label id="lblCourseTutorList"
> > > > runat="server"
> > > > > > > > > Font-Bold="True">Course Tutor(s)</asp:label></td>
> > > > > > > > > </tr>
> > > > > > > > > <tr>
> > > > > > > > > <td vAlign="top"> </td>
> > > > > > > > > <td><asp:textbox id="txtCourseTutor"
> > > > > > > runat="server"></asp:textbox></td>
> > > > > > > > > <td><asp:button id="cmdAdd" runat="server" Text="Add"
> > > > > > > > BackColor="#F6CD7A"
> > > > > > > > > BorderStyle="Solid" BorderWidth="1px"
> > > > > > > > > Width="80px"></asp:button></td>
> > > > > > > > > </tr>
> > > > > > > > > <tr>
> > > > > > > > > <td> </td>
> > > > > > > > > <td><asp:textbox id="txtTutorList" runat="server"> SortExpression="Name"> > Text="Add"> > > > > > > > > TextMode="MultiLine"></asp:textbox></td>
> > > > > > > > > <td> </td>
> > > > > > > > > </tr>
> > > > > > > > > <tr>
> > > > > > > > > <td colSpan="3"><asp:label id="lblLearningOutcomes"
> > > > > runat="server"
> > > > > > > > > Font-Bold="True">Learning Outcomes</asp:label></td>
> > > > > > > > > </TD></tr>
> > > > > > > > > <tr>
> > > > > > > > > <td> </td>
> > > > > > > > > <td><asp:textbox id="txtOutcome"
> > > > > runat="server"></asp:textbox></td>
> > > > > > > > > <td><asp:button id="cmdAddOutcome" runat="server"> > > > > > > > > BackColor="#F6CD7A" BorderStyle="Solid"
> > > > > > > > > BorderWidth="1px" Width="80px"
> > > > > > > > > CausesValidation="False"></asp:button></td>
> > > > > > > > > </tr>
> > > > > > > > > <tr>
> > > > > > > > > <td> </td>
> > > > > > > > > <td><asp:datagrid id=DataGridOutcomes runat="server"
> > > > > > GridLines="None"
> > > > > > > > > AutoGenerateColumns="False" DataMember="Outcomes"
> > > DataSource="<%#
> > > > > > > > > DatasetOutcomes1 %>">
> > > > > > > > > <HeaderStyle Font-Bold="True"></HeaderStyle>
> > > > > > > > > <Columns>
> > > > > > > > > <asp:TemplateColumn>
> > > > > > > > > <ItemTemplate>
> > > > > > > > > <ul>
> > > > > > > > > <li>
> > > > > > > > > </li>
> > > > > > > > > </ul>
> > > > > > > > > </ItemTemplate>
> > > > > > > > > </asp:TemplateColumn>
> > > > > > > > > <asp:BoundColumn DataField="Name"> > > > > > > > > HeaderText="Name"></asp:BoundColumn>
> > > > > > > > > <asp:BoundColumn DataField="DisplayOrder"
> > > > > > > > > SortExpression="DisplayOrder"
> > > > > > > HeaderText="DisplayOrder"></asp:BoundColumn>
> > > > > > > > > <asp:ButtonColumn Text="Delete"
> > > > > > > > > ButtonType="PushButton"></asp:ButtonColumn>
> > > > > > > > > <asp:ButtonColumn Text="Edit"
> > > > > > > > > ButtonType="PushButton"></asp:ButtonColumn>
> > > > > > > > > </Columns>
> > > > > > > > > </asp:datagrid></td>
> > > > > > > > > <td> </td>
> > > > > > > > > </tr>
> > > > > > > > > <tr>
> > > > > > > > > <td colSpan="3"><asp:label id="lblOutcomes"
> > > > > > > > > runat="server"></asp:label></td>
> > > > > > > > > </tr>
> > > > > > > > > </table>
> > > > > > > > > </form>
> > > > > > > > > <!-- #INCLUDE file="tablefooter.inc" -->
> > > > > > > > > <!-- #INCLUDE file="footer.inc" -->
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > Code Bind:
> > > > > > > > >
> > > > > > > > > Imports System
> > > > > > > > > Imports System.IO
> > > > > > > > > Imports System.Xml
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > Public Class course_new
> > > > > > > > > Inherits System.Web.UI.Page
> > > > > > > > >
> > > > > > > > > #Region " Web Form Designer Generated Code "
> > > > > > > > >
> > > > > > > > > 'This call is required by the Web Form Designer.
> > > > > > > > > <System.Diagnostics.DebuggerStepThrough()> Private Sub
> > > > > > > > > InitializeComponent()
> > > > > > > > > Me.DatasetOutcomes1 = New
> > > > > > > _1137InsetBookingSystem.DatasetOutcomes
> > > > > > > > > CType(Me.DatasetOutcomes1,
> > > > > > > > > System.ComponentModel.ISupportInitialize).BeginIni t()
> > > > > > > > > '
> > > > > > > > > 'DatasetOutcomes1
> > > > > > > > > '
> > > > > > > > > Me.DatasetOutcomes1.DataSetName =required> > > > > > > > > Me.DatasetOutcomes1.Locale = New
> > > > > > > > > System.Globalization.CultureInfo("en-GB")
> > > > > > > > > CType(Me.DatasetOutcomes1,
> > > > > > > > > System.ComponentModel.ISupportInitialize).EndInit( )
> > > > > > > > >
> > > > > > > > > End Sub
> > > > > > > > > Protected WithEvents lblCourseTitle As
> > > > > > > System.Web.UI.WebControls.Label
> > > > > > > > > Protected WithEvents txtCourseTitle As
> > > > > > > > System.Web.UI.WebControls.TextBox
> > > > > > > > > Protected WithEvents txtCourseTutor As
> > > > > > > > System.Web.UI.WebControls.TextBox
> > > > > > > > > Protected WithEvents txtTutorList As
> > > > > > > System.Web.UI.WebControls.TextBox
> > > > > > > > > Protected WithEvents cmdAdd As
> > > > System.Web.UI.WebControls.Button
> > > > > > > > > Protected WithEvents txtOutcome As
> > > > > > System.Web.UI.WebControls.TextBox
> > > > > > > > > Protected WithEvents cmdAddOutcome As
> > > > > > > System.Web.UI.WebControls.Button
> > > > > > > > > Protected WithEvents lblCourseTutorList As
> > > > > > > > > System.Web.UI.WebControls.Label
> > > > > > > > > Protected WithEvents lblLearningOutcomes As
> > > > > > > > > System.Web.UI.WebControls.Label
> > > > > > > > > Protected WithEvents DataGridOutcomes As
> > > > > > > > > System.Web.UI.WebControls.DataGrid
> > > > > > > > > Protected WithEvents DatasetOutcomes1 As
> > > > > > > > > _1137InsetBookingSystem.DatasetOutcomes
> > > > > > > > > Protected WithEvents lblOutcomes As
> > > > > > System.Web.UI.WebControls.Label
> > > > > > > > >
> > > > > > > > > 'NOTE: The following placeholder declaration isSystem.Object> > by> > > > the
> > > > > > Web
> > > > > > > > Form
> > > > > > > > > Designer.
> > > > > > > > > 'Do not delete or move it.
> > > > > > > > > Private designerPlaceholderDeclaration AsMe.DatasetOutcomes1> ByVal> > > > > > > > >
> > > > > > > > > Private Sub Page_Init(ByVal sender As System.Object,> Form> > e> > > > As
> > > > > > > > > System.EventArgs) Handles MyBase.Init
> > > > > > > > > 'CODEGEN: This method call is required by the Web> ByVal> > > > > > Designer
> > > > > > > > > 'Do not modify it using the code editor.
> > > > > > > > > InitializeComponent()
> > > > > > > > > End Sub
> > > > > > > > >
> > > > > > > > > #End Region
> > > > > > > > > Public gstrTableTitle As String = "Create Course"
> > > > > > > > > Public gstrTableAttribs As String
> > > > > > > > >
> > > > > > > > > Private Sub Page_Load(ByVal sender As System.Object,> > e> > > > As
> > > > > > > > > System.EventArgs) Handles MyBase.Load
> > > > > > > > > 'Put user code to initialize the page here
> > > > > > > > > If Not Page.IsPostBack Then
> > > > > > > > > Me.DataGridOutcomes.DataBind()
> > > > > > > > > Else
> > > > > > > > > Dim str As String = Me.lblOutcomes.Text
> > > > > > > > > Dim MyStream As StreamReader
> > > > > > > > >
> > > > > > > > > If str.Length > 0 Then
> > > > > > > > > MyStream = New StreamReader(str)
> > > > > > > > > Me.DatasetOutcomes1.ReadXml(MyStream)
> > > > > > > > >
> > > > > > > > > End If
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > 'Me.DatasetOutcomes1.GetXml()
> > > > > > > > > '
> > > > > > > > >
> > > > > > > > > End If
> > > > > > > > > End Sub
> > > > > > > > >
> > > > > > > > > Private Sub UpdateOutcomes()
> > > > > > > > > Me.DataGridOutcomes.DataSource =System.Object,> > > > > > > > > Me.DataGridOutcomes.DataBind()
> > > > > > > > > End Sub
> > > > > > > > >
> > > > > > > > > Private Sub cmdAdd_Click(ByVal sender AsMe.txtTutorList.Text> Me.txtCourseTutor.Text)> > > ByVal
> > > > e
> > > > > As
> > > > > > > > > System.EventArgs) Handles cmdAdd.Click
> > > > > > > > >
> > > > > > > > > If InStr(Me.txtTutorList.Text,> > <> > > 1
> > > > > > Then
> > > > > > > > > If Me.txtTutorList.Text.Length > 0 Then
> > > > > > > > > Me.txtTutorList.Text => &> Me.txtCourseTutor.Text> > > ";"
> > > > &
> > > > > > > vbCrLf
> > > > > > > > &
> > > > > > > > > Me.txtCourseTutor.Text
> > > > > > > > > Else
> > > > > > > > > Me.txtTutorList.Text =>> >> > > > > > > > > End If
> > > > > > > > > End If
> > > > > > > > > End Sub
> > > > > > > > >
> > > > > > > > > Private Sub cmdAddOutcome_Click(ByVal sender As
> > > System.Object,
> > > > > > ByVal
> > > > > > > e
> > > > > > > > > As System.EventArgs) Handles cmdAddOutcome.Click
> > > > > > > > > Dim dr As DatasetOutcomes.OutcomesRow
> > > > > > > > >
> > > > > > > > > dr = Me.DatasetOutcomes1.Outcomes.NewRow()
> > > > > > > > > dr.Item("Name") = Me.txtOutcome.Text
> > > > > > > > > dr.Item("DisplayOrder") =
> > > > > > > Me.DatasetOutcomes1.Outcomes.Rows.Count
> > > > > > > > > 'DatasetOutcomes1.Outcomes.Rows.InsertAt(dr,
> > > > > > > > > Me.DatasetOutcomes1.Outcomes.Rows.Count)
> > > > > > > > >
> > > > > > > > > DatasetOutcomes1.Outcomes.Rows.Add(dr)
> > > > > > > > > Me.DataGridOutcomes.DataBind()
> > > > > > > > >
> > > > > > > > > Me.lblOutcomes.Text = Me.DatasetOutcomes1.GetXml
> > > > > > > > >
> > > > > > > > > End Sub
> > > > > > > > >
> > > > > > > > > End Class
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
John Saunders Guest
-
James Norton-Jones #9
Re: Putting a string onto a stream to be read into a DataGrid
To be honest I didn't know it existed, I'll look into it thanks. It would
certainly reduce the HTML payload.
"John Saunders" <john.saunders@surfcontrol.com> wrote in message
news:unR46SCWDHA.532@TK2MSFTNGP10.phx.gbl...items> Oh, if there is a Sql Server database, had you considered using the
> "SQLServer" mode of the <sessionState> element in web.config? I haven't
> tried it - perhaps it's too slow.
> --
> John Saunders
> Internet Engineer
> [email]john.saunders@surfcontrol.com[/email]
>
> "James Norton-Jones" <james.norton-jones@stopford.com> wrote in message
> news:3f2a4dd0$0$10785$afc38c87@news.easynet.co.uk. ..> > It will eventually be written to a SQL DB but each of the data gridtop> > will relate to the new course record. As such the course details needI> be> relate> > completed on the form.Once all the course details have been captured the
> > data will be split into several tables. Each of the outcome rows will> > to one course record and will be held in a table call tblCourseOutcomes.message> > did want to get into a situation of create temp record in the DB.
> >
> >
> > "John Saunders" <john.saunders@surfcontrol.com> wrote in message
> > news:OZvwKnBWDHA.1872@TK2MSFTNGP12.phx.gbl...> > state> > > Runs on multiple servers - and no Sql Server database to store session> > > in.
> > > --
> > > John Saunders
> > > Internet Engineer
> > > [email]john.saunders@surfcontrol.com[/email]
> > >
> > > "James Norton-Jones" <james.norton-jones@stopford.com> wrote inthe> > didn't> > > news:3f2a4401$0$10773$afc38c87@news.easynet.co.uk. ..
> > > > Session:
> > > >
> > > > Not able to do that as it will run on multiple servers.
> > > >
> > > > "John Saunders" <john.saunders@surfcontrol.com> wrote in message
> > > > news:uhyw7eBWDHA.1896@TK2MSFTNGP12.phx.gbl...
> > > > > Ok, I don't think I've ever used an updateable XML file yet, so I> > > > see
> > > > > that. In order to update even a single row, you have to read inOn> > > entire
> > > > > file.
> > > > >
> > > > > Please pardon me for being dense, was your question ever actually
> > > > answered?
> > > > > :-)
> > > > >
> > > > > If I were you, I think I'd store DatasetCourse in Session state.whenever> data> > the> > > > > other hand, if you're going to be making multiple changes to the> > > per
> > > > > session, I think I'd keep it in Session, but flush to diskxmlns="http://http://localhost/1137InsetBookingSystem/DatasetOutcomes.xsd"> a> you'll> > > > change
> > > > > was made. That way, if the session expires (seen as
> > > > Session("DatasetCourse")
> > > > > Is Nothing), then you can re-load it from the disk file (which> > message> > > need
> > > > > to uniquely name, without resorting to the Session ID!)
> > > > > --
> > > > > John Saunders
> > > > > Internet Engineer
> > > > > [email]john.saunders@surfcontrol.com[/email]
> > > > >
> > > > > "James Norton-Jones" <james.norton-jones@stopford.com> wrote in> > structure> > > > > news:3f2a3163$0$25422$afc38c87@news.easynet.co.uk. ..
> > > > > > DatasetCourse is linked to an xml schema to define the data> > hence> > > > and
> > > > > > the data its self is an xml doc. There is no database behind it,> >> > > > the
> > > > > > need to repopulate from the xml data on postback.
> > > > > >
> > > > > >
> > > > > > Schema:
> > > > > > <?xml version="1.0" encoding="utf-8" ?>
> > > > > > <xs:schema id="DatasetOutcomes"
> > > > > > targetNamespace="http://tempuri.org/DatasetOutcomes.xsd"
> > > > > > elementFormDefault="qualified"
> > > > > > attributeFormDefault="qualified"
> > > > > >
> > > >minOccurs="0"> minOccurs="0"> > > > > > xmlns:mstns="http://tempuri.org/DatasetOutcomes.xsd"
> > > > > > xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > > > > > xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
> > > > > > <xs:element name="DatasetOutcomes" msdata:IsDataSet="true">
> > > > > > <xs:complexType>
> > > > > > <xs:choice maxOccurs="unbounded">
> > > > > > <xs:element name="Outcomes">
> > > > > > <xs:complexType>
> > > > > > <xs:sequence>
> > > > > > <xs:element name="Description" type="xs:string"> > > />
> > > > > > <xs:element name="DisplayOrder" type="xs:int"use> > />> > > > > > </xs:sequence>
> > > > > > </xs:complexType>
> > > > > > </xs:element>
> > > > > > </xs:choice>
> > > > > > </xs:complexType>
> > > > > > <xs:key name="DatasetOutcomesKey1" msdata:PrimaryKey="true">
> > > > > > <xs:selector xpath=".//mstns:Outcomes" />
> > > > > > <xs:field xpath="mstns:Description" />
> > > > > > </xs:key>
> > > > > > </xs:element>
> > > > > > </xs:schema>
> > > > > >
> > > > > >
> > > > > > "John Saunders" <john.saunders@surfcontrol.com> wrote in message
> > > > > > news:u1L3ox2VDHA.1600@TK2MSFTNGP09.phx.gbl...
> > > > > > > James,
> > > > > > >
> > > > > > > I'm glad you solved your problem, but I'm wondering how youin> > > > > > > DatasetCourse on postbacks?
> > > > > > > --
> > > > > > > John Saunders
> > > > > > > Internet Engineer
> > > > > > > [email]john.saunders@surfcontrol.com[/email]
> > > > > > >
> > > > > > > "James Norton-Jones" <james.norton-jones@stopford.com> wroteByVal> > > > message
> > > > > > > news:3f28fa69$0$25429$afc38c87@news.easynet.co.uk. ..
> > > > > > > > Managed to solve it using:
> > > > > > > > Private Sub Page_Load(ByVal sender As System.Object,a> e> message> > > As
> > > > > > > > System.EventArgs) Handles MyBase.Load
> > > > > > > > 'Put user code to initialize the page here
> > > > > > > > If Not Page.IsPostBack Then
> > > > > > > >
> > > > > > > > Me.DataGridOutcomes.DataBind()
> > > > > > > > Else
> > > > > > > > 'Create the XML fragment to be parsed.
> > > > > > > > Dim xmlFrag As String = Me.lblOutcomes.Text
> > > > > > > >
> > > > > > > > If xmlFrag.Length > 0 Then
> > > > > > > >
> > > > > > > > 'Create the XmlNamespaceManager.
> > > > > > > > Dim nt As NameTable = New NameTable
> > > > > > > > Dim nsmgr As XmlNamespaceManager = New
> > > > > > > > XmlNamespaceManager(nt)
> > > > > > > >
> > > > > > > > 'Create the XmlParserContext.
> > > > > > > > Dim context As XmlParserContext = New
> > > > > > > > XmlParserContext(Nothing, nsmgr, Nothing, XmlSpace.None)
> > > > > > > >
> > > > > > > > 'Create the reader.
> > > > > > > > Dim xmlTR As XmlTextReader = New
> > > > > XmlTextReader(xmlFrag,
> > > > > > > > XmlNodeType.Element, context)
> > > > > > > >
> > > > > > > > Me.DatasetCourse.ReadXml(xmlTR)
> > > > > > > >
> > > > > > > > End If
> > > > > > > > End If
> > > > > > > > End Sub
> > > > > > > >
> > > > > > > >
> > > > > > > > "John Saunders" <john.saunders@surfcontrol.com> wrote in> > > > > > > > news:OPTf5I1VDHA.1832@TK2MSFTNGP09.phx.gbl...
> > > > > > > > > Most of the time, your code can follow this pattern:
> > > > > > > > >
> > > > > > > > > Private Sub Page_Load(ByVal sender As System.Object, ByValwrote> > As> > will> > > > > > > > > System.EventArgs) Handles MyBase.Load
> > > > > > > > > If Not Page.IsPostBack Then
> > > > > > > > > myDataSet = GetDataSetSomeHow()
> > > > > > > > > myDataGrid.DataSource = myDataSet
> > > > > > > > > myDataGrid.DataMember = "FirstTable"
> > > > > > > > >
> > > > > > > > > DataBind()
> > > > > > > > > End If
> > > > > > > > > End Sub
> > > > > > > > >
> > > > > > > > > When the page is posted back, the grid (or other controls)> > > > > > populate
> > > > > > > > > itself from ViewState.
> > > > > > > > > --
> > > > > > > > > John Saunders
> > > > > > > > > Internet Engineer
> > > > > > > > > [email]john.saunders@surfcontrol.com[/email]
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > "James Norton-Jones" <james.norton-jones@stopford.com>I> > in> > that> > > > > > message
> > > > > > > > > news:3f28da96$0$25420$afc38c87@news.easynet.co.uk. ..
> > > > > > > > > > Hi,
> > > > > > > > > >
> > > > > > > > > > Am I trying to hold the data of a DataGrid in a label so> > > > when
> > > > > > the
> > > > > > > > > form
> > > > > > > > > > is reposted the DataGrid can be repopulated. The problemSub> > am> > order> > > > > having
> > > > > > > is
> > > > > > > > > that
> > > > > > > > > > I don't understand how to get the text into a stream in> > width="100%"> > > to
> > > > > be
> > > > > > > able
> > > > > > > > > to
> > > > > > > > > > use DataSetOutcomes1.ReadXML(MyStream).
> > > > > > > > > >
> > > > > > > > > > Thanks in advance,
> > > > > > > > > >
> > > > > > > > > > James
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Web Form:
> > > > > > > > > >
> > > > > > > > > > <%@ Page Language="vb" AutoEventWireup="false"
> > > > > > > > > > Codebehind="course_new.aspx.vb"
> > > > > > > > > > Inherits="_1137InsetBookingSystem.course_new"%>
> > > > > > > > > > <!-- #INCLUDE file="headeraspx.inc" -->
> > > > > > > > > > <!-- #INCLUDE file="tableheader.inc" -->
> > > > > > > > > > <form id="FormNewCourse" method="post" runat="server">
> > > > > > > > > > <table cellSpacing="0" cols="3" cellPadding="0"> > Rows="5"> > > > > > > > border="0">
> > > > > > > > > > <tr>
> > > > > > > > > > <td vAlign="top"><asp:label id="lblCourseTitle"
> > > > runat="server"
> > > > > > > > > > Font-Bold="True">Course Title</asp:label></td>
> > > > > > > > > > <td><asp:textbox id="txtCourseTitle"
> > > > > > > > runat="server"></asp:textbox></td>
> > > > > > > > > > <td> </td>
> > > > > > > > > > </tr>
> > > > > > > > > > <tr>
> > > > > > > > > > <td colSpan="3"><asp:label id="lblCourseTutorList"
> > > > > runat="server"
> > > > > > > > > > Font-Bold="True">Course Tutor(s)</asp:label></td>
> > > > > > > > > > </tr>
> > > > > > > > > > <tr>
> > > > > > > > > > <td vAlign="top"> </td>
> > > > > > > > > > <td><asp:textbox id="txtCourseTutor"
> > > > > > > > runat="server"></asp:textbox></td>
> > > > > > > > > > <td><asp:button id="cmdAdd" runat="server" Text="Add"
> > > > > > > > > BackColor="#F6CD7A"
> > > > > > > > > > BorderStyle="Solid" BorderWidth="1px"
> > > > > > > > > > Width="80px"></asp:button></td>
> > > > > > > > > > </tr>
> > > > > > > > > > <tr>
> > > > > > > > > > <td> </td>
> > > > > > > > > > <td><asp:textbox id="txtTutorList" runat="server"> > SortExpression="Name"> > > > > > > > > > TextMode="MultiLine"></asp:textbox></td>
> > > > > > > > > > <td> </td>
> > > > > > > > > > </tr>
> > > > > > > > > > <tr>
> > > > > > > > > > <td colSpan="3"><asp:label id="lblLearningOutcomes"
> > > > > > runat="server"
> > > > > > > > > > Font-Bold="True">Learning Outcomes</asp:label></td>
> > > > > > > > > > </TD></tr>
> > > > > > > > > > <tr>
> > > > > > > > > > <td> </td>
> > > > > > > > > > <td><asp:textbox id="txtOutcome"
> > > > > > runat="server"></asp:textbox></td>
> > > > > > > > > > <td><asp:button id="cmdAddOutcome" runat="server"
> > > Text="Add"
> > > > > > > > > > BackColor="#F6CD7A" BorderStyle="Solid"
> > > > > > > > > > BorderWidth="1px" Width="80px"
> > > > > > > > > > CausesValidation="False"></asp:button></td>
> > > > > > > > > > </tr>
> > > > > > > > > > <tr>
> > > > > > > > > > <td> </td>
> > > > > > > > > > <td><asp:datagrid id=DataGridOutcomes runat="server"
> > > > > > > GridLines="None"
> > > > > > > > > > AutoGenerateColumns="False" DataMember="Outcomes"
> > > > DataSource="<%#
> > > > > > > > > > DatasetOutcomes1 %>">
> > > > > > > > > > <HeaderStyle Font-Bold="True"></HeaderStyle>
> > > > > > > > > > <Columns>
> > > > > > > > > > <asp:TemplateColumn>
> > > > > > > > > > <ItemTemplate>
> > > > > > > > > > <ul>
> > > > > > > > > > <li>
> > > > > > > > > > </li>
> > > > > > > > > > </ul>
> > > > > > > > > > </ItemTemplate>
> > > > > > > > > > </asp:TemplateColumn>
> > > > > > > > > > <asp:BoundColumn DataField="Name"> > > > > > > > > > HeaderText="Name"></asp:BoundColumn>
> > > > > > > > > > <asp:BoundColumn DataField="DisplayOrder"
> > > > > > > > > > SortExpression="DisplayOrder"
> > > > > > > > HeaderText="DisplayOrder"></asp:BoundColumn>
> > > > > > > > > > <asp:ButtonColumn Text="Delete"
> > > > > > > > > > ButtonType="PushButton"></asp:ButtonColumn>
> > > > > > > > > > <asp:ButtonColumn Text="Edit"
> > > > > > > > > > ButtonType="PushButton"></asp:ButtonColumn>
> > > > > > > > > > </Columns>
> > > > > > > > > > </asp:datagrid></td>
> > > > > > > > > > <td> </td>
> > > > > > > > > > </tr>
> > > > > > > > > > <tr>
> > > > > > > > > > <td colSpan="3"><asp:label id="lblOutcomes"
> > > > > > > > > > runat="server"></asp:label></td>
> > > > > > > > > > </tr>
> > > > > > > > > > </table>
> > > > > > > > > > </form>
> > > > > > > > > > <!-- #INCLUDE file="tablefooter.inc" -->
> > > > > > > > > > <!-- #INCLUDE file="footer.inc" -->
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Code Bind:
> > > > > > > > > >
> > > > > > > > > > Imports System
> > > > > > > > > > Imports System.IO
> > > > > > > > > > Imports System.Xml
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > Public Class course_new
> > > > > > > > > > Inherits System.Web.UI.Page
> > > > > > > > > >
> > > > > > > > > > #Region " Web Form Designer Generated Code "
> > > > > > > > > >
> > > > > > > > > > 'This call is required by the Web Form Designer.
> > > > > > > > > > <System.Diagnostics.DebuggerStepThrough()> PrivateWeb> "DatasetOutcomes"> > > > > > > > > > InitializeComponent()
> > > > > > > > > > Me.DatasetOutcomes1 = New
> > > > > > > > _1137InsetBookingSystem.DatasetOutcomes
> > > > > > > > > > CType(Me.DatasetOutcomes1,
> > > > > > > > > > System.ComponentModel.ISupportInitialize).BeginIni t()
> > > > > > > > > > '
> > > > > > > > > > 'DatasetOutcomes1
> > > > > > > > > > '
> > > > > > > > > > Me.DatasetOutcomes1.DataSetName => required> > > > > > > > > > Me.DatasetOutcomes1.Locale = New
> > > > > > > > > > System.Globalization.CultureInfo("en-GB")
> > > > > > > > > > CType(Me.DatasetOutcomes1,
> > > > > > > > > > System.ComponentModel.ISupportInitialize).EndInit( )
> > > > > > > > > >
> > > > > > > > > > End Sub
> > > > > > > > > > Protected WithEvents lblCourseTitle As
> > > > > > > > System.Web.UI.WebControls.Label
> > > > > > > > > > Protected WithEvents txtCourseTitle As
> > > > > > > > > System.Web.UI.WebControls.TextBox
> > > > > > > > > > Protected WithEvents txtCourseTutor As
> > > > > > > > > System.Web.UI.WebControls.TextBox
> > > > > > > > > > Protected WithEvents txtTutorList As
> > > > > > > > System.Web.UI.WebControls.TextBox
> > > > > > > > > > Protected WithEvents cmdAdd As
> > > > > System.Web.UI.WebControls.Button
> > > > > > > > > > Protected WithEvents txtOutcome As
> > > > > > > System.Web.UI.WebControls.TextBox
> > > > > > > > > > Protected WithEvents cmdAddOutcome As
> > > > > > > > System.Web.UI.WebControls.Button
> > > > > > > > > > Protected WithEvents lblCourseTutorList As
> > > > > > > > > > System.Web.UI.WebControls.Label
> > > > > > > > > > Protected WithEvents lblLearningOutcomes As
> > > > > > > > > > System.Web.UI.WebControls.Label
> > > > > > > > > > Protected WithEvents DataGridOutcomes As
> > > > > > > > > > System.Web.UI.WebControls.DataGrid
> > > > > > > > > > Protected WithEvents DatasetOutcomes1 As
> > > > > > > > > > _1137InsetBookingSystem.DatasetOutcomes
> > > > > > > > > > Protected WithEvents lblOutcomes As
> > > > > > > System.Web.UI.WebControls.Label
> > > > > > > > > >
> > > > > > > > > > 'NOTE: The following placeholder declaration is> System.Object> > > by
> > > > > the
> > > > > > > Web
> > > > > > > > > Form
> > > > > > > > > > Designer.
> > > > > > > > > > 'Do not delete or move it.
> > > > > > > > > > Private designerPlaceholderDeclaration As> > ByVal> > > > > > > > > >
> > > > > > > > > > Private Sub Page_Init(ByVal sender As System.Object,> > > e
> > > > > As
> > > > > > > > > > System.EventArgs) Handles MyBase.Init
> > > > > > > > > > 'CODEGEN: This method call is required by the> Me.DatasetOutcomes1> > Form> > ByVal> > > > > > > Designer
> > > > > > > > > > 'Do not modify it using the code editor.
> > > > > > > > > > InitializeComponent()
> > > > > > > > > > End Sub
> > > > > > > > > >
> > > > > > > > > > #End Region
> > > > > > > > > > Public gstrTableTitle As String = "Create Course"
> > > > > > > > > > Public gstrTableAttribs As String
> > > > > > > > > >
> > > > > > > > > > Private Sub Page_Load(ByVal sender As System.Object,> > > e
> > > > > As
> > > > > > > > > > System.EventArgs) Handles MyBase.Load
> > > > > > > > > > 'Put user code to initialize the page here
> > > > > > > > > > If Not Page.IsPostBack Then
> > > > > > > > > > Me.DataGridOutcomes.DataBind()
> > > > > > > > > > Else
> > > > > > > > > > Dim str As String = Me.lblOutcomes.Text
> > > > > > > > > > Dim MyStream As StreamReader
> > > > > > > > > >
> > > > > > > > > > If str.Length > 0 Then
> > > > > > > > > > MyStream = New StreamReader(str)
> > > > > > > > > > Me.DatasetOutcomes1.ReadXml(MyStream)
> > > > > > > > > >
> > > > > > > > > > End If
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > 'Me.DatasetOutcomes1.GetXml()
> > > > > > > > > > '
> > > > > > > > > >
> > > > > > > > > > End If
> > > > > > > > > > End Sub
> > > > > > > > > >
> > > > > > > > > > Private Sub UpdateOutcomes()
> > > > > > > > > > Me.DataGridOutcomes.DataSource => System.Object,> > > > > > > > > > Me.DataGridOutcomes.DataBind()
> > > > > > > > > > End Sub
> > > > > > > > > >
> > > > > > > > > > Private Sub cmdAdd_Click(ByVal sender As> Me.txtTutorList.Text> > Me.txtCourseTutor.Text)> > > > ByVal
> > > > > e
> > > > > > As
> > > > > > > > > > System.EventArgs) Handles cmdAdd.Click
> > > > > > > > > >
> > > > > > > > > > If InStr(Me.txtTutorList.Text,> > > <
> > > > 1
> > > > > > > Then
> > > > > > > > > > If Me.txtTutorList.Text.Length > 0 Then
> > > > > > > > > > Me.txtTutorList.Text =>> > &> > Me.txtCourseTutor.Text> > > > ";"
> > > > > &
> > > > > > > > vbCrLf
> > > > > > > > > &
> > > > > > > > > > Me.txtCourseTutor.Text
> > > > > > > > > > Else
> > > > > > > > > > Me.txtTutorList.Text => >> > > > > > > > > > End If
> > > > > > > > > > End If
> > > > > > > > > > End Sub
> > > > > > > > > >
> > > > > > > > > > Private Sub cmdAddOutcome_Click(ByVal sender As
> > > > System.Object,
> > > > > > > ByVal
> > > > > > > > e
> > > > > > > > > > As System.EventArgs) Handles cmdAddOutcome.Click
> > > > > > > > > > Dim dr As DatasetOutcomes.OutcomesRow
> > > > > > > > > >
> > > > > > > > > > dr = Me.DatasetOutcomes1.Outcomes.NewRow()
> > > > > > > > > > dr.Item("Name") = Me.txtOutcome.Text
> > > > > > > > > > dr.Item("DisplayOrder") =
> > > > > > > > Me.DatasetOutcomes1.Outcomes.Rows.Count
> > > > > > > > > > 'DatasetOutcomes1.Outcomes.Rows.InsertAt(dr,
> > > > > > > > > > Me.DatasetOutcomes1.Outcomes.Rows.Count)
> > > > > > > > > >
> > > > > > > > > > DatasetOutcomes1.Outcomes.Rows.Add(dr)
> > > > > > > > > > Me.DataGridOutcomes.DataBind()
> > > > > > > > > >
> > > > > > > > > > Me.lblOutcomes.Text = Me.DatasetOutcomes1.GetXml
> > > > > > > > > >
> > > > > > > > > > End Sub
> > > > > > > > > >
> > > > > > > > > > End Class
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
James Norton-Jones Guest



Reply With Quote

