|
I'm sure he's aware now.
Guess overall, perhaps it's the way you crafted your question. it did sort of sounded like you wanted code written. But I read through that and realized you needed interpretation and design.
I was in the same boat as well, started using this site back in 2011 pretty heavy, asked lots of questions for years, and then took the time to help others as a way to pay for the help given to me. But I learned how to better craft my questions, and if I need code written I just ask flat out.
Now I spend more time on Focus Fanatics because I'm in the process of restoring my car and will add a turbo to it next year, parts built from scratch using 3D CAD and casting from 3D printer output after creating a negative of the printed part.
Even on a car forum, you get the same thing, "Oh that's easy and a you tube link"; but others offer tech info you would of never thought of.
|
|
|
|
|
That's very nice of you giving back.
Back in the day, I was very awesome with classic asp.
But I started perhaps as an aweful newbie and it took folks like you to help a newbie.
Then I started giving back too at experts-exchange. It feels better to give than to ask.
In any case, I was not asking for interpretation.
I have found the transition from classic asp to asp.net a bit harder than I had envisioned but it gets better every day.
The code I posted worked pretty good if you just wanted to enter stuff in markup and email as pdf attachment.
The only area I needed help on was to extend it so I can save user's entry in the db and at same time grab it, convert to pdf and email it, all on the fly.
I have figured it out.
It may not be the best approach but it works and I am fine with the design.
So, as I have it now, I use stored procedure to insert records into the db and while the record is being inserted, grab the data as they are being entered by the user, convert them to pdf and email.
Thanks for everything.
|
|
|
|
|
There is such a condition:
To download the content of Outbox from the server of EIS demonstrator films sends a request to the address on the Internet: https://ekinobilet.ru/ekbs/upload.aspx via HTTPS Protocol, method: POST, MIME-type: multipart/form-data in accordance with RFC1867 (http://www.ietf.org/rfc/rfc1867.txt). The request must contain three parameters:
1) login (string username);
2) password (string PASSWORD);
3) get (list | all | <file_name>,<file_name>,...).
Quite a lot of time I suffer over this task, after having tried different options without success. It is necessary that when you open the page, the controller has made a request to the web service and displays the list in the View. I will be very grateful for the help of the community.
|
|
|
|
|
|
 The first problem was solved this way
