Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Default8 : System.Web.UI.Page
{
   
    public int countryidx;
    public string photox;
    public string ulkeismix;

    public List<Country> item()
    {
        string sqlStatment = "select * from Country";
        string constr = System.Configuration.ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
        using (System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(constr))
        {
            using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(sqlStatment, con))
            {
                cmd.Connection.Open();
                System.Data.SqlClient.SqlDataReader reader = cmd.ExecuteReader();
                List<Country> emp = new List<Country>();
                while (reader.Read())
                {
                    Country country = new Country();
                    country.countryid = Convert.ToInt32(reader.GetValue(0));
                    country.countryname = reader.GetValue(1).ToString();
                    country.photo = reader.GetValue(2).ToString();
                    country.ctrymultiply = Convert.ToInt32(reader.GetValue(4));
                    country.ctryresult = Convert.ToInt32(reader.GetValue(3));
                    country.ctrypopulation = Convert.ToInt32(reader.GetValue(5));
                    emp.Add(country);
                }

                reader.Close();
                cmd.Connection.Close();
                return emp;
            }
        }
    }

    public class Country
    {
        public int countryid { get; set; }
        public string countryname { get; set; }
        public string photo { get; set; }
        public int ctrypopulation { get; set; }
        public int ctrymultiply { get; set; }
        public int ctryresult { get; set; }
    }

    public List<Country> Item { get; set; }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            this.Item = this.item();
        }
        else
        {
            foreach (string item in Request.Form.AllKeys)
            {
                if (item.Contains("btnSubmit"))
                {
                    string id = item.Split('_')[1].Trim();
                    string sqlStatment = "SELECT * FROM country WHERE countryid=@Id";
                    string constr = System.Configuration.ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
                    using (System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(constr))
                    {
                        using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand(sqlStatment, con))
                        {
                            cmd.Parameters.AddWithValue("@Id", id);
                            cmd.Connection.Open();
                            System.Data.SqlClient.SqlDataReader reader = cmd.ExecuteReader();
                            if (reader.Read())
                            {
                                countryidx= Convert.ToInt32(reader.GetValue(0));
                                ulkeismix = reader.GetValue(1).ToString();
                                photox = reader.GetValue(2).ToString();
                            }

                            reader.Close();
                            cmd.Connection.Close();
                        }
                    }
                    break;
                }
            }
        }
    }

    protected void ctr1(object sender, EventArgs e)
    {
        
    }

    protected void ctr2(object sender, EventArgs e)
    {

    }
}




-------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default8.aspx.cs" Inherits="Default8" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <table>
        <% foreach (var c in this.item())
            { %>
        <tr>
            <td>
                <label><%=c.countryid%></label></td>
            <td>
                <input type="text" value='<%=c.countryname %>' /></td>
            <td>
                <input type="text" value='<%=c.photo%>' /></td>
            <td>
                <input type="radio" <%=c.countryname.ToLower() == "india" ? "checked" : "" %> /></td>
            <td>
                <input type="checkbox" <%=c.countryname.ToLower() != "india" ? "checked" : "" %> /></td>
            <td>
                <a href='Details.aspx?idno=<%=c.countryid %>'>Customer Detail</a> </td>
            <td>
                <button type="submit" name="btnSubmit_<%=c.countryid%>">View</button>
            </td>
        </tr>
         <tr>
        <td>
             <input type="text" value='<%=c.ctrypopulation%>' id="s1" onchange="ctr1"/>nufus</td>
        <td>
            <input type="text" value='<%=c.ctrymultiply%>'  id="s2" onchange="ctr2"/>carpan</td>
        <td>
            <input type="text" value='<%=c.ctryresult%>' />sonuc</td>
      <td colspan="4">
            <input type="text" value='<%=(c.ctrymultiply * c.ctrypopulation).ToString("N2")+"%"%>' /></td>
    </tr>
        <% } %>
    </table>
</div>
<hr />
<div>
    <table>
        <tr>
            <td>
                <label><%=countryidx%></label>
            </td>
        </tr>
        <tr>
            <td>
                <input type="text" value='<%=ulkeismix%>' />
            </td>
        </tr>
        <tr>
            <td>
                <input type="text" value='<%=photox%>' />
            </td>
        </tr>
    </table>
    </div>
    </form>
