|
It would require a lot of code. Where are you stuck?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Google "asp.net cascading dropdowns" and you'll find various ways of making one dropdown rely on the value of another. You'll need to get the actual data from somewhere yourself though.
|
|
|
|
|
Here, You have to use Dropdown DataTextField & DataValueField . in DataTextField you have to show State like Maharashtra and in DataValueField you have to set their State_id . after that you have to fetch city data through this state_id in Database.
|
|
|
|
|
I am writing a small MVC utility to add to a large MVC application. What is the best way to do this. It is for a customer and hope I can create an installer.
|
|
|
|
|
Possibly Nuget package will be solution.
|
|
|
|
|
At this point I am very confused. I think of a Nuget package as development add-in. What I need is to create something like a button panel and insert in into the MVC application. Is there a simple example of this using a Nuget Package?
|
|
|
|
|
You should explain a bit more what you trying to do, otherwise is too vague to give any advice
|
|
|
|
|
I am developing a backup and restore PowerShell database utility and need to install it into an existing MVC enterprise application. It was indicated to me that I can create a Nuget package to install this newly created backup and recover DB PowerShell utility. What I am looking for is an example of this type of package. Does anyone know of such an example?
|
|
|
|
|
|
I want to write a program for accounting problem in FIFO method.
In FIFO accounting, the order of buys and sells are taken in a last-in-first-out manner as if they were stored in a queue.
For example, suppose you bought 100 shares of a particular stock in each of the months of January, February, and May, for prices of $10, $15, $3, respectively. And suppose you sold 100 shares in March when the price per share was $20. So you presently hold 200 shares of the stock. In calculating your gain or loss you wouldn't count those shares.
In FIFO accounting, our capital gain or loss would be calculated by using the March transaction as income. We would match it against the expense of the 100 shares you bought in January. Our total capital gain would be calculated as 100 X 20 - 100 X 10 = 1000. So you would have a gain of $1000.
Please provide me with an algorithm to solve this problem
|
|
|
|
|
You just have to write the code. Where are you stuck?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Yes, this subject has been covered in may post on may sites. Still, I con't get it to work 100%.
The project: Creating a dashboard with all my hardware configured.
Part of the process, is to add the devices to a SQL database.
My Dashboard.aspx is using a Masterage and the add device form is a ModalPopup.
Since systems can have more than one NIC, and more than one IP Address, I would like to have a ipv4multiselectdropdownlist.
As I said, I looked around a lot and it appears that a good way is to use a ListBox with the Bootstap plugin[^]
The result is:
<asp:panel id="AddDeviceModalPanel" style="display: none" runat="server">
<div class="HellowWorldPopup">
<div class="PopupHeader" id="PopupHeader"><asp:label runat="server" ID="ppheader" Text="Add a device" /></div>
<div class="PopupBody">
<asp:Label runat="server" ID="ppid" Visible="false" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<script type="text/javascript">
Sys.Application.add_load(BindEvents);
</script>
<table id="NewDeviceTable" runat="server">
<tr id="ipv4row" runat="server">
<td><asp:label id="ipv4lbl" runat="server" Text="IPv4" /></td>
<td>
<asp:ListBox ID="ipv4multiselection" runat="server" SelectionMode="Multiple" />
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="center">
<asp:button runat="server" id="AddDevicebtnSave" text="Save" />
<asp:button runat="server" id="AddDevicebtnCancel" text="Cancel" />
</div>
<div>
<asp:Label runat="server" ID="ppstatus" ForeColor="Red" />
</div>
</div>
</asp:panel>
<asp:HiddenField ID="hidForAddDeviceModel" runat="server" />
<ajaxToolkit:ModalPopupExtender ID="add_device_popup" runat="server" TargetControlID="hidForAddDeviceModel" PopupControlID="AddDeviceModalPanel" BackgroundCssClass="ModalPopupBG" />
Next, I keep the selection in the desired order and get the values using the[^]
<script type="text/javascript">
function BindEvents() {
var orderCount = 0;
$('[id*=ipv4multiselection]').multiselect({
includeSelectAllOption: false,
maxHeight: 200,
numberDisplayed: 2,
onChange: function (option, checked) {
if (checked) {
orderCount++;
$(option).data('order', orderCount);
}
else {
$(option).data('order', '');
}
},
buttonText: function (options) {
if (options.length === 0) {
return 'None selected';
}
else if (options.length > 3) {
return options.length + ' selected';
}
else {
var selected = [];
options.each(function () {
selected.push([$(this).text(), $(this).data('order')]);
});
selected.sort(function (a, b) {
return a[1] - b[1];
});
var text = '';
for (var i = 0; i < selected.length; i++) {
text += selected[i][0] + ', ';
}
return text.substr(0, text.length - 2);
}
},
onDropdownHidden: function (event) {
var selected = [];
$('[id*=ipv4multiselection] option:selected').each(function () {
selected.push([$(this).val(), $(this).data('order')]);
});
selected.sort(function (a, b) {
return a[1] - b[1];
});
var text = '';
for (var i = 0; i < selected.length; i++) {
text += selected[i][0] + ', ';
}
text = text.substring(0, text.length - 2);
alert(text);
}
});
}
</script>
So far, everything is working.
At some stage though, I need that IP address selection.
I was thinking that assigning the text (i.e. selection) to a label and then use the label.text in the code would work but the label never get's the value assigned
text = text.substring(0, text.length - 2);
document.getElementById("Label1").innerHTML = text;
alert(text);
}
});
}
Again, poking around, a possible solution is to use a session variable.
So, modified the above code to call a PageMethod:
text = text.substring(0, text.length - 2);
ipv4sesssionvar(text);
alert(text);
}
});
}
and, in the code behind:
<System.Web.Services.WebMethod()> Public Function ipv4sesssionvar(ByVal txt As String) As String
Session("ipv4") = txt
ipv4sesssionvar = txt
End Function
Whenever <system.web.services.webmethod()> Public Function ipv4sesssionvar(ByVal txt As String) As String is called, I'm getting a Javascript error:
JavaScript runtime error: 'PageMethods' is undefined
My Script manager has to be on the master page and is believed to be setup correctly:
<asp:scriptmanager id="ScriptManager1" runat="server" enablepagemethods="true">
I saw suggestions to disable the Optimization. Done to no avail.http://stackoverflow.com/questions/21091935/webmethod-not-called-triggered-by-pagemethod-in-visual-studio-2013[^]
Saw that Javascript modification suggestionhttp://forums.asp.net/t/1886251.aspx?Microsoft+JScript+runtime+error+PageMethods+is+undefined[^] so now, my bottom Javascript looks like this:
text = text.substring(0, text.length - 2);
ipv4sesssionvar(text);
}
});
}
function ipv4sesssionvar(text) {
PageMethods.ipv4sesssionvar(text, OnComplete);
return false;
}
function OnComplete(result) {
alert(result);
}
I'm now at a stage where I'm stuck.
So, my question is: Can anyone please unstuck me?
Alternatively: Is there really no simple way to get this all done server side? A user control or something??????
Thanks.
modified 31-Aug-15 13:45pm.
|
|
|
|
|
I've a problem deploying a modified project based on ASP.NET in Visual Studio 2013.
I've one web page built on a ASP.NET project by a former engineer. It runs on a server with the *.dll file and other types of files (*.aspx, etc).
I have the source code of the project. I made a small change to the source code. It tests out fine on my local machine. However, when I build/publish the project the project doesn't output the *.dll file. It does output a bunch of other files including the *.aspx, *.aspx.cs, and *.sln files. But I need the new *.dll file to replace the old *.dll file on the server so that the web page can be updated.
I did some look-around online. A lot of people are saying that there are two types of ASP.NET projects: websites & web applications. And only web applications will output *.dll files. Websites don't use *.dll files.
If that is the case, that means my source code is a website project but the web page running on the server was built from a web application. But I know there is only one copy of the source code and the web page running on the server has to be generated from it.
|
|
|
|
|
Where is the project, what type is it?
If it's in the Web Project and the Code is in the App_Code folder, then the DLL is self building
If it's a separate project, then the DLL is in the BIN folder of the project under Debug or Release.
When you build the DLL, in the Build pane at the bottom of VS, it tells you where the DLL was built to.
|
|
|
|
|
Let me explain to you, the basic different of these types in the terms of frameworks. An ASP.NET web site is usually the ASP.NET Web Pages framework, that was compact and best for creating small web sites such as personal blogs or contact-me pages. Where as, web applications needed more of these things, URL routing, security and other stuff such as source management also, so there were other frameworks built (Web Forms is old, and ASP.NET has left it as of ASP.NET 5) and the framework ASP.NET MVC is mostly what people refer to.
Now, if you require those .dll files, consider uploading the entire package. Visual Studio 2013 doesn't prevent you from doing so. I recently published a new site of mine using Visual Studio 2013 to a server using their Web Deploy services. Visual Studio automatically does everything, plus if you want to replace the old .dll files. Do not do that manually. You may screw things up, I would recommend that you check "Remove files already present" so that Visual Studio can set up the stuff for you and then publish the app || website.
All of the ASP.NET code is generated as HTML page and content, these are only languages and syntax for building dynamic pages. Nothing else. What services are you using? Web Deploy or FTP or what? It depends on what service you use, as to publish the content also.
In all cases, you still get to upload the .dll files. You should, and frankly even in Web Pages framework (to what others refer as website) you need to publish the .dll files required, most aren't required because if they were it would have killed the purpose of compact. But if you have to add a library, you can add it, in the /bin/ folder.
So, finally, I will recommend that you try to publish the site as a new. Do back up your content before you remove the previous content from server.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Under the "Publish Web" Window that appears when you click on "Publish Web App", Go to the settings tab, expand "File Publish Options", Tick the "Precompile during publish" check box.
Please note that you need to publish all apsx files and dll's, because the reference to the dll in the aspx file change with every publish.
Hope this helps.
|
|
|
|
|
Thank you. Your response has most directly helped me out
|
|
|
|
|
Hello,
I have a TextArea, A submit button and a check box on a Razor view, i want to load some records from the database in to the textarea and then use the submit to send Mesages to the recods loaded.
The issue is that i dont know how to load the data using the check box.
This is my code so far:
the controller:
public ActionResult Message(bool loadData)
{
List<sendmessageviewmodel> _mobile = new List<sendmessageviewmodel>();
if (loadData)
{
foreach (var item in db.ParentsModels)
{
_mobile.Add(new SendMessageViewModel { destination = item.mobile+"," });
}
}
return View(_mobile);
}
The View code is:
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
}
Thanks
|
|
|
|
|
Try searching Google using these words "mvc razor, checkbox event"
@Html.Checkbox( "somename", new { @onclick="function-to-open-dialog()"})
|
|
|
|
|
We have a message for you. But we hid it.
Unless you know the secret phrase, it will remain hidden.
Can you write the algorithm to find it?
Here is a couple of important hints to help you out:
- An anagram of the phrase is: "poultry outwits ants"
- The MD5 hash of the secret phrase is "4624d200580677270a54ccff86b9610e"
|
|
|
|
|
We STILL don't do your homework, no matter how many times you re-post it.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi,
thank you for your reply but i need guideline no need to do this task for me just tips
|
|
|
|
|
<asp:datalist id="DataList1" runat="server" repeatcolumns="2" width="50px"
="" onitemdatabound="DataList1_ItemDataBound" datakeyfield="Category">
<itemtemplate>
<%# Eval("Category")%>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
FirstFillDatalist();
}
}
DataTable set = new DataTable();
private void FirstFillDatalist()
{
adapter = new SqlDataAdapter("select * from category", con);
adapter.Fill(set);
DataList1.DataSource = set;
DataList1.DataBind();
}
data show..now go to next page with click any where means tag
it is Default.aspx page
<asp:DataList ID="DataList1" runat="server" RepeatColumns="3" Width="150px"
DataKeyField="sub_category" >
<ItemTemplate>
<%# Eval("sub_category")%>
Default.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
FirstFillDatalist();
}
private void FirstFillDatalist()
{
adapter = new SqlDataAdapter("select * from sub_category where cate_id=5", con);
DataTable set = new DataTable();
adapter.Fill(set);
DataList1.DataSource = set;
DataList1.DataBind();
}
then show only cate_id=5 value and i want to be dynamic change of "select * from sub_category where cate_id=5" cate_id value....
|
|
|
|
|
what exactly is your question?
I look at your markup and code, but I can't tell if it works or not, and where it fails.
Why not just post code for the part that fails to work? and tell us what's not working.
|
|
|
|
|
Hi.
I run a ASP.NET web site.This web site need authentication people with Microsoft ActiveDirectory.Threr are more than 500 thousand user ,10 thousand OrganizationUnit on the Domain Controller.
I wrote a function to validate people in a static class:
Hide Copy Code
static public string ValidateCredentials(string userName, string password)
{
string result = null;
try
{
log4net.ILog log = log4net.LogManager.GetLogger("Login.Aspx");
DateTime time0 = DateTime.Now;
PrincipalContext principalContext = new PrincipalContext(ContextType.Domain, StsDomainName, StsAdRootOu + "," + StsDomainDn , ContextOptions.SimpleBind,StsAdUserName, StsAdUserPswd);
if (principalContext.ValidateCredentials(StsDomainShrotName +"\\" + userName, password,ContextOptions.SimpleBind))
result = "1";
else
result = "0";
log.Debug("Time cost:" + (DateTime.Now - time0).TotalMilliseconds + "DC:" + principalContext.ConnectedServer);
}
catch (Exception e)
{
result = e.Message;
}
return result;
During hign concurrency scence, more than 2000 user login the web site at the same time. I found it cost a long time to do the validation.
But if i dim the principalContext as a static member of the class,the time cost on validation will be cut down.But the CPU usage on the web site server will raise to 90%.
anyone can help me to improve my code
|
|
|
|
|