The back end and web designer side code that I asked before was beautifully corrected and written by you, great teacher. Again, on the web designer side, I wanted the values coming from the database to the textbox structures to be listed along the line with the option and checkbox options checked in the loop until the end of the log reading, but I was getting errors, but I could not succeed.
yours code
back end side
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
public partial class Default3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public IEnumerable<idatarecord> ListUrunlers()
{
SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ToString());
SqlCommand command = new SqlCommand("SELECT * FROM country", connection);
connection.Open();
SqlDataReader dr = command.ExecuteReader();
while (dr.Read())
{
yield return dr;
}
}
}
web desıgner side
web form desıgner sıde
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>
<%@ Import Namespace="System.Data" %>
<title>
<% foreach (IDataRecord record in ListUrunlers()) { %>
<% } %>
<table><tbody><tr> <td><%= record["countryid"] %> </td> <td><%= record["ulkeismi"] %> </td> <td><%= record["photo"] %> </td></tr> </tbody></table>
-----------------no problems above
Where I stitched the web designer part
<% foreach (IDataRecord record in ListUrunlers()) { %>
<% } %>
<table><tbody><tr> <td><%= record["countryid"] %> </td> <td><%= record["ulkeismi"] %> </td> <td><%= record["photo"] %> </td> <td> Label2.Text = "countryid"; textbox1.Text = RECORD["countryid"].ToString() </td> <td> Label3.Text = "ulkeismi"; textbox2.Text = record["ulkeismi"].ToString() </td> <td> Label4.Text = "photo"; textbox3.Text = record["photo"].ToString() </td><td> optionchose1.checked=true </td><td> checkboxchose1.checked=true </td></tr> </tbody></table>
What I have tried:
Where I stitched the web designer part
<% foreach (IDataRecord record in ListUrunlers()) { %>
<% } %>
<table><tbody><tr> <td><%= record["countryid"] %> </td> <td><%= record["ulkeismi"] %> </td> <td><%= record["photo"] %> </td> <td> Label2.Text = "countryid"; textbox1.Text = RECORD["countryid"].ToString() </td> <td> Label3.Text = "ulkeismi"; textbox2.Text = record["ulkeismi"].ToString() </td> <td> Label4.Text = "photo"; textbox3.Text = record["photo"].ToString() </td><td> optionchose1.checked=true </td><td> checkboxchose1.checked=true </td></tr> </tbody></table>
I would like to thank you, I could not do this on the web designer side.