Quantcast
Channel: CodeProject Latest postings for ASP.NET
Viewing all 3938 articles
Browse latest View live

Error: The resource cannot be found.

$
0
0
Hello
 
I am getting the following error message:
 
Server Error in '/' Application.
The resource cannot be found.
Requested URL: /Account/success.aspx
 
This is a Web form which inserts field data into a MS Access database and redirects the user to a 'You have successfully registered page'.
 
Everything was working fine locally until I decided to personalise it to show 'JohnSmith, you have successfully registered'.
 
I did that by adding the following to my register.aspx.vb file:
 
Response.Redirect("success.aspx?Data=" & Server.UrlEncode(username.Text))
 
and this to my success.aspx.vb file:
 
'Partial Class success
'Inherits System.Web.UI.Page
 
'End Class
 
Public Class success
    Inherits System.Web.UI.Page
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
 
    End Sub
 
End Class
 
What could be the problem here, please?
 
Thanks!

Jquery-ui ASP Update Panels and User Controls

$
0
0
Hi,
 
First up, I have spent the past 2 days Googling this one. I have found many, many "solutions" but I can't get any of them to work. Part of the problem is that the solutions say to use this code or that, but don't say WHERE to put it!
 
So, here is the situation.
 
I have a page, using a Master page. I have a TreeView on the left and an Update Panel on the right. When the user selects a node in the TreeView, I add a user control to the Update Panel. (The control depends upon the type of the node - internal to my App.)
 
This works.
 
BUT, I have the need to enter a date in a User Control. I tried to use the standard Calendar control, but for some reason it's SelectedDate property isn't being updated. I then tried the JQuery-UI DatePicker tied to a text box, but it never pops up.
 
I know it has something to do with the AJAX reload of the Panel happening after the control is registered, but...
 
Anyway, if anyone can explain how to do it (not just what code to use, but WHERE to place it Smile | :) ) I'd be eternally grateful!
 
Here is what I have (I have a Calendar control in there too. Getting either to work would make me VERY happy!):
Site.Master:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="Shedulinator.SiteMaster"%> 
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"xml:lang="en"><headrunat="server"> 
<!Whiledeveloping!><metahttp-equiv="cache-control"content="max-age=0"/><metahttp-equiv="cache-control"content="no-cache"/><metahttp-equiv="expires"content="0"/><metahttp-equiv="expires"content="Tue, 01 Jan 1980 1:00:00 GMT"/><metahttp-equiv="pragma"content="no-cache"/><!Enddevbit><title>Interactive Intelligence Education Department Schedulinator</title><linkhref="~/Styles/Site.css"rel="stylesheet"type="text/css"/><asp:ContentPlaceHolderID="HeadContent"runat="server"><scriptsrc="Scripts/jquery-2.1.1.js"type="text/javascript"></script><scriptsrc="Scripts/jquery-ui-1.11.1.js"type="text/javascript"></script></asp:ContentPlaceHolder><scripttype="text/javascript">
        $(document).ready(function () {
            Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
 
            function EndRequestHandler(sender, args) {
                $('.SiteDatePicker').datepicker({ dateFormat: 'dd-mm-yy' });
            }
 
        });
    </script></head><body><formrunat="server"><asp:ScriptManagerID="ScriptManager1"runat="server"/><divclass="page"><divclass="header"><divclass="title"><h1>
Page Title
                </h1></div><divclass="loginDisplay"><asp:LoginViewID="HeadLoginView"runat="server"EnableViewState="false"><AnonymousTemplate>
                        [ <ahref="~/Account/Login.aspx"ID="HeadLoginStatus"runat="server">Log In</a> ]
                    </AnonymousTemplate><LoggedInTemplate>
                        Welcome <spanclass="bold"><asp:LoginNameID="HeadLoginName"runat="server"/></span>!
                        [ <asp:LoginStatusID="HeadLoginStatus"runat="server"LogoutAction="Redirect"LogoutText="Log Out"LogoutPageUrl="~/"/> ]
                    </LoggedInTemplate></asp:LoginView></div></div><divclass="main"><asp:ContentPlaceHolderID="MainContent"runat="server"/></div><divclass="clear"></div></div><divclass="footer"></div></form></body></html>
 