</body>
</html>


----------------------------
I want to update the inline variables in the input element, the onchange event in the listed rows, to the table on the server side, and see the final form listed again, I don't want grid controls, java, or anything else. Is this possible only in the classical method? There is a key id number in the label section of the rows, and the event is on the server side. How should I create it? How can I pass the values ​​here?


What I have tried:

They said it wouldn't be possible without java, I was discouraged

I researched and found many examples related to Java, but my wish was the classical method. With respect and respect, I think this is difficult. An id number in each line. My code works. I have no problems. It works in my detail section. My only problem with the button is changing it in the list. Regarding this issue, there is no file in the net environment that directs to the server side part of the input structure without Java. I couldn't find anything, it's all java for some reason
Posted
Comments
OriginalGriff 13-Oct-23 16:51pm    
First thing to note: it's not "Java" - it's "Javascript".

They are very different languages, and only the latter run on the client. You can use Java to build a website backend, but it's pretty uncommon: C#, VB, PHP, and Python are the most common.

Secondly, you need to explain what you think is the "classical method" - there are a huge number of ways to build a website and none of them are uniquely known as the "classical method".
[no name] 13-Oct-23 17:41pm    
By classic, I meant only with C# commands, sir, I mean nothing other than C# commands.

Finally, I solved it with C# commands, without using Java, PHP or anything similar, it was the C# language that I call the classical method. You can remove the question if you do not use java etc.
 
Share this answer
 
Comments
Dave Kreskowiak 14-Oct-23 12:24pm    
You're not using Java at all. You're using Javascript. If you try to interchange those two terms when searching for something, you're going to get very different, and wrong, results.

There is also no such thing as "classical method". I don't care what you call it, but if you start using that term in your searches, you will get nothing useful back.

When searching for answers to your problems, it is VERY important to use the correct terminology.

Finally, what you posted as a Solution, isn't an answer. You don't explain what you did, nor shown the code you came up with. Basically, nothing useful as an answer for someone else who comes accross your problem.
Dear sir, I solved the solution with C# commands and reached the result. I'm glad to have you, sir. In the past, there was no Java and its derivatives. I solved the code and came to the conclusion. After all, this is a logic. Your valuable words gave me hope and I solved the code. I am glad to have you. I am grateful to you.



What I did is very simple, actually I am a former Cobol 74 developer, I thought, I moved and created the code, this code would be very easy with MVC, but I went through classic ASP net, I worked a lot on the algol language through Burroughs A9F master control processing mainframe systems, I solved the code, but I am comfortable with this. Microsoft products always cause difficulties, I always love the mcp burrougs a9f operating system. I'm glad to have you, sir. Without you, I would never have come to this situation. I did not use the code with those unnecessary java, php and similar stupid structures. Java is a useless language, everything can be done with the MAC C# language.
 
Share this answer
 
Comments
Dave Kreskowiak 14-Oct-23 18:05pm    
Java has nothing to do with this AT ALL. JAVASCRIPT, on the other hand, does everything on the client side that server-side code cannot do because it has no access to the client at all.

Java and Javascript are nowhere close to the same language and have very different capabilities.
Please withdraw this question, I have solved the code, the entire patent belongs to me, I will sell it to anyone who wants it, because you could not solve it, you said it could only be done with Java and its derivatives, thanks to you, I woke up, with good research, I solved the code only with C#, Java, Java derivatives, Angular etc. I know these, there are countless examples on the net, but the entire code is in C#. There is no software for it. If java is turned off for the browser, what is the use of java? It's a stupid language. No one uses Java. Not even a bank is useless. It's a ridiculous language.
 
Share this answer
 
Comments
Dave Kreskowiak 14-Oct-23 21:57pm    
Yeah, right. You're not selling whatever "solution" you have to anyone. You completely misunderstand what runs on the server-side and what runs (and in what languages) runs on the client-side.

Nobody could answer you because you never clearly explained the problem and you keep using Java and Javascript like they are the same languages.

The quality of the answers you get is directly dictated by the quality of the questions you ask.
Richard Deeming 16-Oct-23 4:12am    
Go ahead - keep posting non-solutions as "solutions" to your own question, and see how long it takes you to get banned from the site.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900