.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

How to Populate Data From database in popup box Dynamically by button click in asp.net

Posted By: Vasu Hajare     Posted Date: March 04, 2011    Points:2   Category :ASP.Net
Hello sir ,
I have one application in which there will be a button .On button click i have to bring data from database and that data i have to show in pop up box Dynamically..

Responses
Author: Karthikeyan Anbarasan       [Moderator]      
Posted Date: March 04, 2011     Points: 20   

Hi,

In which control you need to bind the control with?

Thanks
Karthik
http://www.f5debug.net
Mark as Answer if the answer solves your issue!!!
Author: Vasu Hajare             
Posted Date: March 04, 2011     Points: 20   

Hello sir,
I want to bind that data to the HTML table format.(When i will take data that data has to bind in HTML format table at Run-time and that table i have to keep in Pop up Div So there will be fixed Column like Name,Age,Phone-No etc. whenever there more data then column rows has to increase or decrease depends on data in the table)

Author: Karthikeyan Anbarasan       [Moderator]      
Posted Date: March 04, 2011     Points: 20   

Then one option you need to create a dynamic HTML table at run time like below

string htmlTable = "<table><tr><td>" + yourData + </td></tr></table>;

Similar wise loop through your dataset and crate a table with all the data dynamically and show in the popup

Thanks
Karthik
http://www.f5debug.net
Mark as Answer if the answer solves your issue!!!
Author: Dhiraj Ranka             
Posted Date: March 05, 2011     Points: 20   

The code above will create lots of table if you looping through.

Better and faster way wood be to either use Literal control and keep on adding row to table control

or

just repeat following HTML part in your loop, the no. of column will differ depending upon your database table

string rowData = <tr><td>" + yourData + </td></tr>


Hope this helps.

Hope this helps.

Thanks & Regards,
Dhiraj Ranka
http://www.twitter.com/dhirajranka | http://www.dhirajranka.com
Author: Maverick             
Posted Date: March 07, 2011     Points: 20   

Hello,

The best way is to use stringbuilder in your code it will be the fastest to bi=uild your tables dynamically

stringbuilder str=<tr><td>"+data+</td></tr>
str+=<tr><td>"+nextrow+"</td></tr>

Thanks
Maverick

Thanks,
Maverick


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend