|
-
Apr 21st, 2004, 07:50 AM
#1
Thread Starter
Addicted Member
Do i need to set something?
Hi!
I'm new to .NET and i'd like some help. Why is there a yellow highlight on the code editor between a dataset i'm trying to use? "<% DataSet11 %> Is there something i need to set?
The biggest man you ever did see was once just a baby.
Bob Marley
-
Apr 21st, 2004, 08:15 AM
#2
I wonder how many charact
You need to post the code around that so we can see it in context, otherwise not sure how you are using it or assigning it.
If this is an ASP.NET application, that code would not work.
-
Apr 21st, 2004, 09:23 AM
#3
Thread Starter
Addicted Member
Yes, it's ASP. the code goes like this:
Code:
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="prueba.aspx.vb" Inherits="bodas.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Prueba</title>
<meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
<meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:DataGrid id=DataGrid1 style="Z-INDEX: 101; LEFT: 158px; POSITION: absolute; TOP: 94px" runat="server" Font-Names="News Gothic Condensed" GridLines="Vertical" CellPadding="3" BackColor="White" BorderWidth="1px" BorderStyle="Solid" BorderColor="#999999" DataMember="Student" DataKeyField="SNo" DataSource="<% # DataSet11 %>" Height="132px" Width="268px" ForeColor="Black">
<SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#000099"></SelectedItemStyle>
<AlternatingItemStyle BackColor="#CCCCCC"></AlternatingItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="White" BackColor="Black"></HeaderStyle>
<FooterStyle BackColor="#CCCCCC"></FooterStyle>
<Columns>
<asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
</Columns>
<PagerStyle HorizontalAlign="Center" ForeColor="Black" BackColor="#999999"></PagerStyle>
</asp:DataGrid></form>
</body>
</HTML>
The biggest man you ever did see was once just a baby.
Bob Marley
-
Apr 21st, 2004, 10:28 AM
#4
I wonder how many charact
I think the proper asp tag should be DataSource="Dataset1"
however you can try DataSource='<%# DataSet1 %>'
-
Apr 21st, 2004, 11:18 AM
#5
Thread Starter
Addicted Member
It is suppose to show a page with an editable datagrid with actual data on it, but it runs "fine" except for the highlight of the scripting part of it (the tags and the first line of code referencing the "@page" part). BTW, it is written like you recommended in the last post.
The biggest man you ever did see was once just a baby.
Bob Marley
-
Apr 21st, 2004, 11:22 AM
#6
Thread Starter
Addicted Member
In fact, the moment i type the tags (<% %>) on it, they turn yellow like telling me something is wrong. the problem is that i don't know what is it.
The biggest man you ever did see was once just a baby.
Bob Marley
-
Apr 21st, 2004, 12:05 PM
#7
nononononono!
It's not telling you something's wrong at all. Because ASP can contain both HTML code and ASP code, it highlights the <% tags so that you can tell if you are in the HTML section, or in the ASP code section. Nothing more.
Tg
-
Apr 21st, 2004, 12:50 PM
#8
I wonder how many charact
Originally posted by _Yoyo
In fact, the moment i type the tags (<% %>) on it, they turn yellow like telling me something is wrong. the problem is that i don't know what is it.
Jesus... lol.. you could have said that in the beginning more explicity... I thought you meant it was highlighting when it was running in debug mode.
-
Apr 21st, 2004, 03:11 PM
#9
Thread Starter
Addicted Member
So, how come i can't see the data on the datagrid?
The biggest man you ever did see was once just a baby.
Bob Marley
-
Apr 21st, 2004, 04:33 PM
#10
I wonder how many charact
Well, first you need to make sure there is data in the dataset, using a breakpoint and stepping through the method that fills it.
Secondly, front-side ASP syntax can get tricky and fail if you're off a few characters. Setting the dataset on the code-behind will ensure its being properly set (try it if nothing else just to test it)
VB Code:
me.datagrid1.datasource= DataSet1
me.datagrid1.DataBind
Third, you may need to be more specific on the datasource...
DataSource='<%# DataSet1.Tables(0) %>'
Fourth, if you use the ASPX side, try just saying DataSource="DataGrid1" instead of using <% %>
Code:
<asp:DataGrid runat="server" id="DataGrid1" Name="DataGrid1" DataSource="DataSet1" ></asp:DataGrid>
-
Apr 21st, 2004, 05:01 PM
#11
Thread Starter
Addicted Member
Well, didn't work either. Where can i find a sample explaining how to use the datagrid on ASP.NET Web app extracting data from MS Access 2k? (was it too specific?)
The biggest man you ever did see was once just a baby.
Bob Marley
-
Apr 22nd, 2004, 07:30 AM
#12
I wonder how many charact
Are you positive there is data in the dataset?
You may want to set a breakpoint in the code behind on the line DataGrid1.DataBind, and then step one more line , and then use the Command Window and type
? DataSet1.Tables(0).Rows(0).Item(0) to see if it returns a data item...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|