Click here to Skip to main content
15,909,939 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Focus on new added row in datagridview Pin
Paul Conrad19-Jan-08 7:16
professionalPaul Conrad19-Jan-08 7:16 
QuestionRe: Focus on new added row in datagridview Pin
ejaz_pk19-Jan-08 7:35
ejaz_pk19-Jan-08 7:35 
QuestionHow can i put a " in the Replace function Pin
SekharOne18-Jan-08 23:58
SekharOne18-Jan-08 23:58 
AnswerRe: How can i put a " in the Replace function [modified] Pin
The ANZAC19-Jan-08 1:34
The ANZAC19-Jan-08 1:34 
AnswerRe: How can i put a " in the Replace function Pin
Guffa19-Jan-08 3:37
Guffa19-Jan-08 3:37 
GeneralRe: How can i put a " in the Replace function Pin
SekharOne20-Jan-08 18:34
SekharOne20-Jan-08 18:34 
GeneralRe: How can i put a " in the Replace function Pin
Guffa21-Jan-08 12:03
Guffa21-Jan-08 12:03 
QuestionHow does Nested Datalist work? Pin
Edward Topalian18-Jan-08 23:37
Edward Topalian18-Jan-08 23:37 
hello there,
i have 2 nested datalist, and i cant call the inner one.
i just want to access its' controls (textbox, ets) from the code behind.
Here is the aspx page and followed by the aspx.vb page:

<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="testing.aspx.vb" Inherits="testing" title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script language="javascript" type="text/javascript">
// <!CDATA[



// ]]>
</script>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:bschutzConnectionString %>"
SelectCommand="SELECT [fold_id], [folder_name], [commid] FROM [folders]"></asp:SqlDataSource>
<asp:DataList ID="DataList1" runat="server" BackColor="#DEBA84" BorderColor="#DEBA84"
BorderStyle="None" BorderWidth="1px" CellPadding="3" CellSpacing="2" DataSourceID="SqlDataSource1"
GridLines="Both" Width="527px">
<FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
<SelectedItemStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
<ItemTemplate>
<table id="TABLE1" onclick="return TABLE1_onclick()">
<tr>
<td style="width: 100px; height: 21px;">
folder Id: </td>
<td style="width: 291px; height: 21px;">
<asp:Label ID="fold_idLabel" runat="server" Text='<%# Eval("fold_id") %>'></asp:Label></td>
<td style="width: 410px; height: 21px;">
</td>
</tr>
<tr>
<td style="width: 100px; text-align: left;">
folder Name:</td>
<td style="width: 291px">
<asp:LinkButton ID="LinkButton1" runat="server" Text='<%# Eval("folder_name", "{0}") %>' OnClick="LinkButton1_Click"></asp:LinkButton></td>
<td style="width: 410px; text-align: right;">
<asp:LinkButton ID="LinkButton2" Text="Edit" CommandName= "Edit" runat="server"></asp:LinkButton></td>
</tr>
<tr>
<td style="width: 100px">
</td>
<td style="width: 291px">
</td>
<td style="width: 410px">
</td>
</tr>
</table>
<br />
<asp:DataList ID="DataList2" runat="server" BackColor="LightGoldenrodYellow" BorderColor="Tan"
BorderWidth="1px" CellPadding="2" DataKeyField="id" DataSourceID="SqlDataSource1"
ForeColor="Black" Width="821px">
<FooterStyle BackColor="Tan" />
<SelectedItemStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
<ItemTemplate>
 <br />
<table>
<tr>
<td style="width: 100px">
foled id:</td>
<td style="width: 100px">
<asp:Label ID="folidLabel" runat="server" Text='<%# Eval("folid") %>'></asp:Label></td>
<td style="width: 100px">
</td>
</tr>
<tr>
<td style="width: 100px">
File Id: 
</td>
<td style="width: 100px">
<asp:Label ID="idLabel" runat="server" Text='<%# Eval("id") %>'></asp:Label></td>
<td style="width: 100px">
</td>
</tr>
<tr>
<td style="width: 100px">
File Subject:
</td>
<td style="width: 100px">
<asp:Label ID="subjectLabel" runat="server" Text='<%# Eval("subject") %>'></asp:Label></td>
<td style="width: 100px">
</td>
</tr>
</table>
<br />
<br />
<br />
</ItemTemplate>
<AlternatingItemStyle BackColor="PaleGoldenrod" />
<HeaderStyle BackColor="Tan" Font-Bold="True" />
</asp:DataList><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:bschutzConnectionString %>"
SelectCommand="SELECT [folid], [id], [subject] FROM [minutes] WHERE ([folid] = @folid)">
<SelectParameters>
<asp:ControlParameter ControlID="HiddenField1" Name="folid" PropertyName="Value"
Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<asp:HiddenField ID="HiddenField1" runat="server" Value='<%# Eval("fold_id", "{0}") %>' />
<br />
</ItemTemplate>
<ItemStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
<HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
<EditItemTemplate>
<table>
<tr>
<td style="width: 100px; height: 21px">
Folder Name</td>
<td style="width: 100px; height: 21px">
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Eval("folder_name", "{0}") %>'></asp:TextBox></td>
<td style="width: 100px; height: 21px">
<asp:LinkButton ID="LinkButton3" Text="cancel" CommandName="Cancel" runat="server"></asp:LinkButton></td>
</tr>
<tr>
<td style="width: 100px">
</td>
<td style="width: 100px">
</td>
<td style="width: 100px">
</td>
</tr>
</table>
</EditItemTemplate>
</asp:DataList> 
</asp:Content>


