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?
Printable View
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?
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.
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>
I think the proper asp tag should be DataSource="Dataset1"
however you can try DataSource='<%# DataSet1 %>'
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.
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.
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
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.Quote:
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.
So, how come i can't see the data on the datagrid?
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>
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?)
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...