Monday, March 26, 2012

Panel

A Form has 2 Panels - 'pnlDataEntry' & 'pnlSummary'. 'pnlDataEntry'
houses a table with many TextBoxes & a Button (to submit the Form).
When the Form is posted, the data in the TextBoxes are fed in a SQL
Server DB table.
'pnlSummary' houses a Repeater server control which retrieves &
displays data from the same database table after the Form is posted.
When a user comes to this ASPX page for the first time, 'pnlDataEntry'
should be visible & 'pnlSummary' should be invisible. Conversely when
the Form is posted, 'pnlDataEntry' should remain invisible &
'pnlSummary' should be visible.
It shouldn't be any problem but I don't know why 'pnlSummary' is
refusing to become visible after the Form submits i.e. after the Form
submits, all I get to see is just a blank page & nothing though the DB
table does get populated with the Form data. This is how I did it:
<script runat="server">
Sub Page_Load(........)
If Not (Page.IsPostBack) Then
pnlDataEntry.Visible = True
pnlSummary.Visible = False
Else
pnlDataEntry.Visible = False
pnlSummary.Visible = True
End If
End Sub
</script>
<form runat="server">
<asp:Panel ID="pnlDataEntry" runat="server">
<%-- here comes the TextBoxes & the Button --%>
</asp:Panel>
<asp:Panel ID="pnlSummary" runat="server">
<%-- here comes the Repeater --%>
</asp:Panel>
</form>
Any idea where I could be erring?OK...OK....I got it. I wasn't binding the Repeater with any data
source which is why the Repeater wasn't getting rendered & I wasted
about an hour thinking why was the Repeater behaving so adamantly &
refusing to show itself!
Height of stupidity!!!
rn5a@.rediffmail.com wrote:
> A Form has 2 Panels - 'pnlDataEntry' & 'pnlSummary'. 'pnlDataEntry'
> houses a table with many TextBoxes & a Button (to submit the Form).
> When the Form is posted, the data in the TextBoxes are fed in a SQL
> Server DB table.
> 'pnlSummary' houses a Repeater server control which retrieves &
> displays data from the same database table after the Form is posted.
> When a user comes to this ASPX page for the first time, 'pnlDataEntry'
> should be visible & 'pnlSummary' should be invisible. Conversely when
> the Form is posted, 'pnlDataEntry' should remain invisible &
> 'pnlSummary' should be visible.
> It shouldn't be any problem but I don't know why 'pnlSummary' is
> refusing to become visible after the Form submits i.e. after the Form
> submits, all I get to see is just a blank page & nothing though the DB
> table does get populated with the Form data. This is how I did it:
> <script runat="server">
> Sub Page_Load(........)
> If Not (Page.IsPostBack) Then
> pnlDataEntry.Visible = True
> pnlSummary.Visible = False
> Else
> pnlDataEntry.Visible = False
> pnlSummary.Visible = True
> End If
> End Sub
> </script>
> <form runat="server">
> <asp:Panel ID="pnlDataEntry" runat="server">
> <%-- here comes the TextBoxes & the Button --%>
> </asp:Panel>
> <asp:Panel ID="pnlSummary" runat="server">
> <%-- here comes the Repeater --%>
> </asp:Panel>
> </form>
> Any idea where I could be erring?

0 comments:

Post a Comment