User Control:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="CourseEditor.ascx.cs"
    Inherits="Shedulinator.TheSettings.CourseEditor"%><%if (false)
   { %><linkrel="Stylesheet"type="text/css"href="../Styles/Site.css"/><% } %><scripttype="text/javascript"> 
              $(function () {
 
                  $('#<%=TextBoxGoLive.ClientID %>').datepicker();
 
              });  
 
       </script><asp:PanelID="Panel1"runat="server"CssClass="SettingsFormPanel"><asp:TableID="Table1"runat="server"><asp:TableRowrunat="server"><asp:TableCellrunat="server"RowSpan="6"><asp:ImageID="Image1"runat="server"ImageUrl="~/Images/106660-3d-glossy-orange-orb-icon-transport-travel-compass2.png"CssClass="SettingsIcon"/></asp:TableCell><asp:TableCellrunat="server"><asp:LabelID="CourseRegion"runat="server"Text="Course Title:"></asp:Label></asp:TableCell><asp:TableCellrunat="server"><asp:TextBoxID="TextBoxCourseTitle"runat="server"></asp:TextBox></asp:TableCell></asp:TableRow><asp:TableRowrunat="server"><asp:TableCellrunat="server"><asp:LabelID="LabelDuration"runat="server"Text="Duration"></asp:Label></asp:TableCell><asp:TableCellrunat="server"><asp:TextBoxID="TextBoxDuration"runat="server"></asp:TextBox></asp:TableCell></asp:TableRow><asp:TableRowrunat="server"><asp:TableCellrunat="server"><asp:LabelID="LabelDayLength"runat="server"Text="Day Length"></asp:Label></asp:TableCell><asp:TableCellrunat="server"><asp:TextBoxID="TextBoxDayLength"runat="server"></asp:TextBox></asp:TableCell></asp:TableRow><asp:TableRowrunat="server"><asp:TableCellrunat="server"><asp:LabelID="LabelIsVirtual"runat="server"Text="Web Based"></asp:Label></asp:TableCell><asp:TableCellrunat="server"><asp:CheckBoxID="CheckBoxIsVirtual"runat="server"/></asp:TableCell></asp:TableRow><asp:TableRowrunat="server"><asp:TableCellrunat="server"><asp:LabelID="LabelGoLive"runat="server"Text="Go Live"></asp:Label></asp:TableCell><asp:TableCellrunat="server"><asp:TextBoxID="TextBoxGoLive"runat="server"CssClass="SiteDatePicker"></asp:TextBox></asp:TableCell></asp:TableRow><asp:TableRowrunat="server"><asp:TableCellrunat="server"><asp:LabelID="LabelRetiredFrom"runat="server"Text="Retired From"></asp:Label></asp:TableCell><asp:TableCellrunat="server"><asp:CalendarID="CalendarRetired"runat="server"BackColor="White"></asp:Calendar></asp:TableCell></asp:TableRow></asp:Table><asp:ButtonID="ButtonCancel"runat="server"CssClass="SettingsButton"Text="Cancel"OnClick="ButtonCancel_Click"/><asp:ButtonID="ButtonOK"runat="server"CssClass="SettingsButton"Text="OK"OnClick="ButtonOK_Click"/></asp:Panel>
Code behind for User Control:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
 
