T
TT
Hi,
I have a repeater (rpt1) in my website, and I want to read all the
data when button (btnSubmit) click.
There is one thing that I don't understand.
When I add "For each item in rpt1.items" in btnSubmit_click, the item
count of rpt1 will become to 0.
But if I add "For each item in rpt1.items" in page_load, it will not.
Is anyone know why?
These are some of my codes, thank you for your help.
[.aspx]
<table>
<tr> <td>.... </td> </tr>
<tr> <td>.... </td> </tr>
<tr>
<td>
<table>
<asp:Repeater ID="rptLIST" Runat="server"
OnItemDataBound="rptLIST_ItemDataBound">
<HeaderTemplate>
<tr>
<td class="FIELDNAMETEXT" align="left" valign="top">Samp#</
td>
<td class="FIELDNAMETEXT" align="left" valign="top">Sample
code</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td class="FIELDDATATEXT" align="left" valign="top">
<asp:Label ID="lblSAMPNO" Runat="server"></asp:Label>
</td>
<td class="FIELDNAMETEXT" align="left" valign="top">
<asp:TextBox ID="txtSAMPCODE" Runat="server" MaxLength="5"
Width="50"></asp:TextBox>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</td>
</tr>
<tr>
<td align="left" valign="top" class="FIELDNAMETEXT">
<asp:Button ID="btnSUBDETAIL" Runat="server" Text="Submit"></
asp:Button>
</td>
</tr>
</table>
[.aspx.vb - 1. add in page]
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
dim item as RepeaterItem
If Not Page.IsPostBack Then
...
Else
For Each item In rptLIST.Items
...
Next item
End If
End Sub
[.aspx.vb - 2. or add in button_click]
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
dim item as RepeaterItem
If Not Page.IsPostBack Then
...
End If
End Sub
Protected Sub btnSUBDETAIL_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnSUBDETAIL.Click
dim item as RepeaterItem
For Each item In rptLIST.Items
...
Next item
End Sub
I have a repeater (rpt1) in my website, and I want to read all the
data when button (btnSubmit) click.
There is one thing that I don't understand.
When I add "For each item in rpt1.items" in btnSubmit_click, the item
count of rpt1 will become to 0.
But if I add "For each item in rpt1.items" in page_load, it will not.
Is anyone know why?
These are some of my codes, thank you for your help.
[.aspx]
<table>
<tr> <td>.... </td> </tr>
<tr> <td>.... </td> </tr>
<tr>
<td>
<table>
<asp:Repeater ID="rptLIST" Runat="server"
OnItemDataBound="rptLIST_ItemDataBound">
<HeaderTemplate>
<tr>
<td class="FIELDNAMETEXT" align="left" valign="top">Samp#</
td>
<td class="FIELDNAMETEXT" align="left" valign="top">Sample
code</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td class="FIELDDATATEXT" align="left" valign="top">
<asp:Label ID="lblSAMPNO" Runat="server"></asp:Label>
</td>
<td class="FIELDNAMETEXT" align="left" valign="top">
<asp:TextBox ID="txtSAMPCODE" Runat="server" MaxLength="5"
Width="50"></asp:TextBox>
</td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</td>
</tr>
<tr>
<td align="left" valign="top" class="FIELDNAMETEXT">
<asp:Button ID="btnSUBDETAIL" Runat="server" Text="Submit"></
asp:Button>
</td>
</tr>
</table>
[.aspx.vb - 1. add in page]
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
dim item as RepeaterItem
If Not Page.IsPostBack Then
...
Else
For Each item In rptLIST.Items
...
Next item
End If
End Sub
[.aspx.vb - 2. or add in button_click]
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
dim item as RepeaterItem
If Not Page.IsPostBack Then
...
End If
End Sub
Protected Sub btnSUBDETAIL_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnSUBDETAIL.Click
dim item as RepeaterItem
For Each item In rptLIST.Items
...
Next item
End Sub