Results 1 to 12 of 12

Thread: Do i need to set something?

  1. #1

    Thread Starter
    Addicted Member _Yoyo's Avatar
    Join Date
    Apr 2001
    Location
    Dominican Republic
    Posts
    187

    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

  2. #2
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    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.

  3. #3

    Thread Starter
    Addicted Member _Yoyo's Avatar
    Join Date
    Apr 2001
    Location
    Dominican Republic
    Posts
    187
    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

  4. #4
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    I think the proper asp tag should be DataSource="Dataset1"

    however you can try DataSource='<%# DataSet1 %>'

  5. #5

    Thread Starter
    Addicted Member _Yoyo's Avatar
    Join Date
    Apr 2001
    Location
    Dominican Republic
    Posts
    187
    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

  6. #6

    Thread Starter
    Addicted Member _Yoyo's Avatar
    Join Date
    Apr 2001
    Location
    Dominican Republic
    Posts
    187
    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

  7. #7
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  8. #8
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    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.

  9. #9

    Thread Starter
    Addicted Member _Yoyo's Avatar
    Join Date
    Apr 2001
    Location
    Dominican Republic
    Posts
    187
    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

  10. #10
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    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:
    1. me.datagrid1.datasource= DataSet1
    2. 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>

  11. #11

    Thread Starter
    Addicted Member _Yoyo's Avatar
    Join Date
    Apr 2001
    Location
    Dominican Republic
    Posts
    187
    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

  12. #12
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    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
  •  



Click Here to Expand Forum to Full Width