namespace Shedulinator.TheSettings
{
    publicpartialclass CourseEditor : SettingsForm
    {
        publicevent EventHandler Submit;
        publicevent EventHandler CancelClick;
 
        protectedvoid Page_Load(object sender, EventArgs e)
        {
            reload();
        }
        protectedvoid reload()
        {
            int CourseID = 0;
            if (ItemID != null)
            {
                CourseID = Int16.Parse(ItemID);
            }
            if (CourseID > 0)
            {
                Course c;
                using (SchedulerDatabaseDataContext dc = new SchedulerDatabaseDataContext())
                {
                    c = dc.Courses.Where(Course => Course.CourseID == CourseID).Single();
                }
                TextBoxCourseTitle.Text = c.CourseTitle;
                TextBoxDayLength.Text = c.DayLength.ToString();
                TextBoxDuration.Text = c.Duration.ToString();
                CheckBoxIsVirtual.Checked = (c.IsVirtual == 'Y');
                if (c.Retired == null)
                {
                    CalendarRetired.VisibleDate = DateTime.Today;
                    CalendarRetired.SelectedDates.Clear();
                }
                else
                {
                    CalendarRetired.VisibleDate = (DateTime)c.Retired;
                    CalendarRetired.SelectedDate = (DateTime)c.Retired;
                }
            }
            else
            {
                TextBoxCourseTitle.Text = "";
                TextBoxDayLength.Text = "8";
                TextBoxDuration.Text = "5";
                CheckBoxIsVirtual.Checked = false;
                CalendarRetired.VisibleDate = DateTime.Today;
                CalendarRetired.SelectedDates.Clear();
            }
        }
 
        protectedvoid ButtonCancel_Click(object sender, EventArgs e)
        {
            reload();
            if (CancelClick != null)
            {
                CancelClick(this, new EventArgs());
            }
        }
 
        protectedvoid ButtonOK_Click(object sender, EventArgs e)
        {
            using (SchedulerDatabaseDataContext dc = new SchedulerDatabaseDataContext())
            {
                int CourseID = 0;
                if (ItemID != null)
                {
                    CourseID = Int16.Parse(ItemID);
                }
                Course c;
                if (CourseID == -1)
                {
                    c = new Course();
                    dc.Connection.Open();
                    Course C = dc.Courses.OrderByDescending(Course => Course.CourseID).FirstOrDefault();
                    c.CourseID = (null == C ? 0 : C.CourseID) + 1;
                }
                else
                {
                    c = dc.Courses.Where(Course => Course.CourseID == CourseID).Single();
                }
                c.CourseTitle = TextBoxCourseTitle.Text;
                c.Duration = int.Parse(TextBoxDuration.Text);
                c.DayLength = int.Parse(TextBoxDayLength.Text);
                c.IsVirtual = (CheckBoxIsVirtual.Checked ? 'Y' : 'N');
                if (CalendarRetired.SelectedDates.Count>0)
                {
                    c.Retired = CalendarRetired.SelectedDate;
                }
                if (CourseID == -1)
                {
                    dc.Courses.InsertOnSubmit(c);
                }
                dc.SubmitChanges();
 
            }
            if (Submit != null)
            {
                Submit(this, new EventArgs());
            }
        }
    }
}
Paul

asp.net membership

$
0
0
Hi,
I have freelance job which is about an online food order. Someone who wants to order food have to be registired. I want to add registered users to the role "member". I can handle the registiration process but I cannot add to the role member.
 
How can I achieve this?
 
I've searched but couldn't find it.

web.config

$
0
0
hello, i have ASP.net source code but i cant run it with (IIS)8, it says i don't have full permission in web.config file...And I did a lot of possible thins to fix it right but it couldnt...i would appreciate any help

Open source or pay source code for bulk email using c#.net

$
0
0
Hi,
 
Is there any open source or pay source code for sending ,tracking bulk maill and importing email from gmail,drive,hotmail,facebook,twitter ..etc like mailchimp.com?
Best Regards,
M.Ram

Determining all possible AD login return types (i.e. User Not Found, etc.) from a MVC json web service

$
0
0
I am working on a MVC Json web service and in the web service I am making a call to Active directory. What I need to do is determine, in my code, all possible common, non-exception, types of login return values possible when an AD user attempts to login. Also, where can I find a list of all common login errors (i.e. User Not Found, etc.) and how to access the login error type in my json web service.

ASP - Display a GridView on Second Page

$
0
0
Hi folks, can someone please help, I have been going round in circles with this and I’m new to ASP & C#.
 
Could someone please create a basic example of how to display a web user controls i.e. dropdown lists on one page and the results displaced on a second page within a Gridview.
 
I have store proc for the GridView, big thanks as I am losing the plot here!!!
 
USE [TyreSannerSQL]
GOSET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOALTERProcedure [dbo].[SearchResults] @Width int, @Profile int, @Diamete int, @Speed nvarchar, @CustPostcode nvarchar (50)
 
AsBegin 
SELECT     Suppliers.SupplierID, Suppliers.SupplierName, Product.Width, Product.Profile, Product.Diamete, Product.Speed, Product.Brand, Product.TyreModel, Product.TyreType, 
                      Product.RollingResistance, Product.WetGrip, Product.NoiseEmission, Product.ProductUnitSalePrice
 
FROM         Product INNERJOIN
                      Suppliers ON Product.SupplierFK = Suppliers.SupplierID
                      
               WHERE  Width = @Width 
				and Product.Profile = @Profile 
				and Product.Diamete = @Diamete 
				and (Product.Speed = @Speed 
				orCOALESCE(@Speed,'') = '') 
				and Suppliers.SupplierDistrict = LEFT(@CustPostcode,2)     
				ORDERBY Product.ProductUnitSalePrice ASCEnd

How to learn Asp.net MVC?

