में डेटा दिखाएं मैं एक एएसपी.नेट पेज लिख रहा हूं जो डेटाबेस से डेटा पढ़ता है और इसे एक टेबल में दिखाने की जरूरत है। किसी कारण से, मैं ग्रिड व्यू का उपयोग नहीं करना चाहता हूं।एएसपी.नेट एचटीएमएल टेबल
मैं HTML पृष्ठ पर किसी तालिका में डेटा कैसे दिखाऊं?
यह मेरी सी # कोड है:
SqlConnection thisConnection = new SqlConnection(dbConnection);
SqlCommand thisCommand = thisConnection.CreateCommand();
thisCommand.CommandText = "SELECT * from Test";
thisConnection.Open();
SqlDataReader reader = thisCommand.ExecuteReader();
while (reader.Read())
{
int id = reader.GetInt32(0);
string Name = reader.GetString(1);
string Pass = reader.GetString(2);
}
thisConnection.Close();
यह मेरा ASPX पृष्ठ है:
<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/test.master" CodeFile="test.aspx.cs" Inherits="test" %>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="ContentPlaceHolder">
<table width="100%" align="center" cellpadding="2" cellspacing="2" border="0" bgcolor="#EAEAEA" >
<tr align="left" style="background-color:#004080;color:White;" >
<td> ID </td>
<td> Name </td>
<td>Pass</td>
</tr>
**<%--Need the while output into here--%>**
</table>
</asp:Content>
यू कर सकते हैं pls पूर्ण समाधान ?? या किसी उदाहरण दे: इस एक बेहतर विचार और अपने सर्वर के लिए सबसे अच्छा प्रदर्शन देने तो इस कोड का उपयोग कर रहा है? या उदाहरण लिंक ?? मैं तुम्हें नहीं मिल सकता। धन्यवाद। लेकिन मुझे पेज_लोडर – riad
में आउटपुट लोड करने की आवश्यकता है, यह HTML पृष्ठ में <% # getWhileLoopData()%> का उपयोग करते समय त्रुटि दिखा रहा है। – riad
बस <% Response.Write (getWhileLoopData())%> या <% = getWhileLoopData()%> इसके बारे में खेद है .. – Mortalus