Login    Forum    Search    FAQ   Blog

Board index » Server Side Development » ASP 3.0




 Page 1 of 1 [ 4 posts ] 



Author Message
 Post subject: Fetch data 4m the datatable nd then display it
 Post Posted: Sun Nov 22, 2009 2:41 pm 
Offline

Joined: Sat Feb 21, 2009 11:23 am
Posts: 40
hello!!1 frnds

I m havin an issue

I do have 1 database and i m fetch one column data in the datatable.

I would like to display column data in the buttons on ma webpage at the
runtime.

Anybody know how 2 possible?

please help me..


Top 
 Post subject: Re: Fetch data 4m the datatable nd then display it
 Post Posted: Sun Nov 22, 2009 2:41 pm 
Offline

Joined: Sat Feb 21, 2009 11:06 am
Posts: 1794
Hi,

use a repeater control 2 place button inside nd then bind it 2 data

Code:
<ASP:Repeater id="MyRepeater" runat="server">

<ItemTemplate>
        <asp:Button runat="server" ID="btn" Text='<%# DataBinder.Eval(Container.DataItem, "title") %>' />
</ItemTemplate>
  </ASP:Repeater>



good luck



Top 
 Post subject: Re: Fetch data 4m the datatable nd then display it
 Post Posted: Sun Nov 22, 2009 2:42 pm 
Offline

Joined: Sat Feb 21, 2009 1:08 pm
Posts: 549
Code:
int top = 10, left = 10;
  for (int index = 0; index < dataTable.Columns.Count; index++)
  {
   Button button = new Button();
   button.ID = "button" + dataTable.Columns[index].ColumnName;
   button.Text = dataTable.Columns[index].ColumnName;
   button.Click += new EventHandler(button_Click);
   button.Style.Add(HtmlTextWriterStyle.Top, top.ToString());
   button.Style.Add(HtmlTextWriterStyle.Left, left.ToString());
   left += 20;
   form1.Controls.Add(button);
  }

void button_Click(object sender, EventArgs e)
{
  throw new NotImplementedException();
}



Top 
 Post subject: Re: Fetch data 4m the datatable nd then display it
 Post Posted: Sun Nov 22, 2009 2:42 pm 
Offline

Joined: Sat Feb 21, 2009 11:23 am
Posts: 40
thank u


Top 
Display posts from previous:  Sort by  
 
 Page 1 of 1 [ 4 posts ] 




Board index » Server Side Development » ASP 3.0


Who is online

Users browsing this forum: No registered users and 2 guests

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron