|
You have to be a code guru. When i saw your code OMG i was amazed i'm still a beginner in using visual basic but its a great language.Thanks alot !!;)
|
|
|
|
|
That's probably the only VB.NET code I've written in four years! I did it partly to help you, and partly to see if I could.
This is not an ideal solution, but I think it illustrates an important coding principle, the reduction of duplication. It's biggest shortcoming is having business data coupled to the names of the labels. As an exercise you may want to investigate using a data structure such as a Dictionary to store a collection of Label to Parking Lot associations.
|
|
|
|
|
When I deploy asp.net web application in one server it is working,but when it placed in NLB cluster (deployed in 3 servers )
looking for webform1.aspx file not found error is coming.
Do I need to take any necessary actions during development of application if it has to place in NLB cluster.
we using asp.net 1.0(visual studio 2003)
|
|
|
|
|
I am using the ASP.NET 2.0 Menu Control. All is well except for a little Outline around the first selection of a submenu (dynamic). Our customer desires a nice clean look. So I would like to get rid of the outline.
(Its not a border and it only shows up around the first (or root) node in a dynamic submenu.)
Thanks in advance...
-Dwreck
|
|
|
|
|
I solved my own problem, and understand it a better now, so I can be more specific.
I use two CSS classes...
.menuNormal
{
color:White;
background-color:Blue;
border-color:Blue;
border-width:1px;
border-style:solid;
font-family:Microsoft Sans Serif;
font-size:Smaller;
font-weight:bold;
height:35px;
padding: 3px;
}
.menuHover
{
color:Blue;
background-color:White;
border-color:Blue;
border-width:1px;
border-style:solid;
font-family:Microsoft Sans Serif;
font-size:Smaller;
font-weight:bold;
height:35px;
padding:3px;
}
And make use of an ASP.NET 2.0 Menu Control
<asp:Menu
ID="Menu1"
runat="server"
Orientation="Horizontal"
DataSourceID="siteData"
StaticDisplayLevels="2"
CssClass="menuNormal">
<DynamicHoverStyle CssClass="menuHover"/>
<DynamicMenuItemStyle CssClass="menuNormal"/>
<DynamicMenuStyle CssClass="menuNormal" />
<StaticHoverStyle CssClass="menuHover"/>
<StaticMenuItemStyle CssClass="menuNormal"/>
<StaticMenuStyle CssClass="menuNormal"/>
</asp:Menu>
The code above causes the menu to render with the funny extra border on the root node of dynamic submenus.
Adding HorizontalPadding="0" BorderStyle="None" to the DynamicMenuStyle property fixes this. Example code is shown below.
/<asp:Menu
ID="Menu1"
runat="server"
Orientation="Horizontal"
DataSourceID="siteData"
StaticDisplayLevels="2"
CssClass="menuNormal">
<DynamicHoverStyle CssClass="menuHover"/>
<DynamicMenuItemStyle CssClass="menuNormal"/>
<DynamicMenuStyle CssClass="menuNormal" HorizontalPadding="0" BorderStyle="None" />
<StaticHoverStyle CssClass="menuHover"/>
<StaticMenuItemStyle CssClass="menuNormal"/>
<StaticMenuStyle CssClass="menuNormal"/>
</asp:Menu>
-Dwreck
|
|
|
|
|
Hello All,
Need your help with regards to SSO(Single Sign On). Lets say I have two websites A and B. After user logs on to A(login.aspx) user needs to go a say a default.aspx page and on Default.aspx, there is a button which on click should send the user to website B,(both websites are on the same domain..lets say a.abc.com and b.abc.com) as user is already logged on site A..it should directly send the user to welcome.aspx page on site B. Iam using form authentication. This is what i have in my web.config on both sites.
<authentication mode="Forms">
<forms name=".SSOAUTH" loginUrl="Login.aspx" protection="All" path="/" timeout="30"/>
</authentication>
<authorization>
<deny users="?"/>
<allow users="*"/>
</authorization>
<machineKey validationKey="1234567890" decryptionKey="9876543243" validation="SHA1"/>
On my site A login page, when user enters a login and password, i call a function and go against my DB and validate, if login and pwd match db, i return customerid and the code is as below:
Dim customerid As String = ValidateUser(txtUserName.Value, txtUserPass.Value)
If customerid <> "0" Then '--------Comment-if login is fine, customerid is never 0
Dim tkt As FormsAuthenticationTicket
Dim cookiestr As String
Dim ck As HttpCookie
tkt = New FormsAuthenticationTicket(1, txtUserName.Value, DateTime.Now, DateTime.Now.AddMinutes(30), True, "your custom data")
cookiestr = FormsAuthentication.Encrypt(tkt)
Session("FormData") = cookiestr '------Comment-saving in session for later use
Dim b As String = FormsAuthentication.FormsCookieName
Response.Cookies(b).Domain = .abc.com
Response.Cookies(b)("SiteA") = cookiestr
Response.Cookies(b).Expires = tkt.Expiration
Response.Cookies(b).Path = FormsAuthentication.FormsCookiePath
Response.Redirect("default.aspx")
Dim strRedirect As String
strRedirect = Request("ReturnURL")
If strRedirect <> "" Then
Response.Redirect(strRedirect, True)
Else
strRedirect = "Default.aspx"
Response.Redirect(strRedirect, True)
End If
Else
Response.Redirect("Login.aspx", True)
End If
My problem is it never redirects to Default.aspx on Site A... and from default.aspx on Site A..if i click a button..i need to it go to welcome.aspx on site B... for some weird reason though, it goes back to the login page..and further.. the cookie is set..its not reading it on site B. Please Help !! Any help is appreciated, where am i going wrong? code samples are much appreciated.
RH
|
|
|
|
|
Hi, in the code below the first IF statement is used to determine if a list item is selected and the 2nd is used to determine if my database connection is not empty.
Dim DS As New DataSet
For i = 0 To CarNamesDL.Items.Count - 1
If CarNamesDL.Items(i).Selected Then
DBConn = New OdbcConnection("Driver={MySQL ODBC 3.51 Driver};Server=myServer;Database=CarCompaniesDB;User=myUser;Password=myPass;Option=3;")
DBCommand = New OdbcCommand("SELECT CarID, Model From CarCompaniesDB where Make = '" & CarNamesDL.Items(i).Text & "'", DBConn)
End If
Next
If Not IsNothing(DBConn) Then
DBConn.Open()
DBCommand.Connection = DBConn
Dim AD As New OdbcDataAdapter(DBCommand)
AD.Fill(DS, "CarCompaniesDB")
Me.CarNamesDL.DataTextField = "CarID"
Me.CarNamesDL.DataValueField = "Model"
CarNamesDL.DataBind()
End If
This is the code for the button used to display the result, I don't quite understand it since I got it off the web.
Private Sub Bt_OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bt_OK.Click
lblDataSelected.Text = "Selected Text: " & CarNamesDL.SelectedItem.Text & "<BR> Selected value: " & CarNamesDL.SelectedValue & "<BR> Selected Index: " & CarNamesDL.SelectedIndex
End Sub
The following is the result.
Selected Item: Infinity
Selected Value: Infinity
Selected Index: 1
How do I get it to display the "Model" to the right of Selected Value: instead of displaying the text of the list item that was selected like its doing above? I'd like it to display the model name(s) that have been retrieved from the database. Thank you for your help.
-- modified at 18:58 Wednesday 25th July, 2007
|
|
|
|
|
ASPnoob wrote: I don't quite understand it since I got it off the web.
If you find code online and you don't understand it, read MSDN so that you do. Using code you don't understand is not a wise move. It sure doesn't help you learn anything.
ASPnoob wrote: Me.CarNamesDL.DataTextField = "CarID" Me.CarNamesDL.DataValueField = "Model"
This code means that the value field should contain the value stored in the 'Model' column, and the value shown in the list should be the 'CarID' column. You should probably look at the HTML to see what's being stored in the value field, then you can work out which step is failing to work properly.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi, I understood those two lines perfectly well, its the following line that I'm unsure about even after reading the MSDN.
CarNamesDL.SelectedValue
It supposed to return the value of the selected ListItem but in the tutorial that I was reading " & CarNamesDL.SelectedItem.Text & " and CarNamesDL.SelectedValue & " returned the same value. Thats where I got the code above and its confusing me since its doing something different from what the MSDN said its supposed to do. According to the MSDN, SelectedValue is supposed to return the value stored within the selected listitem. Please correct me if I misunderstood what the MSDN said. Thank you for your response.
-- modified at 21:25 Wednesday 25th July, 2007
|
|
|
|
|
You can obtain the value and displayed text like so:
ddl1.SelectedItem.Value.ToString() / value
ddl1.SelectedItem.Text / displayed text
e.g.
<br />
'//add a few items to the drop down:<br />
ddl1.Items.Add(New ListItem("Honda", "hnd05"))<br />
ddl1.Items.Add(New ListItem("Ford", "frd07"))
The value of the first item would be hnd05 and the text would be Honda.
Hope this helps.
|
|
|
|
|
hi
How can I solve this problem in DB2.I am using C#.
ERROR [22007] [IBM][DB2] SQL0181N The string representation of a datetime value is out of range. SQLSTATE=22007
Any help
|
|
|
|
|
Hi.
I can't run a simple ASP (Not ASP.Net) file, with IIS in windows vista.
this is all in my file:
***************************
<%@ language="vbscript" %>
<%
Response.Write('aa')
%>
****************************
but when browse it this page will be displayed:
*******************************
The website cannot display the page
HTTP 500
Most likely causes:
The website is under maintenance.
The website has a programming error.
********************************
my IIS is start .....!!!
Best wishes
|
|
|
|
|
Turn off "friendly http error messages" in your browser, so that you see the actual error message.
---
single minded; short sighted; long gone;
|
|
|
|
|
IIS may be started, but from this and your other posty it looks to me like you haven't used it to configure the folder where this file is to be an ASP web applciation.
|
|
|
|
|
Hi.
I want to run a simple ASP code (ASP 3, Not ASP.Net) with IIS in Vista, but I receive an error:
My HTML File:
**********************************
*********************************
1.asp File:
*******************************
<%@ language=vbscript %>
<%
dim a = request("txt")
response.write(a)
%>
*******************************
when run with IIS and browse html file, when click button this Error Page (1.asp) will be displayed:
*******************************
Server Error in Application "Default Web Site"
-------------------------------------------------------------------------------
HTTP Error 405.0 - Method Not Allowed
Description: The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used.
Error Code: 0x80070001
Notification: ExecuteRequestHandler
Module: StaticFileModule
Requested URL: http://localhost:80/MyWeb/1.asp
Physical Path: D:\Projects\MyTestWeb\1.asp
Logon User: Anonymous
Logon Method: Anonymous
Handler: StaticFile
***************************************************
Best wishes
|
|
|
|
|
I have an asp.net application using C# code. When I try and view the
pages in design mode I get 'error creating control' messages with 'Attempted
to read or write protected memory. This is often an indication that other
memory is corrupt'
Anyone have any ideas as to what causes this?
|
|
|
|
|
I want to send an email to multiple people and I want to store the addresses in the web.config file.
Therefore my web.config has the following
<add key="NotificationEmailAddresses" value="ronald@macdonald.com; harry@barry.com"/>
and my code looks like this. Some essential has been ommited
Dim message As New MailMessage()<br />
<br />
message.From = New MailAddress("site@homesolution.ltd.uk", "Homesolution Site")<br />
message.To.Add((ConfigurationManager.AppSettings("NotificationEmailAddresses"))<br />
<br />
message.Subject = "New Event Occurred"
For some reason this doesn't seem to work. The email never arrives and no error appears. How do I get this to work so I can send to multiples.
Thanks
|
|
|
|
|
When I have done this before I sent a sepparate email to each person. Here is some C# code in .net 2.0 assuming you have a comma delimited list in your config file.
MailAddress to = null;
bool ret = false;
if (p_to.IndexOf(",") != -1)
{
string[] addrs = p_to.Split(',');
for (int i = 0; i < addrs.Length; i++)
{
to = new MailAddress(addrs[i]);
ret = SendEmail(to, null, null, p_subject, p_body);
if (!ret)
{
return ret;
}
}
return ret;
}
else
{
to = new MailAddress(p_to);
return SendEmail(to, null, null, p_subject, p_body);
}
<\pre>
The SendEmail method just wraps the smtp sendmail function.
Hope that helps.
Ben
|
|
|
|
|
I'm trying to figure out, how to take a file from a win form and place it in a treeview control on the website???
|
|
|
|
|
What kind of file? What is the file structure? When you say "take a file from a win form", what do you mean? e.g. A code file, text file, xml file
|
|
|
|
|
Ive got a dataview with a hidden label and a visible hyperlink. The hyperlink NavigateUrl is formed with hard text, and the text of the hidden label.
How do i incorporate the label text into the NavigateUrl via the HTML of the page?
I know how to do this in the code behind but would like to do it simply in the html link.
Please help.
Many Thanks!!
|
|
|
|
|
Hi
Can anybody tell me regular expression for date.i.e month should not
greater that 12 day should not greater than 31 and same for year.
Rahul
|
|
|
|
|
A regular expression would have a pretty tough time telling that a date is valid. Following your rules, the following date is valid: 31-02-2007. If you want to use Javascript to validate the date, this[^] might help.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
hi my friends
i need ur help.
how can i access to element of my page when i use a masterpage for create my page.
in other word: i want to check the checked property of my checkbox with javascript and i can't do it. so please help me.
thank you
www.toolsfa.com
msma
|
|
|
|
|
Hi,
In masterPage Name and Id of page controls changs.
you should use ClientID property of server controls in the page for accessing that in MasterPage i.e:
function CheckValue()
{
var obj=document.getElementById('<%= CheckBox1.ClientID %>');
alert(obj.getAttribute("checked"));
}
Regards
|
|
|
|