Click here to Skip to main content
15,905,071 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: how to select and read data in dropdownlist? Pin
_Amy24-Jul-12 1:52
professional_Amy24-Jul-12 1:52 
Questionhow can i detect when user click back button in android webkit? Pin
buffering8323-Jul-12 16:29
buffering8323-Jul-12 16:29 
Questionhow to build a project Pin
Harihareshwara23-Jul-12 5:57
Harihareshwara23-Jul-12 5:57 
AnswerRe: how to build a project Pin
Richard MacCutchan23-Jul-12 7:33
mveRichard MacCutchan23-Jul-12 7:33 
AnswerRe: how to build a project Pin
AmitGajjar27-Jul-12 18:06
professionalAmitGajjar27-Jul-12 18:06 
Questioncapture image through Webcam in asp.net 4.0 C#. Pin
ranjitsahani23-Jul-12 1:33
ranjitsahani23-Jul-12 1:33 
AnswerRe: capture image through Webcam in asp.net 4.0 C#. Pin
Richard MacCutchan23-Jul-12 3:18
mveRichard MacCutchan23-Jul-12 3:18 
AnswerRe: capture image through Webcam in asp.net 4.0 C#. Pin
Sandeep Mewara23-Jul-12 3:28
mveSandeep Mewara23-Jul-12 3:28 
QuestionA connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond Pin
Jassim Rahma22-Jul-12 5:18
Jassim Rahma22-Jul-12 5:18 
AnswerRe: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond Pin
Sandeep Mewara22-Jul-12 8:02
mveSandeep Mewara22-Jul-12 8:02 
GeneralRe: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond Pin
_Amy22-Jul-12 20:46
professional_Amy22-Jul-12 20:46 
Questionasp.net 2010 validate dates Pin
sc steinhayse20-Jul-12 14:02
sc steinhayse20-Jul-12 14:02 
AnswerRe: asp.net 2010 validate dates Pin
Sandeep Mewara20-Jul-12 17:36
mveSandeep Mewara20-Jul-12 17:36 
AnswerRe: asp.net 2010 validate dates Pin
jkirkerx21-Jul-12 18:49
professionaljkirkerx21-Jul-12 18:49 
Generalmultipe forms in same page Pin
Jassim Rahma20-Jul-12 7:08
Jassim Rahma20-Jul-12 7:08 
GeneralRe: multipe forms in same page Pin
R. Giskard Reventlov20-Jul-12 8:03
R. Giskard Reventlov20-Jul-12 8:03 
GeneralRe: multipe forms in same page Pin
Parwej Ahamad20-Jul-12 8:28
professionalParwej Ahamad20-Jul-12 8:28 
Questionurlrewriter.net Problem Pin
Jassim Rahma20-Jul-12 0:28
Jassim Rahma20-Jul-12 0:28 
AnswerRe: urlrewriter.net Problem Pin
AmitGajjar23-Jul-12 1:04
professionalAmitGajjar23-Jul-12 1:04 
AnswerRe: urlrewriter.net Problem Pin
_Amy23-Jul-12 1:36
professional_Amy23-Jul-12 1:36 
QuestionProblem: Popolating HTML Table Dynamically Pin
silentcore19-Jul-12 22:28
silentcore19-Jul-12 22:28 
XML
Hi There.
I am having a problem in populating html table from database dynamically. What i mean is that i

have a table in database that have let say 10 enteries, I want to display those 10 entries in a

html table using loop. I am new to ASP.NET, I've previously woked in php. I can present the

scenario in php and please help me do the same thing in ASP.NET. In php what i normally do is

search the database, grab the table in fetch array and in html table i create one row and use

while loop so that all of the 10 entries are populated at runtime. Here is a demonstration

code in head:


   <pre lang="PHP"><?php
           $query = mysql_query("select * from table");
           ?>


in body code:

HTML
<table>
            <tr>
            <td>Username</td>
            <td>Email</td>
            <td>Position</td>
            <td>Status</td>
            </td>
            //start of the loop
            <?php while($fetch = mysql_fetch_array($query) { ?>
            <tr>
            <td><?php echo $fetch["username"]; ?> </td>
            <td><?php echo $fetch["email"]; ?> </td>
            <td><?php echo $fetch["position"]; ?> </td>
            <td><?php echo $fetch["status"]; ?> </td>
            </tr><?php } ?>//End of loop
            </table>






When i use foreach loop in asp.net to do the same thing the it displays only the last row in the

database table...I am using three tier architecture...



C#
projectsLoad_BLL bo = new projectsLoad_BLL();

                      DataSet ds = new DataSet();
                      DataTable dt = ds.Tables[0];
                      int num = 1;
                      foreach (DataRow dr in dt.Rows)
                      {
                          lblno.Text = num.ToString();
                          lblusername.Text = dr["username"].ToString();
                          lblemail.Text = dr["email"].ToString();
                          lblposition.Text = dr["position"].ToString();
                          lblstatus.Text = dr["status"].ToString();
                          dt.NewRow();
                          num++;
                      }





In HTML Table:


ASP.NET
 <table>
               <thead>
                    <tr>
                    <th>No.</th>
                    <th>Username</th>
                    <th>Email</th>
                    <th>Position</th>
                     <th>Status</th>
                      </tr>
                        </thead>
                             <tbody>
                                <tr>
                                   <td><asp:Label ID="lblno" runat="server"

Text="Label"></asp:Label> </td>
                                   <td><asp:Label ID="lblusername" runat="server"

Text="Label"></asp:Label></td>
                                   <td><asp:Label ID="lblemail" runat="server"

Text="Label"></asp:Label></td>
                                   <td><asp:Label ID="lblposition" runat="server"

Text="Label"></asp:Label></td>
                                   <td><asp:Label ID="lblstatus" runat="server"

Text="Label"></asp:Label></td>
                                               </tr>
                                           </tbody>
                                       </table>




I know that this method is wrong...if anyone can point to the right direction...thanks in

advance
AnswerRe: Problem: Popolating HTML Table Dynamically Pin
Pankaj Nikam20-Jul-12 4:07
professionalPankaj Nikam20-Jul-12 4:07 
GeneralRe: Problem: Popolating HTML Table Dynamically Pin
silentcore5-Aug-12 8:25
silentcore5-Aug-12 8:25 
GeneralRe: Problem: Popolating HTML Table Dynamically Pin
Pankaj Nikam5-Aug-12 14:46
professionalPankaj Nikam5-Aug-12 14:46 
GeneralRe: Problem: Popolating HTML Table Dynamically Pin
jkirkerx20-Jul-12 7:47
professionaljkirkerx20-Jul-12 7:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.