Click here to Skip to main content
15,901,853 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a below table structure. I am using c# and asp.net to achieve this but did not get success.

Empcode
Itemcode
category
city
sales

I have created userid and associate category and items with it. I would like to create a form below for data entry when user log in. I have also associated items with the user therefore only associated items would appear in the form. If a user has 7 items, 7 items would be appeared. the numbers below are the sales user is entering in different cities, the user would save the data in above table, this can be done with the textbox and grid but I am unable to create the form. The cities information is available in our other table.

User ID. 111111 Category. Data 1
Cities Item-1 Item-2 Item-3 

City 1 100 50 30

City 2 30 35 70

City 3 50 70 30


What I have tried:

Textbox and ajax controls on it.
Posted
Updated 22-Oct-18 22:12pm

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!
 
Share this answer
 
It's not my homework, I was unable to execute the below script as it is not working. Also, asking if any suitable solution exist as I have already tried textbox and gridview.

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript"> 
    function Save() {
        var GridView = document.getElementById('<%=gvAddTextBox.ClientID %>').outerHTML;
        for (var i = 1; i < $(GridView).find('tr').length; i++) {
            for (var j = 1; j < $(GridView).find('tr').find('td').length; j++) {
                var city = $(GridView).find('tr').eq(i).find('td').eq(0).html();
                var text = $(GridView).find('tr').eq(i).find('td').eq(1).html();
              //  var text = $(GridView).find('tr').eq(i).find('td').eq(j).find('[id*=txtDynamic]').val();
                // Ajax call to save record.
                var obj = {};
                obj.city = city;
                obj.text = text;
                $.ajax({
                    type: "POST",
                      url: "city.aspx/Save",
                           
                    data: JSON.stringify(obj),
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",                   
                    success: function (r) {
                        alert('success')
                    },
                    error: function (xhr, textStatus, errorThrown) {
                        
                        console.log(obj),
                        alert('custom message. Error: ' + errorThrown);
                    }
                });
            }
        }
        return false;
    }
</script>
 
Share this answer
 
Comments
Richard Deeming 23-Oct-18 8:54am    
This is not a "solution" to your question.

To reply to a solution, click the "Have a Question or Comment?" button under that solution.

To update your question to add the missing details, click the green "Improve question" link and edit your question.

And you'll need to give us more than "not working" as a description of the problem.

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