|
 |
aspx thread: Fincontrol() method will not return a result from a Datagrid
Message #1 by "Paul Rittelmann" <porsche1@y...> on Mon, 25 Mar 2002 19:00:14
|
|
I have a control I'd like to reference within a datagrid using the
findcontrol method but I keep getting the following error:
-------------------------------------------------------
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.
Source Error:
Line 192: objLabel.Text = "<a
href='http://www.cddb.com/php/search2.php3?f=artist&f=disc&q=" & objRowVals
("artist") & "+" & objRowVals("title") & ">" & objRowVals("title") & "</a>"
-------------------------------------------------------
Here is the code I'm using:
-------------------------------------------------------
Public Sub CheckTitle(ByVal objSender As Object, ByVal objArgs As
DataGridItemEventArgs)
Dim objLabel As Label
objLabel = CType(objArgs.Item.FindControl("lblTitle"), Label)
Dim objRowVals As DataRowView = CType(objArgs.Item.DataItem,
DataRowView)
objLabel.Text = "<a href='http://www.cddb.com/php/search2.php3?
f=artist&f=disc&q=" & objRowVals("artist") & "+" & objRowVals("title")
& ">" & objRowVals("title") & "</a>"
End Sub
-------------------------------------------------------
And Finally, here's the datagrid code shortened up a bit:
-------------------------------------------------------
<asp:datagrid
id="dgPopularFAQs" runat="server" Font-Names="Verdana" ForeColor="#FF8000"
BorderWidth="0px" OnItemDataBound="CheckTitle" CellPadding="5"
OnSortCommand="dgSort" AllowSorting="True" PageSize="50"
OnPageIndexChanged="dgPopularFAQs_Paged" AllowPaging="True" Font-
Size="Smaller" Font-Name="Verdana" AutoGenerateColumns="False"
EditItemStyle-BackColor="yellow" DataKeyField="id"
OnEditCommand="TryItemEdit" OnUpdateCommand="DoItemUpdate"
OnCancelCommand="DoItemCancel">
<EditItemStyle
Font-Names="Century Gothic" ForeColor="Black"
BackColor="Khaki"></EditItemStyle>
<AlternatingItemStyle BackColor="#333333"></AlternatingItemStyle>
<HeaderStyle Font-
Bold="True" HorizontalAlign="Center" ForeColor="#FF8000"
BackColor="#3F3300"></HeaderStyle>
<Columns>
<asp:TemplateColumn SortExpression="title" HeaderText="Title">
<ItemTemplate>
<asp:Label ID="lblTitle" runat="server" />
</ItemTemplate>
<EditItemTemplate>
<ASP:TextBox id="txtTitle" Text='<%# Container.DataItem("title") %
>' runat="server" Width="300"/>
</EditItemTemplate>
</asp:TemplateColumn>
</Columns>
<PagerStyle NextPageText="Next -&gt;" PrevPageText="&lt;- Prev"
HorizontalAlign="Right" ForeColor="White" BackColor="#404000"
Mode="NumericPages"></PagerStyle>
-----------------------------------------------------
Any idea why I'm getting the error?
Message #2 by Ugo Bachetti <ubachetti@h...> on Mon, 25 Mar 2002 16:42:22 -0500
|
|
Hi,
Can anyone help,
I have a datagrid that is bound to a SQL 2000 DB. When I
go to load my data in the datagrid I always get the following error:
Timeout expired. The timeout period elapsed prior to
completion of the operation or the server is not responding.
Everytime I execute a select statement that takes longer than 20 seconds I
then get the error above. Where do I go to
increase the default value for timeout.
Thanks in advance,
Ugo
|
|
 |