Click here to Skip to main content
14,766,428 members
Home » Discussions » ASP.NET
   

ASP.NET

 
GeneralRe: MVC RedirectToRouteResult Help Pin
Richard Deeming19-Oct-17 10:18
mveRichard Deeming19-Oct-17 10:18 
PraiseRe: MVC RedirectToRouteResult Help Pin
Foothill19-Oct-17 11:59
professionalFoothill19-Oct-17 11:59 
QuestionPassword Reset works in debug environment but does not work after deployment Pin
Philip Hall16-Oct-17 7:50
MemberPhilip Hall16-Oct-17 7:50 
AnswerRe: Password Reset works in debug environment but does not work after deployment Pin
A_Griffin18-Oct-17 22:49
MemberA_Griffin18-Oct-17 22:49 
GeneralRe: Password Reset works in debug environment but does not work after deployment Pin
Philip Hall19-Oct-17 6:10
MemberPhilip Hall19-Oct-17 6:10 
Generalcode for solving zero distortion tecniqueof image steganography Pin
Member 1346535714-Oct-17 10:43
MemberMember 1346535714-Oct-17 10:43 
SuggestionRe: code for solving zero distortion tecniqueof image steganography Pin
Kornfeld Eliyahu Peter14-Oct-17 23:53
professionalKornfeld Eliyahu Peter14-Oct-17 23:53 
QuestionCode is inserting only one row of records. Any ideas? Pin
samflex9-Oct-17 6:16
Membersamflex9-Oct-17 6:16 
Hi again,

This is part of our ongoing dynamic row creation in Repeater.

By default, the first row is available.

After filling in data into the cells of the first row, user clicks the Add New Row button to add another row.

This part works fine.

The issue is that whether user enters one row or several rows, when you submit the data to the database, only one row of data is saved.

Here is the code that I am using.

Any ideas how to modify this so that no matter how many rows are created in the markup, those rows are saved to the database.

Thanks in advance.

foreach (DataRow row in table.Rows)
{
    string txBoatRegNum = row.ItemArray[1] as string;
    string txTaxPayerRet = row.ItemArray[2] as string;

    if (txBoatRegNum != null & txTaxPayerRet != null)
    {
        if (string.IsNullOrEmpty(txTaxPayerRet))
        {
            txTaxPayerRet = "0";
        }
        SqlCommand aircmd = new SqlCommand("sp_savetInfo", conn);
        aircmd.CommandType = CommandType.StoredProcedure;
        aircmd.Parameters.AddWithValue("@pid", accountnumber.Text);
        aircmd.Parameters.AddWithValue("@eID", Request["pageId"]);
        aircmd.Parameters.AddWithValue("@txYr", txtTaxYr.Text);
        aircmd.Parameters.AddWithValue("@regno", txBoatRegNum);
        aircmd.Parameters.Add("@txretval", SqlDbType.Money).Value = decimal.Parse(txTaxPayerRet); //convert text back to money

        aircmd.ExecuteNonQuery();


        //Display some feedback to the user to let them know it was processed
        lblResult.ForeColor = System.Drawing.Color.Green;
        lblResult.Text = "Thank you! <br>You have successfully completed the form.";


        //If the message failed at some point, let the user know
        lblResult.ForeColor = System.Drawing.Color.Red;
        lblResult.Text = "Your form failed to save, please try again.";

    }
}

AnswerRe: Code is inserting only one row of records. Any ideas? Pin
F-ES Sitecore11-Oct-17 1:54
mveF-ES Sitecore11-Oct-17 1:54 
AnswerRe: Code is inserting only one row of records. Any ideas? Pin
ZurdoDev11-Oct-17 10:44
professionalZurdoDev11-Oct-17 10:44 
QuestionHave a form result invisible until submission? Pin
The Rarispy8-Oct-17 17:48
MemberThe Rarispy8-Oct-17 17:48 
AnswerRe: Have a form result invisible until submission? Pin
Richard Deeming9-Oct-17 9:42
mveRichard Deeming9-Oct-17 9:42 
QuestionChanging the text of a GridView buttonfield text dynamically Pin
holdorf7-Oct-17 16:10
Memberholdorf7-Oct-17 16:10 
QuestionASP.Net Core and global.asax Pin
Mou_kol6-Oct-17 0:21
MemberMou_kol6-Oct-17 0:21 
AnswerRe: ASP.Net Core and global.asax Pin
Afzaal Ahmad Zeeshan11-Oct-17 13:31
mveAfzaal Ahmad Zeeshan11-Oct-17 13:31 
QuestionDesktop application "communicating" with ASP.NET Pin
The Junior5-Oct-17 0:02
MemberThe Junior5-Oct-17 0:02 
AnswerRe: Desktop application "communicating" with ASP.NET Pin
Atlapure Ambrish5-Oct-17 5:04
professionalAtlapure Ambrish5-Oct-17 5:04 
GeneralRe: Desktop application "communicating" with ASP.NET Pin
The Junior5-Oct-17 5:24
MemberThe Junior5-Oct-17 5:24 
SuggestionRe: Desktop application "communicating" with ASP.NET Pin
Richard Deeming5-Oct-17 5:08
mveRichard Deeming5-Oct-17 5:08 
GeneralRe: Desktop application "communicating" with ASP.NET Pin
The Junior5-Oct-17 5:21
MemberThe Junior5-Oct-17 5:21 
GeneralRe: Desktop application "communicating" with ASP.NET Pin
David Mujica5-Oct-17 10:08
MemberDavid Mujica5-Oct-17 10:08 
GeneralRe: Desktop application "communicating" with ASP.NET Pin
The Junior5-Oct-17 22:34
MemberThe Junior5-Oct-17 22:34 
QuestionProgramming Chat supports video and audio and the number of connected high Pin
Member 1343772929-Sep-17 13:07
professionalMember 1343772929-Sep-17 13:07 
AnswerRe: Programming Chat supports video and audio and the number of connected high Pin
ZurdoDev2-Oct-17 5:10
professionalZurdoDev2-Oct-17 5:10 
QuestionImplementation advice for quiz with 4 choice questions Pin
Farhad Eft28-Sep-17 11:09
MemberFarhad Eft28-Sep-17 11:09 

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.