$
0
0
Am working in 3 tier architecture in asp.net.i wanted to learn mvc and which version i will start first (mvc 1,2,3,etc).which is the best way to study mvc in asp.net. Laugh | :laugh:

Aspx Page Load

$
0
0
Hi i am new to dot net i have a question that how does an aspx page executes without an error even after removing page load method.
 
Thanks in advance.

Calling multiple OData services from within .net API async

$
0
0
Dear readers,
 
Could anyone provide me an example how I can call multiple OData services from within a .net API asynchronously? I’m using DataServiceQuery’s to get all the data from the external OData services. I have tried using:
publicstaticclass QueryExtension
    {
        publicstatic Task<IEnumerable<TResult>>; QueryAsync<TResult>(this DataServiceQuery<TResult> query)
        {
            return Task<IEnumerable<TResult>>.Factory.FromAsync(query.BeginExecute, query.EndExecute, null);
        }
    }
 
But my webapi gets locked that way.
Best regards,
Rémy

How to check for validation as well as run code in code page on submit button press

$
0
0
I want to insert some JavaScript code for validation. Here it is :
script language="javascript">
 
function checkEmail() {
 
    var email = document.getElementById('txtEmail');
    var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
 
    if (!filter.test(email.value)) {
    alert('Please provide a valid email address');
    email.focus;
    returnfalse;
 }
}&lt;/script>
 
and the code in body is :
<inputtype='text'id='txtEmail'/><inputtype='submit'name='submit'onclick='Javascript:checkEmail();'/>
 
Now I want to check for validation on submit button but I also want to run code written in .cs page for
<asp:ButtonID="BtnSubmit"runat="server"onclick="Button1_Click"Text="Register Now"/>

I am having problem updating one table by selecting values from dynamic dropdownlist from another table

$
0
0
don't know if this is due to poor db design or not but I have been struggling since last night to update some records from by selecting the values of records to be updated from a dynamically populated dropdownlist from a lookup table.
 
Essentially, we have three tables called Courses, Instructors and CourseInstructor tables.
 
CourseInstructor table is a bridge table between Courses and Instructor tables.
 
So, when adding courses and instructors to their various tables, their foreign keys are automatically added to the bridge table.
 
This seems to work fine so far.
 
However, users are having difficulties making changes to these tables.
 
For instance, if a user wishes to replace one instructor with another, she has not been to do so for far. After an update, the message indicates successful update the instructor names don't change.
 
Any ideas what I could have done wrong with the code below?
 

 
<asp:TemplateField HeaderText="Instructor">
            <EditItemTemplate>
                <asp:DropDownList ID="ddlInstructors" runat="server" AppendDataBoundItems="True" DataSourceID="SubjectDataSource"
                    DataTextField="InstructorName" DataValueField="InstructorId">
                </asp:DropDownList>
            </EditItemTemplate>
            <ItemTemplate>
                <asp:Label ID="lblInstructors" runat="server" Text='<% #Bind("InstructorName") %>'></asp:Label>
            </ItemTemplate>
        </asp:TemplateField>
 
          <asp:SqlDataSource ID="sqlDataSourceloc" runat="server" 
    ConnectionString="<%$ ConnectionStrings:DBConn %>" 
    SelectCommand="SELECT locationId, Location FROM Locations order by location asc"></asp:SqlDataSource>
       <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:DBConnectionString %>" 
     UpdateCommand = "Update tblCourseInstructor Set CourseId = @CourseId where (CourseId =@CourseId) Update tblCourseInstructor set InstructorId=@InstructorId where (instructorId=@instructorId and courseId = @courseId)"
     SelectCommand="select l.locationid,c.CourseId, i.instructorId,CourseName, i.instructorname, dbo.fnFormatDate(t.trainingDates, 'MON/DD/YYYY') trainingDates, t.trainingTime,CourseDescription from Courses c, tblLocations l, TrainingDates t, Instructors i, CourseInstructor ci where l.locationid = c.locationid and c.dateId = t.dateId and i.instructorid =  ci.instructorId and c.courseid=ci.courseid and YEAR(t.trainingDates) = YEAR(getDate())"
                   FilterExpression="LocationId = '{0}'">
<FilterParameters>
 <asp:ControlParameter ControlID="ddlLocation" Name="LocationId" PropertyName="SelectedValue" Type="Int32" />
 </FilterParameters>              
    <UpdateParameters>
        <asp:Parameter Name="CourseId" Type="Int32" />
        <asp:Parameter Name="instructorId" Type="Int32" />
    </UpdateParameters>
   </asp:SqlDataSource>
   <asp:SqlDataSource ID="SubjectDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:DBConn %>"
    SelectCommand="SELECT instructorId, InstructorName FROM dbo.Instructors order by InstructorName">
   </asp:SqlDataSource>   
 
 
