Could anyone tell me whether datagrid in asp.net can be used without database bcos if it is used means not visible during runtime.. anyone can advise if u know in this regard.........

DataGrids, Repeaters, etc., do not have to be used with database connections, they can be bound with other collections. Take this example:

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:DataGrid ID="myDatagrid" AutoGenerateColumns="true" runat="server">
        </asp:DataGrid>
    </div>
    </form>
</body>
</html>

And the code behind

protected void Page_Load(object sender, EventArgs e)
    {
        List<string> myStrings = new List<string>() { "A", "B", "C" };
        myDatagrid.DataSource = myStrings;
        myDatagrid.DataBind();
    }

The result here is a simple grid with these results

Item 
A 
B 
C

I hope that's the answer you're looking for? Alternately, DataGrids do not have to bound to anything at all, in which case they'll not even appear when you load the page.

commented: Nice to see someone giving examples but not doing peoples' work for them :) Instructive = good! +9

The above post is correct. I want to add when you use arraylist of objects, the public properties of the objects in that arraylist are similar to columns of your SQL queried data.

thank you... but i want a grid in such a way that i want text boxes in the grid to enter values and also it automatically increment the rows after pressing enter or tab at the last cell... i have designed the grid but it is not visible at run time..... cud u pls xplain

after receiving the mail when he click on the mail i need to get the mail in asp.net

plz help me,i need it
after receiving the mail when he click on the mail i need to get the mail in asp.net

commented: If you have a question please start a thread. Posting in a 2+ year old thread with a new question = not so great ;) -2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.