Hi. I am an ASP newbie working on someone else's page, and I need a little guidance...
The page (call it Page A) contains formatting (CSS style sheet). I have added a button to the form that displays a Word document in a new window.
This works fine, but when the specsheet document is closed, Page A has lost some of its style sheet formatting. That is, the page (within the browser window) has shifted to the left and formatting of a contained grid control is lost (de-bolded, column alignment).
There is a button ('Submit') that the previous developer created that kicks off some VB processing and refreshes the page with the proper datagrid, and this button does not have the formatting effects of my btnspecsheet. Debugging, I can see that Submit sends the process back through the page's HTML, though I can't figure out why.
button Submit's VB code:
And here's button Submit's HTML. Actually, it's all the code between the end of a radiobuttonlist ("</asp:RadioButtonList>") and the beginning of a datagrid ("<asp:GridView"):
Btnspecsheet does not go back through the HTML, and I think this is the problem, but how do I get it to do so? I suspect that this has something do do with postback, but I'm too ignorant at the moment to proceed.
Any thoughts?
Chandler
The page (call it Page A) contains formatting (CSS style sheet). I have added a button to the form that displays a Word document in a new window.
VB.NET:
Protected Sub btnSpecSheet_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSpecSheet.Click
Dim specstyle As String
If Me.txtStyle.Text > "" Then
Try
specstyle = Me.txtStyle.Text
Response.Write("<script>")
Response.Write("window.open('Specsheets/" & specstyle & ".doc','_blank')")
Response.Write("</script>")
Me.txtStyle.Text = ""
Catch ex As Exception
Dim cerror As String
cerror = ex.InnerException.ToString()
End Try
End If
End Sub
This works fine, but when the specsheet document is closed, Page A has lost some of its style sheet formatting. That is, the page (within the browser window) has shifted to the left and formatting of a contained grid control is lost (de-bolded, column alignment).
There is a button ('Submit') that the previous developer created that kicks off some VB processing and refreshes the page with the proper datagrid, and this button does not have the formatting effects of my btnspecsheet. Debugging, I can see that Submit sends the process back through the page's HTML, though I can't figure out why.
button Submit's VB code:
VB.NET:
Protected Sub ButtonSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonSubmit.Click
Dim strSelected As String = Trim(RadioButtonListInquiryType.SelectedItem.Text)
If strSelected = "Invoices" Then
Me.lblStyle.Visible = False
Me.txtStyle.Visible = False
Me.btnSpecSheet.Visible = False
If Me.GridViewOpenInvoices.Rows.Count < 1 Then
Me.LabelMessage.ForeColor = Drawing.Color.Green
Me.LabelMessage.Text = "No records found.."
Me.LabelMessage.Visible = True
Else
Me.GridViewOpenInvoices.Visible = True
End If
Else
Me.GridViewOpenInvoices.Visible = False
End If
If strSelected = "Credit Memos" Then
Me.lblStyle.Visible = False
Me.txtStyle.Visible = False
Me.btnSpecSheet.Visible = False
If Me.GridViewcreditMemos.Rows.Count < 1 Then
Me.LabelMessage.ForeColor = Drawing.Color.Green
Me.LabelMessage.Text = "No records found.."
Me.LabelMessage.Visible = True
Else
Me.GridViewcreditMemos.Visible = True
End If
Else
Me.GridViewcreditMemos.Visible = False
End If
If strSelected = "Orders" Then
Me.lblStyle.Visible = False
Me.txtStyle.Visible = False
Me.btnSpecSheet.Visible = False
If Me.GridViewOrders.Rows.Count < 1 Then
Me.LabelMessage.ForeColor = Drawing.Color.Green
Me.LabelMessage.Text = "No records found.."
Me.LabelMessage.Visible = True
Else
Me.GridViewOrders.Visible = True
End If
Else
Me.GridViewOrders.Visible = False
End If
If strSelected = "Spec Sheets" Then
Me.lblStyle.Visible = True
Me.txtStyle.Visible = True
Me.btnSpecSheet.Visible = True
End If
End Sub
And here's button Submit's HTML. Actually, it's all the code between the end of a radiobuttonlist ("</asp:RadioButtonList>") and the beginning of a datagrid ("<asp:GridView"):
VB.NET:
<asp:Button ID="ButtonSubmit" runat="server" Enabled="False" Font-Bold="True"
ForeColor="Green" Text="Submit" Width="220px" />
<br />
<asp:Button ID="BacktoGrid" runat="server" Font-Bold="True" ForeColor="Green"
Text="Back To List" Visible="False" Width="104px" />
<span style="font-size: 7pt">
<asp:Label ID="lblStyle" runat="server" Font-Bold="True" Font-Size="Large" ForeColor="Green"
Text="Enter Style:" Width="97px" Visible="False"></asp:Label>
<asp:TextBox ID="txtStyle" runat="server" Visible="False"></asp:TextBox>
<asp:Button ID="btnSpecSheet" runat="server" Text="Spec Sheet" Visible="False" />
</span>
<br />
<asp:Label ID="LabelMessage" runat="server" Font-Bold="True" Font-Size="Medium"
ForeColor="Red" Text="Place message here." Visible="False"> </asp:Label>
<br />
Btnspecsheet does not go back through the HTML, and I think this is the problem, but how do I get it to do so? I suspect that this has something do do with postback, but I'm too ignorant at the moment to proceed.
Any thoughts?
Chandler