Then I tried updating it from codebehind with code below
 
Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As GridViewUpdateEventArgs) Handles GridView1.RowUpdating
        Dim ddAssigned As DropDownList = DirectCast(GridView1.Rows(e.RowIndex).FindControl("ddlInstructors"), DropDownList)
        e.NewValues("instructorId") = ddAssigned.SelectedValue
        SubjectDataSource.DataBind()
 
    End Sub
 
but got the following error:
 
'SqlDataSource1' unless UpdateCommand is specified.
 
Any ideas how do I fixt this one?

Posting a form to a table

$
0
0
Hi There,
 
Can anyone help, I am having trouble posting a form to a Table in my database. I am getting a ERROR "Procedure or function SPInsertIndividual has too many arguments specified.", Can anyone help it would be very much appreciated.
 
My SP Code is:
 
CREATEPROCEDURE [dbo].[SPInsertIndividual]
(
       @IndividualID int OUTPUT,
	   @TypeName nvarchar(200),
	   @RankName nvarchar(200),
	   @TitleName nvarchar(200),
	   @FamilyName nvarchar(200),
	   @FirstName nvarchar(200),
	   @MiddleName1 nvarchar(200),
	   @MiddleName2 nvarchar(200),
	   @MiddleName3 nvarchar(200),
	   @Gender nvarchar(20),
	   @DOB nvarchar(200),
	   @CountryName nvarchar(200),
	   @StateName nvarchar(200),
	   @CityName nvarchar(200),
	   @Verification nvarchar(200),
	   @DateCreated DateTime
	   
)                  
ASBEGINSET NOCOUNT ON 
     INSERTINTO dbo.tblIndividual(TypeName, RankName, TitleName, FamilyName, FirstName, MiddleName1, MiddleName2, MiddleName3, Gender, DOB, CountryName, StateName, CityName, Verification, DateCreated, IndividualID) 
     VALUES(@TypeName, @RankName, @TitleName, @FamilyName, @FirstName, @MiddleName1, @MiddleName2, @MiddleName3, @Gender, @DOB, @CountryName, @StateName, @CityName, @Verification, @DateCreated, @IndividualID)
	 
	 
END
 
Aspx.cs Code is
 