this is the ASPX.VB


Partial Class testing
Inherits System.Web.UI.Page

Protected Sub DataList1_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles DataList1.EditCommand
DataList1.SelectedIndex = e.Item.ItemIndex
DataList1.EditItemIndex = e.Item.ItemIndex
DataList1.DataBind()
End Sub

Protected Sub DataList1_CancelCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles DataList1.CancelCommand
DataList1.SelectedIndex = -1
DataList1.EditItemIndex = -1
DataList1.DataBind()
End Sub


Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim dtl2 As DataListItem = (DataList1.FindControl("Datalist2"))
dtl2.Visible = False
End Sub
End Class


the ERROR page

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 18: Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Line 19: Dim dtl2 As DataListItem = (DataList1.FindControl("Datalist2"))
Line 20: dtl2.Visible = False
Line 21: End Sub
Line 22: End Class

Thanks in advance

Edward Topalian
AnswerRe: How does Nested Datalist work? Pin
Edward Topalian21-Jan-08 23:42
Edward Topalian21-Jan-08 23:42 
QuestionHow to Change the name of a form Pin
saravana00118-Jan-08 22:35
saravana00118-Jan-08 22:35 
AnswerRe: How to Change the name of a form Pin
Colin Angus Mackay19-Jan-08 0:41
Colin Angus Mackay19-Jan-08 0:41 
AnswerRe: How to Change the name of a form Pin
Vimalsoft(Pty) Ltd19-Jan-08 1:32
professionalVimalsoft(Pty) Ltd19-Jan-08 1:32 
GeneralPrint Preview of Scanned images in a single form Pin
vash18-Jan-08 18:51
vash18-Jan-08 18:51 
QuestionHow to Remove a Item from a ComboBox during runtime ? Pin
SekharOne18-Jan-08 18:18
SekharOne18-Jan-08 18:18 
AnswerRe: How to Remove a Item from a ComboBox during runtime ? Pin
Ravi_2118-Jan-08 18:48
Ravi_2118-Jan-08 18:48 
GeneralRe: How to Remove a Item from a ComboBox during runtime ? Pin
SekharOne19-Jan-08 0:04
SekharOne19-Jan-08 0:04 
GeneralFolder and File manipulation Pin
vash18-Jan-08 18:16
vash18-Jan-08 18:16 
AnswerRe: Folder and File manipulation Pin
Ashfield18-Jan-08 21:40
Ashfield18-Jan-08 21:40 
GeneralRe: Folder and File manipulation Pin
Luc Pattyn19-Jan-08 3:19
sitebuilderLuc Pattyn19-Jan-08 3:19 
GeneralDocument Imaging Scanner Connection through VB6 Pin
vash18-Jan-08 18:10
vash18-Jan-08 18:10 
QuestionSetup and deploynment problem Pin
Ravi_2118-Jan-08 18:05
Ravi_2118-Jan-08 18:05 
GeneralRe: Setup and deploynment problem Pin
Vimalsoft(Pty) Ltd19-Jan-08 1:35
professionalVimalsoft(Pty) Ltd19-Jan-08 1:35 
GeneralDataGridView Cell Tooltips Pin
Kschuler18-Jan-08 9:07
Kschuler18-Jan-08 9:07 
GeneralRe: DataGridView Cell Tooltips Pin
Kschuler21-Jan-08 3:52
Kschuler21-Jan-08 3:52 
QuestionPublish VB.NET on the www web Pin
Yatish Kasa18-Jan-08 8:29
Yatish Kasa18-Jan-08 8:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.