REPEATER PROBLEM

S

Savas Ates

It shows nothing . No error and nothing on the screen.There is no error too.
Im sure sql query is returns some rows i tried it Sql query analyser ? what
is the problem ?

<asp:Repeater id="Repeater1" runat="server">

<ItemTemplate>

<%# DataBinder.Eval(Container.DataItem,"urunadi")%>

</ItemTemplate>
</asp:Repeater>

private void Page_Load(object sender, System.EventArgs e)

{

string str=ConfigurationSettings.AppSettings["db_str"];

SqlConnection con = new SqlConnection ();

con.ConnectionString=str;

con.Open();


DataSet ds =new DataSet ();



SqlDataAdapter da =new SqlDataAdapter ("",con);

da.SelectCommand.CommandText =("SELECT TOP 3 * FROM TBL_PRODUCTS");

da.Fill (ds,"SAL");


Repeater1.DataSource =ds;

if (!Page.IsPostBack )

Repeater1.DataBind ();

}
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

First I suggest you to move ALL the code inside page_load to the if
(!IsPostBAck) section

next, put a breakpoint in the line Repeater1.DataSource =ds;

put in the watch window : ds.Tables[0].Rows.Count

just to be sure you have some rows

Are you sure that the "urunadi" column exist?

write this in the watch:

ds.Tables[0].Columns["urunadi"] if it does return null the column does not
exist.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top