|
 |
aspx_beginners thread: WebControl not accessible in this context b/c 'Private'
Message #1 by "Trey Carroll" <treycarroll@y...> on Sun, 6 Oct 2002 05:23:12
|
|
Sorry for the double posting but the forum dropped the subject on my last
submission.- tc
For some reason the compiler will not let me access the disabled property
of these buttons. (Yes, I know that I will need to re-enable the buttons-
I'm just trying to pass this hurdle before complicating things. Yes,
there is a good reason for me to be using the ODBC provider.) Thanks,
trey
**************************************************
Compiler Error Message:
BC30390: 'System.Web.UI.WebControls.WebControl.disabled' is not
accessible in this context because it is 'Private'.
Source Error:
Line 34: m_intRowNum -= 1
Line 35: if (m_intRowNum = 0) then
Line 36: back.disabled = "true"
Line 37: End if
Line 38: Response.write ("m_intRowNum:" + cstr
(m_intRowNum) + vbCrLf)
*****************************************************
The CODE:
<%@ Import Namespace="System.Web.UI" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="Microsoft.Data.Odbc" %>
<%@ Page Language="VB" Debug="true" %>
<html>
<head>
<script language="VB" runat="server">
Public shared m_intRowNum as Integer = 0
Public shared ds As New DataSet()
Public shared m_intMaxRow
Sub Page_Load(Source As Object, E As EventArgs)
if not Page.ispostback then
Dim constr As String
= "dsn=xxxx;UID=xxxxx;PWD=xxxxx;"
Dim strSQL As String
Dim cn As New OdbcConnection(constr)
strSQL = "SELECT * FROM contributions"
Dim da As New OdbcDataAdapter(strSQL, cn)
cn.Open()
da.Fill(ds,"contributions")
m_intMaxRow = ds.Tables("contributions").Rows.count -
1
Make_table
end if
End Sub
Sub gobackward(sender As Object, e As System.EventArgs)
m_intRowNum -= 1
if (m_intRowNum = 0) then
back.disabled = "true"
End if
Response.write ("RowNum:" + cstr(m_intRowNum) + vbCrLf)
Make_table
End Sub
Sub goforward(sender As Object, e As System.EventArgs)
m_intRowNum += 1
if (m_intRowNum = m_intMaxRow) then
'forward.disabled = "true"
end if
Response.write ("RowNum:" + cstr(m_intRowNum) + vbCrLf)
Make_table
end sub
sub Make_table
Dim strTableContents as String
strTableContents += "<table border='1'>"
strTableContents += "<tr>"
strTableContents += "<td>Tracking ID:</td>"
strTableContents += "<td>" + cstr(ds.Tables
("contributions").Rows(m_intRowNum)(0))+ "</td>"
strTableContents += "</tr>"
...
strTableContents += "<tr>"
strTableContents += "<td>ContactPref:</td>"
strTableContents += "<td>" + ds.Tables
("contributions").Rows(m_intRowNum)(29) + "</td>"
strTableContents += "</tr>"
strTableContents += "</table>"
display.InnerHTML = strTableContents
end sub
</script>
</head>
<body>
<form runat="server" method="post">
<center>
<table>
<tr>
<td>
<asp:button id="back" text="<<
Back " runat="server" onClick="gobackward" />
</td>
<td>
<asp:button id="forward"
onClick="goforward" text="Forward >>" runat="server" />
</td>
</tr>
</table>
<div id="display" runat="server"></div>
</center>
</form>
</html>
Message #2 by "Trey Carroll" <treycarroll@y...> on Mon, 7 Oct 2002 18:44:01
|
|
The error randomly disappeared after I changed the name of the sub from
goback to btnBackClick and from goforward to btnForwardClick. I am not
sure what the problem was, but the same syntax produces no error now.
> Sorry for the double posting but the forum dropped the subject on my
last
s> ubmission.- tc
> For some reason the compiler will not let me access the disabled
property
o> f these buttons. (Yes, I know that I will need to re-enable the
buttons-
> I'm just trying to pass this hurdle before complicating things. Yes,
t> here is a good reason for me to be using the ODBC provider.) Thanks,
t> rey
> **************************************************
C> ompiler Error Message:
B> C30390: 'System.Web.UI.WebControls.WebControl.disabled' is not
a> ccessible in this context because it is 'Private'.
> Source Error:
> Line 34: m_intRowNum -= 1
L> ine 35: if (m_intRowNum = 0) then
L> ine 36: back.disabled = "true"
L> ine 37: End if
L> ine 38: Response.write ("m_intRowNum:" + cstr
(> m_intRowNum) + vbCrLf)
*> ****************************************************
> The CODE:
> <%@ Import Namespace="System.Web.UI" %>
<> %@ Import Namespace="System.Data" %>
<> %@ Import Namespace="Microsoft.Data.Odbc" %>
<> %@ Page Language="VB" Debug="true" %>
>
>
<> html>
<> head>
<> script language="VB" runat="server">
> Public shared m_intRowNum as Integer = 0
> Public shared ds As New DataSet()
> Public shared m_intMaxRow
>
> Sub Page_Load(Source As Object, E As EventArgs)
> if not Page.ispostback then
> Dim constr As String
=> "dsn=xxxx;UID=xxxxx;PWD=xxxxx;"
> Dim strSQL As String
> Dim cn As New OdbcConnection(constr)
> strSQL = "SELECT * FROM contributions"
> Dim da As New OdbcDataAdapter(strSQL, cn)
>
>
> cn.Open()
>
> da.Fill(ds,"contributions")
> m_intMaxRow = ds.Tables("contributions").Rows.count -
1>
> Make_table
> end if
> End Sub
>
> Sub gobackward(sender As Object, e As System.EventArgs)
> m_intRowNum -= 1
> if (m_intRowNum = 0) then
> back.disabled = "true"
> End if
> Response.write ("RowNum:" + cstr(m_intRowNum) + vbCrLf)
> Make_table
>
> End Sub
>
> Sub goforward(sender As Object, e As System.EventArgs)
>
> m_intRowNum += 1
> if (m_intRowNum = m_intMaxRow) then
> 'forward.disabled = "true"
> end if
> Response.write ("RowNum:" + cstr(m_intRowNum) + vbCrLf)
> Make_table
> end sub
>
> sub Make_table
> Dim strTableContents as String
> strTableContents += "<table border='1'>"
> strTableContents += "<tr>"
> strTableContents += "<td>Tracking ID:</td>"
> strTableContents += "<td>" + cstr(ds.Tables
(> "contributions").Rows(m_intRowNum)(0))+ "</td>"
> strTableContents += "</tr>"
>
> ...
>
> strTableContents += "<tr>"
> strTableContents += "<td>ContactPref:</td>"
> strTableContents += "<td>" + ds.Tables
(> "contributions").Rows(m_intRowNum)(29) + "</td>"
> strTableContents += "</tr>"
>
> strTableContents += "</table>"
> display.InnerHTML = strTableContents
> end sub
<> /script>
<> /head>
<> body>
<> form runat="server" method="post">
> <center>
> <table>
> <tr>
> <td>
> <asp:button id="back" text="<<
B> ack " runat="server" onClick="gobackward" />
> </td>
> <td>
> <asp:button id="forward"
o> nClick="goforward" text="Forward >>" runat="server" />
> </td>
> </tr>
> </table>
> <div id="display" runat="server"></div>
> </center>
<> /form>
<> /html>
|
|
 |