Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASPX newbie

Status
Not open for further replies.

hmstoo44dd

Programmer
Sep 27, 2002
32
US
How can you tell from aspx code what database/table/view/stored procedure, data is from?

I see this tag: <asp:datagrid id="dgNames" OnItemCommand="CustID_Click">

Is "dgNames" the name of the datagrid or does it refer to the data source?
 
I should explain that I'm looking at the html in the .aspx file. Where is the .net code stored?
 
There is either a .aspx.vb or .aspx.cs file that contains the code-behind code.
 
Thanks jbenson001.

This is an application we purchased so the code must be removed. I guess I need to study asp.net so I can build another form from scratch. I want to add another column to the datagrid that will give me the city where the customer lives. No problem there, but the data doesn't exist in the data source.
 
Well, you can't display what you don't have. And without the code, you have no choice but to build a new app from scratch.
 
Indeed there should be a "code behind" page* containing something like this:

Code:
dgNames.Datasource = someSource;
dgNames.DataBind();

If you don't have it, it means the aspx inherits from a class defined within a dll, available within the bin directory within the website's directory. But you can't get to that. It means you have received a pre-compiled publishing of the site.

So, if you want to change something, you should either ask the supplier of the website for a fully published version (and pay more) so that you have access to the code-behind pages, or indeed do it yourself.

* Either some .aspx.cs or .aspx.vb file
 
Is "dgNames" the name of the datagrid or does it refer to the data source?

I would think that dgNames refers to the datagrid. The datasource is something independent of the control itself. As some of the other posters have already shown, a datasource does not necessarily need to be specified right in the aspx code, but if it is, it usually will show a DataSourceID attribute something like:

Code:
       <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="CompanyID"
            [COLOR=red]DataSourceID="dsMyDataSource"[/color]>
and then in the aspx, you might see a datasouce defined like so:

Code:
      <asp:SqlDataSource ID="dsMyDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:MyDatabaseConnectionString %>"
            SelectCommand="SELECT BLAH BLAH FROM BLAH BLAH BLAH">
        </asp:SqlDataSource>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top