|
thanks so much,jkirkerx.I had solved this problem.
|
|
|
|
|
hello sir
i have using both fancy box and jquery paging in my project
,first i had pluged fancy box its worked fine,second i pluged jquery datatable paging for gridview, now both are not working
i checked the plugins all are correct, I DONT KNOW why its not working
muniraj
|
|
|
|
|
Well the later broke the first, that happens quite often with jquery plugins.
Something in the 2nd plugin is conflicting with the first.
If you run the web page in IE11, press F12, and select debug, the picture of the insect(bug), the debugger will stop in the error that is crashing the DOM.
Unless you wrote the plugin, it would be quite hard to fix it. So find the error, and try something else for the gridview, or decide which one of them your willing to give up.
|
|
|
|
|
|
I'm working on a project in ASP.NET MVC, using Entity Framework 4 Code-First. The project uses the generic Repository pattern. I have an entity called "Tag", and "Tag" has a relation to entity "Right" (which is a collection). It looks like this:
public class Tag
{
public Tag()
{
this.Rights = new List<Right>();
}
public string Name { get; set; }
public virtual ICollection<Right> Rights { get; set; }
}
In the Tag controller, there is an action method for "Edit", similar to this (modified for simplicity):
public ActionResult Edit(Tag entity)
{
var rights = _rightsRepository.Get(r => r.IsActive == true).ToList();
entity.Rights = rights;
Repository.Update(entity);
UnitOfWork.Commit();
return View("Index");
}
* "_rightsRepository" is "IRepository<right>", which, using Dependency Injection, goes to "Repository<right>" (generic Repository pattern).
There is a Mapping class set up for Tags and Rights, and the mapping is setup like this:
this.HasMany(t => t.Rights)
.WithMany(r => r.Tags)
.Map(m =>
{
m.ToTable("Tag_Right_Relation");
m.MapLeftKey("RightId");
m.MapRightKey("TagId");
}
When debugging and setting a breakpoint in the "Edit" action method, I can step through, and the "Tag entity" has its property "entity.Rights" set accordingly, with the correct list of "Rights". However, when the actual update is called, the "Rights" collection is not persisted.
However, when using a single database Context (e.g. "MyAppContext"), it saves properly. We have a similar relation set up for the entities "User" and "Role". It maps to "User_Role_Relation". That relation uses the exact same type of method for the Tag_Right_Relation above. The Tag_Right_Relation does not work. The User_Role_Relation DOES work.
Why is it not working with objects from two different contexts for one entity type, but for another it does?
EDIT:
---------------------------
For whatever reason, it appears that the "Tag" entity is being disconnected from EF between the "Edit(int?)" action method, and the "Edit(Tag)" method. If I retrive the Tag entity from the Repository in "Edit(Tag)" and update the "Rights" collection, it works. Why is that? In other areas of the application, we don't have to do that.
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
We are building a transportation services website that allows potential users to make transportation services requests online.
We provide the following services:
ONE WAY trip TO the airport
ONE WAY trip FROM the airport
Round Trip services
Also, users have options of what type of vehicles to use.
The vehicles include Sedan and SUV
The way it is supposed to work is this:
If trip is ONE WAY, user is charged a certain fare.
If Round Trip, the user is charged double the ONE WAY fare.
Each fare includes a 10%, a 7% tax and a 20% tip.
If preferred vehicle is SUV, there is an additional $12.00 added to the overall cost.
The code I have below captures the initial fare correctly.
It captures the discount amount, the tax amount, the tip amount, $12.00 for SUV(if that's user's preferred vehicle) and it captures the overall total cost.
The problem we are having is that it does not capture the round trip total cost.
or instance, if overall cost for one way trip from Calhum to airport is $75.00, we expect the round trip be twice that amount for the same route.
Any ideas what to fix on my code to make it work correctly?
Dim StrSQL As String = ""
Dim strWHERE As String = ""
Dim rs As SqlDataReader
Dim val As String = tripType.SelectedItem.Value
Dim suv As String = vpreferred.SelectedItem.Value
'Response.Write(val)
'Response.End()
If val = "hourly" Then
StrSQL = "select DISTINCT s.carTypes, s.Newfare as Fares, s.tip, (s.total+^SUV^) as total from vwhourly s "
strWHERE = " WHERE s.Hourly = @hourly"
If Len(suv) <> 0 Then
strWHERE += " AND s.carTypes = '" & suv & "'"
End If
Else
' StrSQL = "SELECT city, fare, (fare*(10/100)) AS Discount, (fare-Discount) * ^RT^ AS NewFare, (Newfare*(7/100)) AS tax, (newFare*(20/100)) AS tip, (Newfare + (Newfare*(7/100)) + (newFare*(20/100)) + ^SUV^) AS total FROM Rates "
StrSQL = "with CTE_Rates as " & _
"( " & _
" Select DISTINCT " & _
"City, " & _
" Fare " & _
" FROM Rates " & _
") " & _
"SELECT " & _
"City, " & _
"Fare, " & _
"Fare * 0.1 AS Discount, " & _
"(Fare * 0.9) * ^RT^ AS NewFare, " & _
"Fare * 0.063 AS Tax, " & _
"Fare * 0.18 AS Tip, " & _
"Fare * 1.143 + ^SUV^ AS Total " & _
"FROM CTE_Rates "
strWHERE = " Where city In('" & lblPreviewfromCityState.Text & "' , '" & lblPreviewDropOff.Text & "')"
End If
If suv = "SportUtilityVehicle" Then
StrSQL = Replace(StrSQL, "^SUV^", "12")
Else
StrSQL = Replace(StrSQL, "^SUV^", "0")
End If
If val Like "round_trip_*airport" Then
StrSQL = Replace(StrSQL, "^RT^", "2")
Else
StrSQL = Replace(StrSQL, "^RT^", "1")
End If
Dim conn As New SqlConnection(connStr)
Dim cmd As New SqlCommand(StrSQL & strWHERE, conn)
If val = "hourly" Then
cmd.Parameters.AddWithValue("@hourly", HourlyCharter.SelectedValue)
End If
Response.Write(StrSQL)
Response.End()
'Now open connection to the db
conn.Open()
'open recordset to receive db values
rs = cmd.ExecuteReader()
While rs.Read()
Dim tipValue As Decimal = rs("tip")
Dim totValue = rs("total")
Dim tp As String = [String].Format("{0:C}", tipValue)
Dim tot As String = [String].Format("{0:C}", totValue)
lblTip.Text = tp
lblTotal.Text = tot
End While
|
|
|
|
|
Hi All,
I am using Terelik Gridview control and able to get data. As my requirement is get value and Sum the value from "GridAggregateFunction.Sum" property. Then after I need to get the percentage in new column. Please let me know, how to added the new column to already existing Gridview and then how to get the percentage value to newly added column.
Example : Total: 1200 Percentage:480 <- (1200 *0.40)
I am using VB.net.
Please help me.
Thanks in Advance.
JohnDas
|
|
|
|
|
Hello Experts,
I have a gridview which is dynamic row generator. meaning, it generated each row dynamically. My Gridview has 8 Columns. I am using ASP.NET and when it was 7 columns everything seems to be perfect. there are no styles for my Grdiview. There is Style for Content place holder which is generated by VS2010. Now that I added new column to Gridview, 8th column is out of content place holder. Please save me from this silly issue.
Your help is much appreciated.
Thanks
Happy Coding!
|
|
|
|
|
Well, I actually did not like the idea of changing the width of master page. but that is the only solution I got when I saw HTML source after fighting one whole day. Div will adjust to the page but tr and td they do behave as they want to, though you provide a standard Style for Tr and td.
So I solved this by increasing page width in Site.Master. Any tips or solutions without increasing the Page width are much appreciated.
Your help is much appreciated.
Thanks
Happy Coding!
|
|
|
|
|
Hi guys, I'm looking for suggestions, I'm trying to find a tree view which allows me to use both client and server side coding on it and it's free
I know the good ones are not free and they shouldn't but i figured someone might have come across one
thanx alot
|
|
|
|
|
How to display youtube like progress bar on page load?
|
|
|
|
|
|
Given: (I am new to web programming)
1. Visual Studio 2013, C# / VB
2. I have a front end C# Web app that handles the UI.
3. The C# page code behind calls a vb class in an external DLL to do the business logic.
4. The VB business class needs to update info on the UI page with status, etc. as it is running so it needs access to the Page.
How do you pass the page to the VB constructor?
I have tried various options as:
C#
VBMain VBM;
VBM = New VBMain(this);
with
VB
VBMain ...
Sub New(pWebCtl as Object)
.
Dim MyLblMsg as System.Web.UI.WebControls.Label = pWebCtl.FindControl("lblMsg")
but MyLblMsg is always nothing.
How do you pass and use the web page?
If I pass the label itself I do get it but would need an UpdatePanel to have it update. (This would be put in once I get the basics working).
How to pass and use web page to an external class?
|
|
|
|
|
What exactly you need.Why you need to pass web page to a class.what you do in the external class with the web page.
if you provide more details of what you want to do and what you are expecting as result ,It will help others to provide you answer.
I think from your web page you want to pass some parameter to your external class method and do some action in that class and the method will return the data to your UI.
If this is correct then explain more detail of your requirement.
|
|
|
|
|
The external class does all the business functions of the app which is basically importing a file into QuickBooks. These files can be large.
At various times we would like to send back some status as Done nn records, nnn to go. Orders=nnn, etc.
The plan was to use the passed form so that the external class could do a
pForm.lblMsg.text = "Done nn records, nnn to go. Orders=nnn, etc." and somehow the UpdatePanel which contains lblMsg would be posted back to the user.
Currently the main page which handles screen ui functions contains a upload control that uploads the file to the server and then invokes the external class via the constructor to process that uploaded file.
The VB business class is very extensive.
If there is a better way please let me know.
|
|
|
|
|
Passing a web page as a parameter to a function seems very clunky. You don't generally pass UI objects as parameters, but instead pass their values. If your DLL needs certain values in order to give certain results, then simply pass it the values it needs, not the entire web form.
Pass the DLL only what it needs in order to give you the results you require.
"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult." - C.A.R. Hoare
Home | LinkedIn | Google+ | Twitter
|
|
|
|
|
I understand that but that is NOT what I need to do.
So are you saying that there is no way to pass the entire page as a parameter???
|
|
|
|
|
No I didn't say you could not pass the web page. I am asking you to clarify why you need to pass the entire web page to the DLL in the first place. Can you please explain why you want to pass a web page to a DLL.
"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult." - C.A.R. Hoare
Home | LinkedIn | Google+ | Twitter
|
|
|
|
|
Sorry. Wanted the web page so we can take advantage of all the methods, etc. available. Updating of various status fields and perhaps responses (if we could figure out how).
Since Asp Net is new to us and we are converting from Desktop to Web we need to be able to learn as well as get the job done. We are already behind in the project.
One of the major problems is how to do the desktop equivalent of MsgBox (MessageBox.show) and get the results in the middle or processing e.g.
importing a file that has been running for a few minutes as record 500 of 1000 just to find there is some type of problem as in the data, etc.
In the Desktop app we would put something like
RetB = MsgBox("Hit Yes to continue as is, No to Skip, Cancel to abort", VBYesNoCancel).
if Retb = VBVancel then
GoTo ExitFunction
ElseIf Retb = VBYes then
ElseIf RetB = VBNo then
Endif
The program execution stops and then resumes when the user hits Yes, no or cancel.
This is not that easy in a Web app and currently not even sure how to do it. Certainly do not want a postback to come back in and we have to start all over or loss the variables, etc.
Any ideas would be appreciated.
Thanks and have a Great 2015!
|
|
|
|
|
I understand your need to get something working quickly, but equally you don't want to make bigger problems for yourselves further down the road. By passing the web page to your DLL you are creating a dependency which will make future development and maintenance difficult to say the least.
Firstly I would move all the code that is currently embedded in your web page to a separate class that can be invoked by your web page or any other class that requires it. This removes any dependency and gives you more flexibility going forwards.
There are many different ways in which to display messageboxes on a web page. You'll need a basic grasp of javascript. Here's just example of how it can be accomplished http://www.aspsnippets.com/Articles/Display-MessageBox-in-ASP.Net-using-JavaScript.aspx[^]
"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult." - C.A.R. Hoare
Home | LinkedIn | Google+ | Twitter
|
|
|
|
|
The main pages are C#. I have not been able to convert it to VB (our main language). Gave up on it. Was always getting some type of load problem on startup. I do not remember the details.
Most of the samples for MsgBox(MessageBox.Show) only display and do not discuss in detail the main points.
1. Getting a response i.e. Yes, No, Cancel back to the invoking code.
2. This has to suspend the invoking code and not do any type of postback since the process might have been running for many minutes and do not want to restart and loose memory variables and other objects which can be time consuming. It is not clear how to preserve these variables and objects if any type of postback is to be done.
The idea was to make the web app run as the desktop app.
1. Status of where we are in the process i.e. Record #, name, etc.
2. Ability to do a MsgBox to ask user in case of problems as to what to do.
I guess that we could retry to convert or re-code the C# pages to VB again if that is the best approach.
|
|
|
|
|
Consider this. The .dll exists on the server. Even if you did have a msgbox, that code is not running on the client - client would never see this msgbox.
Why not instantiate the class in code-behind of the webpage and access methods that way. It makes no matter that it is a vb.net class. The class methods will need to return results that can then be used to render on the page as necessary.
MsgBox in server code for website can cause much grief.
There are strangers on the Plain, Croaker
|
|
|
|
|
I understand that MsgBox is a Server type of function and would not work which is why I am looking for a replacement.
I do see that there are various 'push' techniques to push data to a web page without the user doing anything like in streaming or a chat box. Surely something can be done that is similar. Somehow to keep the connection open and keep sending responses.
The VB class works now and to move the function calls to the main C# page handler would take a long time. Or perhaps I do not understand what you mean.
|
|
|
|
|
Still i cant send email .will someone help? does any change require for smtp?
when i click the button it does nt send the mail..
will someone help me to get mail..
i have changed the sender email and password here.
my code on button click
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net;
using System.Net.Mail;
namespace sms2
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void SendMail()
{
var fromAddress = "net@gmail.com";
var toAddress = YourEmail.Text.ToString();
const string fromPassword = "12345";
string subject = YourSubject.Text.ToString();
string body = "From: " + YourName.Text + "\n";
body += "Email: " + YourEmail.Text + "\n";
body += "Subject: " + YourSubject.Text + "\n";
body += "Question: \n" + Comments.Text + "\n";
var smtp = new System.Net.Mail.SmtpClient();
{
smtp.Host = "smtp.gmail.com";
smtp.Port = 2525;
smtp.EnableSsl = true;
smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
smtp.Credentials = new System.Net.NetworkCredential(fromAddress, fromPassword);
smtp.Timeout = 20000;
}
smtp.Send(fromAddress, toAddress, subject, body);
}
protected void Button1_Click(object sender, EventArgs e)
{
try
{
SendMail();
DisplayMessage.Text = "Your Comments after sending the mail";
DisplayMessage.Visible = true;
YourSubject.Text = "";
YourEmail.Text = "";
YourName.Text = "";
Comments.Text = "";
}
catch (Exception) { }
}
}
}
|
|
|
|
|
Gmail uses port 587. Also, are the from address and password correct? You need to provide full details of the error that occurs in your SendMail method.
|
|
|
|
|