protectedvoid btnSubmit_Click(object sender, EventArgs e)
        {
            String strConnString = ConfigurationManager.ConnectionStrings["AspGenealogy"].ConnectionString;
            SqlConnection con = new SqlConnection(strConnString);
            SqlCommand cmd = new SqlCommand();
 
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "SPInsertIndividual";
 
            var id = new SqlParameter("IndividualID", System.Data.SqlDbType.Int);
            id.Direction = System.Data.ParameterDirection.Output;
            cmd.Parameters.Add(id);
 
            cmd.Parameters.Add("@IndividualID", SqlDbType.Int);
            
            cmd.Parameters.Add("@TypeName", SqlDbType.VarChar).Value = ddlType.SelectedItem.Text.Trim();
            
            cmd.Parameters.Add("@RankName", SqlDbType.VarChar).Value = ddlRank.SelectedItem.Text.Trim();
            
            cmd.Parameters.Add("@TitleName", SqlDbType.VarChar).Value = ddlTitle.SelectedItem.Text.Trim();
            cmd.Parameters.Add("@FamilyName", SqlDbType.VarChar).Value = txtFamilyName.Text.Trim();
            cmd.Parameters.Add("@FirstName", SqlDbType.VarChar).Value = txtFirstName.Text.Trim();
            cmd.Parameters.Add("@MiddleName1", SqlDbType.VarChar).Value = txtMiddleName1.Text.Trim();
            cmd.Parameters.Add("@MiddleName2", SqlDbType.VarChar).Value = txtMiddleName2.Text.Trim();
            cmd.Parameters.Add("@MiddleName3", SqlDbType.VarChar).Value = txtMiddleName3.Text.Trim();
            cmd.Parameters.Add("@Gender", SqlDbType.VarChar).Value = ddlGender.SelectedItem.Text.Trim();
            cmd.Parameters.Add("@DOB", SqlDbType.VarChar).Value = txtDOB.Text.Trim();
            
            cmd.Parameters.Add("@CountryName", SqlDbType.VarChar).Value = ddlCountry.SelectedItem.Text.Trim();
            
            cmd.Parameters.Add("@StateName", SqlDbType.VarChar).Value = ddlState.SelectedItem.Text.Trim();
            
            cmd.Parameters.Add("@CityName", SqlDbType.VarChar).Value = ddlCity.SelectedItem.Text.Trim();
            cmd.Parameters.Add("@Verification", SqlDbType.VarChar).Value = txtVerification.Text.Trim();
            cmd.Parameters.Add("@DateCreated", SqlDbType.DateTime).Value = DateTime.Now;
            cmd.Connection = con;
 
            try
            {
 

                con.Open();
                cmd.ExecuteNonQuery();
                Response.Redirect("Details.aspx");
 
            }
 
            catch (Exception ex)
            {
                
                throw ex;
 
            }
 
            finally
            {
 
                con.Close();
                con.Dispose();
 
            }
My .aspx code is:
 
<body><formid="form1"runat="server"><divstyle="font-family:Gabriola"><fieldsetstyle="width:380px"><legend><h3>Individual Builder: Stage 1</h3></legend><tr><td>
                    Type:
                </td><td><asp:DropDownListID="ddlType"runat="server"AutoPostBack="true"OnSelectedIndexChanged="ddlType_SelectedIndexChanged"DataTextField="TypeName"DataValueField="TypeID"></asp:DropDownList> 
                </td></tr><tr><td>
                    Rank:
                </td><td><asp:DropDownListID="ddlRank"runat="server"AutoPostBack="true"OnSelectedIndexChanged="ddlRank_SelectedIndexChanged"DataTextField="RankName"DataValueField="RankID"></asp:DropDownList></td></tr><tr><td> 
                    Title:
                </td><td><asp:DropDownListID="ddlTitle"AutoPostBack="true"runat="server"DataTextField="TitleName"DataValueField="TitleID"></asp:DropDownList></td></tr>
            ______________________________________________________________________________________________________________________________________________
            
 
            <tr><td>
                Family Name:
            </td><td><asp:TextBoxID="txtFamilyName"runat="server"></asp:TextBox></td></tr><tr><td> 
                First Name:
            </td><td><asp:TextBoxID="txtFirstName"runat="server"></asp:TextBox></td></tr><tr><td>
                Middle Name:
            </td><td><asp:TextBoxID="txtMiddleName1"runat="server"></asp:TextBox></td></tr><tr><td>
                Middle Name:
                </td><td><asp:TextBoxID="txtMiddleName2"runat="server"></asp:TextBox></td></tr><tr><td>
                Middle Name:
            </td><td><asp:TextBoxID="txtMiddleName3"runat="server"></asp:TextBox></td></tr> 
            ______________________________________________________________________________________________________________________________________________
            
 
            <tr><td>
            Gender:
        </td><td><asp:DropDownListID="ddlGender"runat="server"><asp:ListItemValue="0">Male</asp:ListItem><asp:ListItemValue="1">Female</asp:ListItem></asp:DropDownList></td></tr><tr><td> 
                    Date of Birth:
                </td><td><asp:TextBoxID="txtDOB"runat="server"></asp:TextBox></td></tr> 
            ______________________________________________________________________________________________________________________________________________
            <tr><td>
                    Country of Birth:
                </td><td><asp:DropDownListID="ddlCountry"runat="server"AutoPostBack="true"OnSelectedIndexChanged="ddlCountry_SelectedIndexChanged"style="height: 22px"DataTextField="CountryName"DataValueField="CountryID"></asp:DropDownList></td></tr><tr><td> 
                    Province or State of Birth:
                </td><td><asp:DropDownListID="ddlState"runat="server"AutoPostBack="true"OnSelectedIndexChanged="ddlState_SelectedIndexChanged"DataTextField="StateName"DataValueField="StateID"></asp:DropDownList> 
                </td></tr><tr><td>
                    City of Birth:
                </td><td><asp:DropDownListID="ddlCity"runat="server"AutoPostBack="true"DataTextField="CityName"DataValueField="CityID"></asp:DropDownList></td></tr> 
            
 
            ______________________________________________________________________________________________________________________________________________
            <tr><td>
                    Source:
                </td><td><asp:TextBoxID="txtVerification"runat="server"></asp:TextBox></td></tr> 
            ______________________________________________________________________________________________________________________________________________
            <tr><td><asp:ButtonID="btnClear"runat="server"Text="Clear"/></td><td><asp:ButtonID="btnSubmit"runat="server"Text="Submit"OnClick="btnSubmit_Click"/></td></tr></fieldset></div></form></body>
 
Can anyone help me? I am sure it is something minor.
 
Thanks, I look forward to hearing from you.

Getting error ORA12541 while connecting to oracle through ASP.net

$
0
0
I am developing an ASP.net application wherein I am trying to connect to Oracle database using sqldatasource. While defining new connection, when i click on test connection button on the dialog box, I am getting error:
Error 12541 - TNS: no listener.
My oracle listener is up. Kindly help me in getting rid of this error.

JavaScript Code not working properly for a registration ASP page.

$
0
0
I have a register form to make. But client side validation not working properly. Can anyone help me out.
 
Thanks in Advance.
 
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Register.aspx.cs" Inherits="Register"%> 
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<htmlxmlns="http://www.w3.org/1999/xhtml"><headrunat="server"><scriptlanguage="javascript"type="text/javascript">function Validate() {
var summary = "";
summary += isValidName();
summary += isValidEmail();
summary += isValidMobile();
if (summary != "") {
//alert(summary);
returnfalse;
}
else {
returntrue;
}
}
function isValidName() {
var Name = document.getElementById("TxtName");
if (Name.value == "") {
    alert('Please provide a valid Name');
    Name.focus;
    returnfalse
    }
else {
  return"";
}
}
function isValidEmail() {
    var email = document.getElementById('TxtEmail');
    var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if (!filter.test(email.value)) {
        alert('Please provide a valid email address');
        email.focus;
        returnfalse;
    }
}
function isValidMobile() {
var Mobile = document.getElementById("TxtMoible");
    if (Mobile.value == "") {
        alert('Please provide a valid Mobile');
        Mobile.focus;
        returnfalse
    }
else {
    return"";
}
}
</script></head><body> 
<%--<form name="myForm" action="demo_form.asp" onsubmit="return validateForm();" method="post">
Email: <input type="text" name="email">
<input type="submit" value="Submit">--%> 
    <formid="form1"runat="server"><div> 
        <tablestyle="width:100%;"><tr><td>
                    Name
                </td><td><inputid="TxtName"type="text"/></td><td>&nbsp;</td></tr><tr><td>
                    Email ID</td><td><inputid="TxtEmail"type="text"/></td><td>&nbsp;</td></tr><tr><td>
                    Confirm Email ID</td><td><inputid="TxtConfirmEmail"type="text"/></td><td>&nbsp;</td></tr><tr><td>
                    Password</td><td><inputid="TxtPass"type="text"/></td><td>&nbsp;</td></tr><tr><td>
                    Confirm Password</td><td><inputid="TxtConfirmPass"type="text"/></td><td>&nbsp;</td></tr><tr><td>
                    Mobile No.</td><td><inputid="TxtMobile"type="text"/></td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td><asp:ButtonID="BtnSubmit"runat="server"onClientClick="return Validate();"onClick="Button1_Click"Text="Register Now"/></td><td>&nbsp;</td></tr></table> 
    </div></form></form></body></html>

Why is it so difficult to make search by dropdownlist value? (Solved)

$
0
0
Hi Experts,
 
I have this:
 
<asp:DropDownList ID="ddlLocation" runat="server" AppendDataBoundItems="True" 
     AutoPostBack="True" Width="140px">
   <asp:ListItem Value="0">Choose Location</asp:ListItem>
  </asp:DropDownList>
 
Then this sub on codebehind:
 
 Public Sub BindData()
        Dim oconn As New SqlConnection(sqlconn)
        '   AddHandler ddlLocation.SelectedIndexChanged, New EventHandler(AddressOf ddl_SelectedIndexChanged)
        oconn.Open()
        Dim ocmd As New SqlCommand("select l.locationid,l.Location, c.CourseId, i.instructorId,CourseName, i.instructorname, dbo.fnFormatDate(t.trainingDates, 'MON/DD/YYYY') trainingDates, t.trainingTime,CourseDescription from tblCourses c, tblLocations l, tblTrainingDates t, tblInstructors i, tblCourseInstructor ci where l.locationid = c.locationid and c.dateId = t.dateId and i.instructorid =  ci.instructorId and c.courseid=ci.courseid and YEAR(t.trainingDates) = YEAR(getDate()) and l.locationId = " & ddlLocation.SelectedValue, oconn)
        Dim oda As New SqlDataAdapter(ocmd)
        Dim builder As New SqlCommandBuilder(oda)
        Dim ds As New DataSet()
        oda.Fill(ds)
        gv1.DataSource = ds
        gv1.DataBind()
    End Sub
 
We would like to select a value from the ddlLocation dropdownlist and display records associated with that value.
 
Any ideas how to handle this?
 
Thanks a lot in advance

How to add Items in DropDown List Programitically ???

$
0
0
Hi,
There is two dropdown list on page. One is for State and second one is for City related to that sate only.
I have added the Name of state in first dropdown list and would like to write programming in such a way so
that when I select the name of state the city related to that state adds automatically in second dropdown list.
 
I tried many code but all are giving error.
like
 
protected void State_DropDownList_SelectedIndexChanged(object sender, EventArgs e)
 
{
if (State_DropDownList.SelectedItem.Text == "Bihar")
{
City_DropDownList.Items.Add("Patna");
City_DropDownList.Items.Add("Gaya");
City_DropDownList.Items.Add("Aurangabad");
}
}
 

 

protected void State_DropDownList__TextChanged(object sender, EventArgs e)
{

if (State_DropDownList.SelectedItem.Text == "Bihar")
{
City_DropDownList.Items.Add("Patna");
City_DropDownList.Items.Add("Gaya");
City_DropDownList.Items.Add("Aurangabad");
}
 
but these codes are not working please help me.
I do not want to use database for that.

ASP.NET project not 'seeing' css file

$
0
0
Hello
 
If I have this in the <body> tags of my Site.master file:
 
<div class="navbar-collapse collapse">
                   
<!--<ul class="nav navbar-nav">
<li><a runat="server" href="~/">Home</a></li>
<li><a runat="server" href="~/About">About</a></li>
<li><a runat="server" href="~/Contact">Contact</a></li>
</ul>-->
                    
<asp:LoginView runat="server" ViewStateMode="Disabled">
    <AnonymousTemplate>
       <ul class="nav navbar-nav navbar-right">
 
<li><a runat="server" href="~/Account/Register">Register</a></li>
<li><a runat="server" href="~/Account/Login">Log in</a></li>
 
</ul>
 
..............
 
and this in the <head> tags:
 
<link rel="stylesheet" type="text/css" href="logon.css">
 
Why can't my vb.net project see the logon.css file that I created:
 
.nav a:link { color: #ffffff; text-decoration: none; }
.nav a:hover { color: #ffffff; text-decoration: underline !important; }
 
and which appears in Solution Explorer (please see screenshot).
 
Basically, I am trying to change the colour of two links, 'Register' and 'Log on', to white.
 
Thank you.

image link are broken in the article

$
0
0
Hi all,
 
I have posted an article but its image links are broken. Can anybody from Approval team look it?
 
here is link of article.
 
www.codeproject.com/Tips/816581/Create-a-Class-Collection-of-another-Class-Extend
 
Thanks,
Prakash

two imagebutton controls - one works the other doesn't - no changes made

$
0
0
Hi,
I am using Visual Studio 2010, VB.NET, my site has .NET 4, using Web Forms. I have a page with, among other things, two asp:ImageButton controls, each in its own little AJAX UpdatePanel. This page has been working since some time in 2013. One button is Add To Wishlist, the other Add To Cart. Both have an OnClick event and they are nearly identical, with the exception of the purpose and SQL Server stored procedure they call. As I said, they've both been working for quite a while. I made no changes to the page. Yet, suddenly, the Add to Cart button does not work...nothing happens, no error is thrown, it just doesn't do anything. the Add to Wishlist button still works as before. When they are updated, the image is changed. Add to Cart image is changed to "In Cart", Add to Wishlist is changed to "In Wishlist".
 
I've seen some complaints about ImageButtons not working in the latest IE, but this is in Firefox as well as IE.
 
I don't understand why one works and the other doesn't, and why it happened when no changes were made to the page.
 
My site is on a shared hosting plan at web.com, so there are many things that I cannot do. I only have access to certain things on the server.
 
Could a change they made cause this? But still, one button still works, same page, nearly the same exact code.
 
there are actually two pages, one is for pay items, one is for freebies. Both use the same code, and the Add to Cart button is not working on either page...both were working until recently.
 
I thought that perhaps the page was corrupted, so I re-uploaded the pay item page and cycled the application (I at least can do that), but it made no difference.
 
Help!
Dana
Viewing all 3938 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>