NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io


// Helper method to extract field value from <input> tag
private string GetInputValue(string field)
{
// Check if the field contains an input tag
int inputStartIndex = field.IndexOf("<input");
if (inputStartIndex >= 0)
{
// Find the value attribute within the input tag
int valueStartIndex = field.IndexOf("value=", inputStartIndex);
if (valueStartIndex >= 0)
{
// Extract the attribute value
int valueStartQuoteIndex = field.IndexOf('"', valueStartIndex) + 1;
int valueEndQuoteIndex = field.IndexOf('"', valueStartQuoteIndex);
if (valueStartQuoteIndex > 0 && valueEndQuoteIndex > valueStartQuoteIndex)
{
return field.Substring(valueStartQuoteIndex, valueEndQuoteIndex - valueStartQuoteIndex);
}
}
}

return string.Empty;
}


protected void FnFormSubmit(Personal_Detail model, string hiddenRowsData)
{
try
{
// Decode HTML-encoded characters
hiddenRowsData = System.Net.WebUtility.HtmlDecode(hiddenRowsData);

// Split the hidden data into individual rows
string[] rows = hiddenRowsData.Split(new[] { "</tr>" }, StringSplitOptions.RemoveEmptyEntries);

foreach (var row in rows)
{
try
{
// Split the row into individual fields
string[] fields = row.Split(new[] { "</td>" }, StringSplitOptions.RemoveEmptyEntries);
if (fields.Length < 7) // Ensure all fields are present
{
continue;
}

// Extract individual field values excluding the last field (remove input)
string expType = GetFieldValue(fields[0]);
string orgName = GetFieldValue(fields[1]);
string designation = GetFieldValue(fields[2]);
string fromDate = GetFieldValue(fields[3]);
string toDate = GetFieldValue(fields[4]);
string description = GetFieldValue(fields[5]);
int duration;
if (!int.TryParse(GetFieldValue(fields[6]), out duration))
{
// Handle invalid duration
continue;
}

// Call your stored procedure to save the data to the database
using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["dbcs"].ConnectionString))
{
con.Open();
using (SqlCommand cmd = new SqlCommand("[insert_KH004_Work_Exp]", con))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@App_no", App_no);
cmd.Parameters.AddWithValue("@expType", expType);
cmd.Parameters.AddWithValue("@orgName", orgName);
cmd.Parameters.AddWithValue("@designation", designation);
cmd.Parameters.AddWithValue("@fromDate", fromDate);
cmd.Parameters.AddWithValue("@toDate", toDate);
cmd.Parameters.AddWithValue("@description", description);
cmd.Parameters.AddWithValue("@duration", duration);
cmd.ExecuteNonQuery();
}
}
}
catch (Exception ex)
{
// Log or handle individual row processing error
// For example:
// LogError(ex);
// ShowErrorMessage("An error occurred while processing a row. Please try again later.");
}
}
}
catch (Exception ex)
{
// Handle any exceptions here
// For example:
// LogError(ex);
// ShowErrorMessage("An error occurred while processing the hidden data. Please try again later.");
}
}

// Helper method to extract field value from <td> tag
private string GetFieldValue(string field)
{
// Extract value between <td> and </td> tags
int start = field.IndexOf(">") + 1;
int end = field.LastIndexOf("<");
return field.Substring(start, end - start).Trim();
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.