|
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.
|
|
|
|
|
vao, its done but i received an email that is following
We recently blocked a sign-in attempt to your Google Account [mailinternet@gmail.com].
Sign in attempt details
Date & Time: Sunday, December 28, 2014
Location: jhgfgyugfuy
If this wasn't you
Please review your Account Activity page at https://security.google.com/settings/security/activity to see if anything looks suspicious. Whoever tried to sign in to your account knows your password; we recommend that you change it right away.
If this was you
You can switch to an app made by Google such as Gmail to access your account (recommended) or change your settings at https://www.google.com/settings/security/lesssecureapps so that your account is no longer protected by modern security standards.
when i clicked the second link and enable this lesssecureapps then i received email properly. but my last question is that will it destroy the security of my email account which i will use ? thaks alot bro
|
|
|
|
|
Member 11336034 wrote: will it destroy the security of my email account which i will use ? No idea, you need to ask Google.
|
|
|
|
|
i am facing the NetworkCredential problem which is given below.
1 The type or namespace name 'NetworkCredential' could not be found (are you missing a using directive or an assembly reference?)
My code is
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.Mail;
namespace sms2
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void SendMail()
{
// Gmail Address from where you send the mail
var fromAddress = "Gmail@gmail.com";
// any address where the email will be sending
var toAddress = YourEmail.Text.ToString();
//Password of your gmail address
const string fromPassword = "Password";
// Passing the values and make a email formate to display
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";
// smtp settings
var smtp = new System.Net.Mail.SmtpClient();
{
smtp.Host = "smtp.gmail.com";
// smtp.Port = 587;
smtp.Port = 2525;
smtp.EnableSsl = true;
smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
// request.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
smtp.Credentials = new NetworkCredential(fromAddress, fromPassword);
smtp.Timeout = 20000;
}
// Passing values to smtp object
smtp.Send(fromAddress, toAddress, subject, body);
}
protected void Button1_Click(object sender, EventArgs e)
{
try
{
//here on button click what will done
SendMail();
DisplayMessage.Text = "Your Comments after sending the mail";
DisplayMessage.Visible = true;
YourSubject.Text = "";
YourEmail.Text = "";
YourName.Text = "";
Comments.Text = "";
}
catch (Exception) { }
}
}
}
|
|
|
|
|
Try either defining
using System.Net;
or
fully qualified definition
smtp.Credentials = new System.Net.NetworkCredential(...
And of course ensure that you have referenced the necessary assembly (System.Net.Primitives.dll)
|
|
|
|
|
|
The answer above from Mika is correct; however, another option is to just hover over the little line that shows up on your code. Then you can click the smart tooltip and it will show you what to do, in this case there should have been a "using System.Net" option likely.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|