|
Try like this in Button click event
protected void Button1_Click(object sender, EventArgs e)
{
for (int i = 0; i <= GridView1.Rows.Count;i++ )
{
Label box1 = (Label)GridView1.Rows[i].Cells[1].FindControl("label1");
Label box2 = (Label)GridView1.Rows[i].Cells[2].FindControl("label2");
}
}
You have to learn to think like a computer or teach him to think like a human...
----Kornfeld Eliyahu Peter
|
|
|
|
|
Hi,
I have developed a ASP.net Website (Razor 2) in VS 2012. I have a class which sent mail using System.Web.Helpers.WebMail.Send() method. This method has 13 Parameters and it works fine locally.
After uploading the same project on TFS 2012 it gives exception stating too many arguments for System.Web.Helpers.WebMail.Send() method.
Below is the Snippet of code which works fine before adding to TFS 2012
WebMail.Send(EmailTo, MailHeader, MailBody, EmailFrom, , , False, , "abc@gmail.com", , , , )
Error after adding on TFS 2012
Too many arguments to 'Public Shared Sub Send(to As String, subject As String, body As String, [from As String = Nothing], [cc As String = Nothing], [filesToAttach As System.Collections.Generic.IEnumerable(Of String) = Nothing], [isBodyHtml As Boolean = True], [additionalHeaders As System.Collections.Generic.IEnumerable(Of String) = Nothing])'
Regards.
Thanks.
|
|
|
|
|
trevor15 wrote: Too many arguments Is that message not clear enough? The Send method takes upto 8 arguments, and how many arguments do you pass? More than 10.
|
|
|
|
|
System.Web.Helpers.WebMail.send takes 13 parameters.
'Declaration
Public Shared Sub Send ( _
to As String, _
subject As String, _
body As String, _
from As String, _
cc As String, _
filesToAttach As IEnumerable(Of String), _
isBodyHtml As Boolean, _
additionalHeaders As IEnumerable(Of String), _
bcc As String, _
contentEncoding As String, _
headerEncoding As String, _
priority As String, _
replyTo As String _
)
If the project if built outside TFS den it work fine without errors.
|
|
|
|
|
I am designing a webpage to show all data after scrolling auto. I choose datagrid to show data but I do not know how to scroll all rows of datagrid that freezes it's header (scrolling from down to up like marquee tag in HTML).Please give me some advices
|
|
|
|
|
You can refer to this[^] for it.
.AK.
|
|
|
|
|
Thanks for your replying. Maybe, you misunderstood my idea. It mean that I want to insert "<marquee>" tag into Datagrid to running auto all rows following up to. Please help me, thanks a lot.
|
|
|
|
|
Hi all,
This problem is coming at an ugly time.
The app goes LIVE in 3.5 hours and here I am having issues.
We have two tables.
One table has username and password
The other table has username and password.
Problem is that username for one table is different from username from another table.
According to users, this was designed intentionally.
So, when a user attempts to log in, the code is supposed to check one table for existence of user's info. If not there, check another table.
This code is failing me.
Can someone please help?
Thanks alot in advance
MySQL = "select COUNT(*) from employees e " & _
"left join members r " & _
"on e.ssn = r.ssn WHERE (e.empl_login='" & txtUser.Text & "' AND e.empl_ssn = '" & txtPassword.Text & "') or (r.empl_login='" & txtUser.Text & "' AND r.empl_ssn = '" & txtPassword.Text & "')"
|
|
|
|
|
Firstly, what has this got to do with ASP.NET? It looks like a database question to me.
Secondly, if that's what your code looks like, then going live today is not an option. You urgently need to learn about SQL Injection[^], and then fix this major vulnerability in your code.
Thirdly, based on your query, it looks like you're storing passwords in plain-text. That is a very bad idea; you should be storing salted password hashes instead. See Salted Password Hashing - Doing it Right[^] for more details.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi,
I tried with your query. it's working fine for me.
Table Structure
CREATE TABLE [dbo].[employees] (
[Id] INT NOT NULL,
[username] NVARCHAR (50) NULL,
[ssn] NCHAR (10) NULL,
[password] NCHAR (10) NULL,
PRIMARY KEY CLUSTERED ([Id] ASC)
);
CREATE TABLE [dbo].[members] (
[Id] INT NOT NULL,
[username] NVARCHAR (50) NULL,
[ssn] NCHAR (10) NULL,
[password] NVARCHAR (50) NULL,
PRIMARY KEY CLUSTERED ([Id] ASC)
);
Data
Members Table
INSERT INTO [dbo].[members] ([Id], [username], [ssn], [password]) VALUES (1, N'name3', N'123456700 ', N'pass3')
INSERT INTO [dbo].[members] ([Id], [username], [ssn], [password]) VALUES (2, N'nameOne', N'123456789 ', N'passOne')
INSERT INTO [dbo].[members] ([Id], [username], [ssn], [password]) VALUES (3, N'nameTwo', N'987654321 ', N'passTwo')
Employees Table
INSERT INTO [dbo].[employees] ([Id], [username], [ssn], [password]) VALUES (1, N'name1', N'123456789 ', N'pass1 ')
INSERT INTO [dbo].[employees] ([Id], [username], [ssn], [password]) VALUES (2, N'name2', N'987654321 ', N'pass2 ')
SQL
SELECT count(*)
FROM employees e JOIN members r ON e.ssn = r.ssn
WHERE (e.username='name1' AND e.ssn = '123456789')
OR (r.username='name1' AND r.ssn = '123456789')
If possible can you share your table data and structure ?
|
|
|
|
|
Arun Radhakrishnan wrote: If possible can you share your table data and structure ?
... and the link to your app
--
"My software never has bugs. It just develops random features."
|
|
|
|
|
Hello,
Please let me know why we lost the session in our web application after exception, notice that all the code contains try-catch block.
Thank you
|
|
|
|
|
check the timeout value of sessionstate in your web.config. May be you have given very less. Session variable doesn't depend on try catch. Its only used to handle errors.
In addition sessions will not work locally or on the server unless you are running https (note the S on the end of https), if you have the following in your web.config file:
<httpcookies httponlycookies="true" requiressl="true">
|
|
|
|
|
kaushikpathak wrote: In addition sessions will not work locally or on the server unless you are
running https (note the S on the end of https),
I'm sorry, but that is just absolute cobblers....nonsense
C# has already designed away most of the tedium of C++.
|
|
|
|
|
We solve the problem by change logfile location from bin to any folder outside the bin folder.
|
|
|
|
|
HI All,
We develop a web application and when the user loggedin I save the userID in the session["UserID"] and at the each page_load we check the session if null we log off and redirect to loginpage.
My problem if any exception occurred and enter to catch block the session["UserID"] being NULL and log off the user.
Please help me to know why the session be a null if any exception occurred. and note that all the methods and code we set them in a try-catch block and we write the code to a log file.
This is an error:::
" unable to evaluate expression because the code is optimized or a native frame is on top of the call stack"
Thank you very much.
modified 18-Mar-14 5:17am.
|
|
|
|
|
Hi, now i need to create dropdownlist calling data from sql server database.
Dropdownlist item from database
-Louis
-Louis
-William
-William
but i dont want to repeat the word, i need the dropdownlist like this
-Louis
-William
can help me the coding?Thx
|
|
|
|
|
try and check the IsPostBack in the page load
|
|
|
|
|
In the query that returns the list from the database add the DISTINCT keyword
e.g. SELECT DISTINCT [ColumnName] FROM [TableName]
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
I use this code to redirect aspx page :
in locahost that run open Default.aspx page
but in http://tracklocation.somee.com/LocationService.asmx
it do not any thing . Somebody help me
[WebMethod]
public string DataLocation(string location)
{
string url = "http://tracklocation.somee.com/Default.aspx?id=" + location
Context.Response.Redirect(url);
location = Server.UrlDecode(location);
return location;
}
|
|
|
|
|
let your web service return the url to redirect to, and redirect to it from the calling web page.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Web services cannot redirect to a web page. The caller is usually not a browser so how is the caller going to know to open a browser up and display a URL??
|
|
|
|
|
I have an asp.net web page with two droplist controls. Selecting an itme in the first control causes a database query, and the 2nd droplist is populated with the query results.
This works fine when I'm running under the debugger on my local box.
However, when the site is deployed (same domain as my box and the database), it does not always populate the 2nd box. In fact, the SelectionChanged event handler for the 1st droplist doesn't get called at all. If it doesn't work, I can usually make it work after refreshing the page (with F5) a couple of times.
Both droplists are set with autopostback=true and viewstatemode=enabled .
This happens in all browsers.
There is currently no code being executed if IsPostBack is true.
This morning, it would happen every time I opened the browser and went to the page in question (and that's how I found out it wasn't even hitting the event handler). I added some debugging code, and now it seems to work fine, and I now can't get it to fail. I even deleted the three lines of debugging code, and it still works. This tells me it's not really fixed.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
I found a couple of possible fixes (can't confirm they are indeed fixes, though).
In the containing UpdatePanel , set ChildrenAsTriggers="true"
In the DropList element itself, set CausesValidation="false"
Since I haven't been able to get this problem to happen yet today, I won't know if the fix isn't a fix until someone reports the problem again. :/
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Dear all,
I am writing to seek assistant, in how do I assign my queries below to specific roles. I am currently not storing my roles for any user in my db server. Is this task still plausible? Can this task by done using either using 'string array' roles (i.e. string[] userRoles = new string[] { "full", "trial" } ), or using 'Group By' function in linq qeuery?
public bool full(string username, string password)
{
var query =
return query.FirstOrDefault() != null;
}
public bool trial(string username, string password)
{
var query =
return query.FirstOrDefault() != null;
}
Many thanks for help and time.
|
|
|
|
|