public async Task<ActionResult> Test()
{
var parameters = new List<KeyValuePair<string, string>>
{
new KeyValuePair<string, string>("login", ""),
new KeyValuePair<string, string>("password", ""),
};
var data = new FormUrlEncodedContent(parameters);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://ekinobilet.ru/ekbs/upload.aspx");
request.Method = "POST";
byte[] dataArray = await data.ReadAsByteArrayAsync();
request.ContentLength = dataArray.Length;
request.ContentType = "application/x-www-form-urlencoded";
var dataStream = await request.GetRequestStreamAsync();
dataStream.Write(dataArray, 0, dataArray.Length);
dataStream.Close();
var resp = await request.GetResponseAsync();
dataStream = resp.GetResponseStream();
Stream receiveStream = resp.GetResponseStream();
StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);
var responseText = readStream.ReadToEnd();
StringBuilder output = new StringBuilder();
XmlReader reader = XmlReader.Create(new StringReader(responseText));
{
reader.ReadToFollowing("list");
reader.MoveToFirstAttribute();
string count = reader.Value;
output.AppendLine(count);
string size = reader.Value;
output.AppendLine(size);
string file = reader.Value;
output.AppendLine(file);
string name = reader.Value;
output.AppendLine(name);
}
ViewBag.list = output.ToString();
return View(responseText);
|
|
|
|
|
The challenge now is to send an xml file with an operating authorization that was above...
|
|
|
|
|
hi guys,
I have developed a MVC implementation 5, it works perfectly locally
but I published it on IIS and I have had this problem
//
in the controller I
public ActionResult Index ()
{
CatalogModel m = new CatalogModel ();
m.LocalCodeColumn = 1;
m.PriceColumn = 2;
m.SelectedClientList = m.GetClientSelectedItems ();
return View (m);
}
and in the view:
Select Client: @ Html.DropDownListFor (m => m.SelectedClientList, Model.GetClientSelectedItems (), "--Select--", new {@id = "ddlClient"})
and this function :
public IEnumerable<SelectListItem> GetClientSelectedItems()
{
IEnumerable<SelectListItem> listClient = dataServices.GetClients();
return listClient;
}
modified 20-Oct-16 11:13am.
|
|
|
|
|
I made that same mistake when I started writing MVC, and after days of research, I determined that using a dictionary is the best method to use because select list are really just key value pairs.
So when razor goes to construct the dropdownlist, it can consume the dictionary with ease.
Model
public class CatalogModel
{
public int LocalCodeColumn { get; set; }
public Dictionary<string, string> CustomerTypes { get; set; }
}
Controller
public ActionResult Index()
{
CatalogModel m = new CatalogModel();
m.CustomerTypes = SelectListHelper.Get_Customer_Types();
return View(m);
}
SelectHelper Class
public static Dictionary<string, string> Get_Customer_Types()
{
return new Dictionary<string, string>
{
{"Private", "PRIVATE"},
{"Public", "PUBLIC"},
{"Both", "BOTH"}
};
}
View
@Html.DropDownListFor(m => m.CustomerType, new SelectList(Model.select_customerType, "Value", "Key"), "-- Select Customer Type --", new { @class = "form-control" })
|
|
|
|
|
I have a modal popup form and i want to insert/delete into a database and show/remove in a data table. Does anyone know how to do this. Here is the code for the modal:
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!--
<div class="modal-content">
<div class="modal-header">
Point of Contact
</div>
<div class="modal-body">
<div class="name-text-container">
<span id="fname-text">First Name:</span>
<span id="mname-text">MI:</span>
<span id="lname-text">Last name*:</span><br>
</div>
<div class="name-input-container">
<form>
<input id="fname-input" type="text" name="fname" size="15">
<input id="mname-input" type="text" name="mname" maxlength="1" size="1">
<input id="lname-input" type="text" name="lname" size="16"><br>
</form>
</div>
<div class="email-text-container">
<span id="email-text">Email*:</span><br>
</div>
<div class="email-input-container">
<form>
<input id="email-input" type="text" name="email" size="47"><br>
</form>
</div>
<div class="contact-text-container">
<span id="telephone-text">Telephone:</span>
<span id="fax-text">Fax:</span><br>
</div>
<div class="contact-input-container">
<form>
<input id="telephone-input" type="text" name="telephone" size="20">
<input id="fax-input" type="text" name="fax" size="19"><br>
</form>
</div>
</div>
<!--
<div class="modal-footer">
<button type="button" data-dismiss="modal">Cancel</button>
<button type="button" data-dismiss="modal">Save</button>
</div>
|
|
|
|
|
1. Create a jquery function on click event of the on save button.
2. Remove the data-dismiss attribute from the save button.
3. Start writing function in javascript =>
function Save()
{
var Employee = {
fname: $("#fname").val(),
mname: $("#mname").val(),
lname: $("#lname").val()
};
$.ajax({
type:"post",
url:"write url of server method here",
data:JSON.stringify(Employee),
dataType:"json",
success:function(data){
alert("Data saved successfully !");
}
});
}
4. Create server method for save with class as parameter.public string Save(Employee emp).
5. Return the result from that method as string.
6. Get all records on pageload function, your grid will be updated.
7. Similarly for delete create a function and call on the click event of delete button.
|
|
|
|
|
SqlConnection con;
con = new SqlConnection(@"Data Source=SEPEHR;Integrated Security=True;server=(local);Database=TestDatabaseByYall");
con.Open();
SqlCommand cmd;
cmd = new SqlCommand("INSERT INTO tbl_CustInfo (codemeli,mydate,name,idnasb,iddevice,email,mobile,tel,adress)" + "VALUES (@codemeli,@mydate,@name,@idnasb,@iddevice,@email,@mobile,@tel,@adress)", con);
cmd.Parameters.AddWithValue("@codemeli", txtcodemeli.Text.Trim().ToString());
cmd.Parameters.AddWithValue("@mydate", mydat);
statuse = false;
cmd.Parameters.AddWithValue("@name", txtname.Text);
cmd.Parameters.AddWithValue("@idnasb", dridnasb.SelectedItem.Value);
cmd.Parameters.AddWithValue("@iddevice", drdevice.SelectedItem.Value);
cmd.Parameters.AddWithValue("@email", txtemail.Text.Trim());
cmd.Parameters.AddWithValue("@mobile", txtmobile.Text.Trim().ToString());
cmd.Parameters.AddWithValue("@tel", txttel.Text.Trim().ToString());
cmd.Parameters.AddWithValue("@adress", txtAdress.Text.Trim());
cmd.ExecuteNonQuery();
lblresult.Text = "Successful!";
SqlCommand cmd2;
string vart="1";
string varf="0";
cmd2 = new SqlCommand("INSERT INTO tbl_Customer_Statuse (idcustomer,level1,level2,level3,level4,Complate)" + "VALUES (@codemeli,@level1,@level2,@level3,@level14,@Complate)", con);
cmd2.Parameters.AddWithValue("@codemeli",txtcodemeli.Text.Trim());
cmd2.Parameters.AddWithValue("@level1",vart);
cmd2.Parameters.AddWithValue("@level2",varf);
cmd2.Parameters.AddWithValue("@level3",varf);
cmd2.Parameters.AddWithValue("@level4",varf);
cmd2.Parameters.AddWithValue("@Complate",varf);
cmd2.ExecuteNonQuery();
con.Close();
|
|
|
|
|
Huh?
Well, good luck with that!
|
|
|
|
|
but in second table did not fill
|
|
|
|
|
Have you tried debugging your code? Have you checked the values being passed to your query? Are you getting errors?
As a side note, please make it a habit to use the using statement when dealing with objects that eat resources such as SqlConnection and SqlCommand to ensure that the object will be properly closed and disposed after you use them.
Finally, place your connectionString within your config file so you can easily switch and modify the settings when needed without compiling your code.
modified 17-Oct-16 18:21pm.
|
|
|
|
|
|
At least one visible problem seems to be that you have mispelled the @level4 parameter. In the insert statement you have @level14 but in the parameters you have @level4 (without 1). That should cause an exception in your code.
In overall you seem to be missing few elemental parts
- You don't have any error handling
- you don't dispose objects etc.
I suggest going through Properly executing database operations[^]
modified 17-Oct-16 15:35pm.
|
|
|
|
|
thank you 
|
|
|
|
|
You're welcome
|
|
|
|
|
Probably just poor planning on my part, but I thought I could get away with it.
I have a model that populates a page with items in a store. On get it grabs from the database and populates the view.
Now I have a filter bar wrapped in form tags. In the filter bar is 2 textboxes to filter by price, which works in postback. The next is a ul of li's for checkboxes that returns null.
I thought all input elements would postback fine. The textboxes do.
This is my view
using (Html.BeginForm())
{
<ul id="selectBrand" class="dropdown-menu selectBrand-menu" role="menu">
@foreach (model_storeBrowse_Brands_Filters bfilter in Model.Brand_Filters)
{
<li role="presentation">
@Html.CheckBox(bfilter.Name, bfilter.Checked, new { @class = "dropdown-menu-control", onchange = "this.form.submit();" })
@Html.Label(bfilter.Name)
</li>
}<br />
</ul>
}
|
|
|
|
|
Well the idea was good but the design was bad. Guess somebody else had the same problem and created
@Html.CheckboxListFor which was difficult to implement because I had to change my model and CSS.
But it works now, so those are many querystrings less that I have to deal with.
I didn't want to get caught up in a querystring for every filter chosen to narrow results.
CBL(F)[^]
<div id="selectBrand" class="dropdown-menu selectBrand-menu" role="menu">
<div class="filter-bar-checkboxes">
@Html.CheckBoxListFor(x => x.Brands_Posted.BrandIDs, x => x.Brands_Available, x => x.ID, x => x.Name, x => x.Brands_Selected)
</div>
<div class="filter-bar-applyfilters">
<button id="js_filterBrand" type="submit" class="btn btn-primary">Apply Filter</button>
</div>
</div>
|
|
|
|
|
I want to track the Cut,Copy and Paste Action in c#
|
|
|
|
|
Access to the local clipboard is limited for security reasons.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
sarwajeet singh wrote: I want to track the Cut,Copy and Paste Action in c# What do you mean?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I want to create a toggle switch where the user has the choice of Purchase or Delivery. I've seen the Yes/No and True/False type of toggle switches but has anyone seen or have a way of creating a toggle switch with a that many letters.
|
|
|
|
|
Something like this[^]?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|