|
|
The gate way http://127.0.0.1 is not working plz give the currently running gateway
|
|
|
|
|
hiii!!! i want to fatch data in list box.. the selection based on dropdown list .. if we select value in drop down then required data will be fatch in list box.. the required data will be fatch accroding to userttype value ..the values of usertype=1,2. i m using 3 layer architecture...
my store procedure
USE [SCJ]
GO
/****** Object: StoredProcedure [dbo].[sp_sendmail] Script Date: 02/10/2014 12:34:17 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:<author,,name>
-- Create date: <create date,,="">
-- Description:<description,,>
-- =============================================
ALTER PROCEDURE [dbo].[sp_sendmail]
-- Add the parameters for the stored procedure here
(
@usertype INT
--@emailid nvarchar(50)='',
)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
BEGIN
-- Insert statements for procedure here
if(@usertype='usertype')
SELECT emailid from Login_User_Info where LTRIM(RTRIM(usertype)) = LTRIM(RTRIM(@usertype))
END
END
|
|
|
|
|
What's the problem? any error? struck where? Always include these details in your question.
thatrajaCode converters | Education Needed
No thanks, I am all stocked up. - Luc Pattyn
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is - Henry Minute
|
|
|
|
|
I am Working on an ASP.Net website with c#.Net as Code Behind where I need to Call a phython script which does some business logic. Can anyone please tell me how to call a phython script from ASP.Net website.<u></u>
|
|
|
|
|
|
i want to set the menu items in center on hover event.
|
|
|
|
|
Hi I've been searching awhile but haven't found what I was looking for. I am trying to upload a file to SQL database using HTML5 <input type=file>. I have the html5 side done but am looking for a resource or example of server side code that will upload the file to a SQL server. I know I'll using httpwebrequest. Do I use a webservice (asmx file)? a handler (axhx file)? or something else?
Thank you!
John
|
|
|
|
|
A generic handler is probably the simplest option.
Use the Files property[^] of the context.Request object to read the uploaded files. This will return a collection of HttpPostedFile[^] objects. You can then use the InputStream property[^] to read the contents of the file.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks Richard, I think I'm missing something. I created a generic handler .ashx file but "Files" is not a property of context.Request. The error message on "Files = HttpRequest.Files" is "Reference to non-shared member requires object" Here is my code...
Imports System.Web
Imports System.Web.Services
Public Class Handler1
Implements System.Web.IHttpHandler
Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
Dim loop1 As Integer
Dim arr1() As String
Dim Files As HttpFileCollection
Files = HttpRequest.Files ' Load File collection into HttpFileCollection variable.
arr1 = Files.AllKeys ' This will get names of all files into a string array.
For loop1 = 0 To arr1.GetUpperBound(0)
context.Response.Write("File: " & Server.HtmlEncode(arr1(loop1)) & "<br>")
context.Response.Write(" size = " + Files(loop1).ContentLength + "<br />")
context.Response.Write(" content type = " + Files(loop1).ContentType + "<br />")
Next loop1
End Sub
ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
Get
Return False
End Get
End Property
End Class
What I am missing?
|
|
|
|
|
As the error says, the Files property is not a Shared property; it's an instance property. You need to use context.Request.Files instead.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks Richard! I figured it out!
for those curious, here is code that uses html5, jquery, javascript, and an asp.net handler to display selected image, upload image from client and save to SQL Server...
here is html..
<input type="file" id="upldFile" name="files[]" />
<input type="button" value="Add Sign" data-icon="plus" data-mini="true" id="btnAddSign">
here is javascript...
$('#upldFile').change(function (evt) {
var formData = new FormData();
var files = evt.target.files;
for (var i = 0, f; file = files[i]; i++) {
if (!file.type.match('image.*')) {
continue;
}
var thumbnail = URL.createObjectURL(file);
formData.append(file.name, file);
$('body').data('formdata', formData);
var span = document.createElement('span');
span.innerHTML = ['<img class="thumb" src="', thumbnail,
'" title="', escape(file.name), '"/>'].join('');
document.getElementById('list').insertBefore(span, null);
}
});
$('#btnAddSign').click(function () {
var xhr = new XMLHttpRequest();
var url = 'Handler1.ashx?requestid=' + $('body').data('requestid') + '&backcolor=' + $('#cmbBackColor').val() + '&textcolor=' + $('#cmbTextColor').val() + '&signshape=' + $('#cmbSignShape').val() + '&signsize=' + $('#cmbSignShape').val() + '&platematerial=' + $('#cmbPlateMaterial').val() + '&border=' + $('#sldBorder').val() + '&signtext=' + $('#txtSignText').val() + '&signquantity=' + $('#txtSignQuantity').val()
xhr.open('POST', url, true);
xhr.onload = function (e) {
};
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
GetItems();
}
}
xhr.send($('body').data('formdata'));
});
Here is handler.ashx
Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
Dim requestid As String = context.Request.QueryString("requestid").ToString
Dim backcolor As String = context.Request.QueryString("backcolor").ToString
Dim textcolor As String = context.Request.QueryString("textcolor").ToString
Dim signshape As String = context.Request.QueryString("signshape").ToString
Dim signsize As String = context.Request.QueryString("signsize").ToString
Dim platematerial As String = context.Request.QueryString("platematerial").ToString
Dim signtext As String = context.Request.QueryString("signtext").ToString
Dim signquantity As String = context.Request.QueryString("signquantity").ToString
Dim border As Boolean = context.Request.QueryString("border").ToString
Dim Files As HttpFileCollection
Files = context.Request.Files
Dim uploadFiles As HttpFileCollection = Files
For i = 0 To uploadFiles.Count - 1
Dim postedFile As HttpPostedFile = uploadFiles(i)
Dim inStream As System.IO.Stream = postedFile.InputStream
Dim fileData As Byte() = New Byte(postedFile.ContentLength - 1) {}
inStream.Read(fileData, 0, postedFile.ContentLength)
Dim cnInsert As New SqlConnection(GetConnectionString("MyConnectionString"))
Dim cmdInsert As New SqlCommand
Dim da As New SqlDataAdapter
Dim lastupdate As New DataTable
Dim ds As New DataSet()
cnInsert.Open()
cmdInsert.Connection = cnInsert
cmdInsert.CommandType = CommandType.StoredProcedure
cmdInsert.CommandText = "spSRQSignsCustomInsert"
cmdInsert.Parameters.AddWithValue("@pSignSize", signsize)
cmdInsert.Parameters.AddWithValue("@pSignBackColor", backcolor)
cmdInsert.Parameters.AddWithValue("@pSignShape", signshape)
cmdInsert.Parameters.AddWithValue("@pSignText", signtext)
cmdInsert.Parameters.AddWithValue("@pSignQuantity", signquantity)
cmdInsert.Parameters.AddWithValue("@pSignTextColor", textcolor)
cmdInsert.Parameters.AddWithValue("@pBorder", border)
cmdInsert.Parameters.AddWithValue("@pPlateMaterial", platematerial)
cmdInsert.Parameters.AddWithValue("@pRequestID", requestid)
cmdInsert.Parameters.AddWithValue("@pRequestedImage", fileData)
cmdInsert.ExecuteNonQuery()
cnInsert.Close()
Next
End Sub
|
|
|
|
|
I am trying implement basic authentication method in web api and I currently in stage of reading user details from the database. I am expericing the following issue ('API.UserPro' does not contain a constructor that takes 0 arguments - error ) at the moment in the global.aspx:
protected void Application_Start()
{
GlobalConfiguration.Configuration
.MessageHandlers.Add(new BasicAuthMessageHandler()
{
PrincipalProvider = new UserPro()
});
public class UserPro : IProvidePrincipal
{
private User _userRepo;
public UserPro (User userRepo)
{
this._userRepo = userRepo;
}
public IPrincipal CreatePrincipal(string username, string password)
{
try
{
if (!_userRepo.Validate(username, password))
{
return null;
}
else
{
var identity = new GenericIdentity(username);
IPrincipal principal = new GenericPrincipal(identity, new[] { "Admin" });
return principal;
}
}
catch
{
return null;
}
}
}
}
Any advice or suggestion would be very helpful. Many thanks in advance.
|
|
|
|
|
As the error says, your UserPro class doesn't have a parameterless constructor. The only constructor in the code you posted takes an instance of the User class. To create an instance of the UserPro class, you'll need to pass in an instance of the User class.
GlobalConfiguration.Configuration.MessageHandlers.Add(new BasicAuthMessageHandler
{
PrincipalProvider = new UserPro(new User())
});
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you so much for your solution and help. Using your solution i was able to solve the issue.
Thank you very much once again.
Have a great day.
|
|
|
|
|
Hello Guys,
I have a simple asp.net page with an asp.net link button and asp.net content tag which point to a simple asp.net master page with an asp.net content place holder and a form tag. Here is the code of these two items:
Site.Master:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="WebApplication1.SiteMaster" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<form runat="server">
<asp:ContentPlaceHolder ID="MainContent" runat="server"/>
</form>
</body>
</html>
Default.aspx:
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton>
</asp:Content>
From some reason when we run this simple web application on one server the id the link bhutton get is MainContent_LinkButton1
and when we run this application on another server the id the link button get is _ctl0_MainContent_LinkButton1
Doese someone have an idia why we get the prefix _ctl0_ in a specific server and in another server we don't get it?
|
|
|
|
|
control IDs are changed so you don't have to worry about duplicate IDs on rendered HTML. It shouldn't also bother you as you still refer to the control's original ID in code. If for some reason rendered ID is important for you (i.e. you want to select it by jquery and can't use css class), you can add to the control the following property:
ClientIDMode="Static"
This will force asp.net to not change the contros's ID, but it is now your responsibility to make sure it is unique on the rendered HTML.
As for your question why on some servers there is _ctl0_ prefix - it may depend on OS version, IIS version, architecture and other factors.
--
"My software never has bugs. It just develops random features."
|
|
|
|
|
The server which gives you an ID of MainContent_LinkButton1 is running your application in a .NET 4.0 or higher AppPool. The server which gives you an ID of _ctl0_MainContent_LinkButton1 is running in a .NET 3.5 or earlier AppPool.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
But this is happen to us in two computers in which .net framework 4.5.1 is installed. How can this be?
|
|
|
|
|
You can have .NET 4.5.1 installed on a computer and still run an ASP.NET application in a .NET 3.5 AppPool. If you look at the "Advanced Settings" of the AppPool on the computer that's giving you the _ctl0_ prefix, you'll see the ".NET Framework Version" will be set to "v2.0" instead of "v4.0".
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
No, it is set to v4.0 and still giving _ctl0_ prefix
|
|
|
|
|
I am working on asp.net web application project. I want to develop a web page names as ApplyRulePage.aspx. User will apply rules (Rule has Start Time and End time) by uploading file. A Rule is defined for a period of time(From Start time to End time). lets say Rule is applied from a start time to end time(lets say from 14:56:59 March 1 2013 to 15:34:21 April 2013). User can apply multiple Rules if time span of Rules are mutually exclusive(means time is not clashing), So in this way We can apply any number of Rules for the User. But If lets say one Rule is applied and User wants to apply a new Rule and if time period of this new Rule is clashes with the Old Rule then We will give a message to the User that Old Rule will be deleted and new Rule will be applied and if time periods are not clashing it will so both Rule on Page.
So basic requirement is for a particular time period only one Rule should be applied.
My question here is how to implement this feature in asp.net. How well I can render page to the User so that it looks pretty good and For User it should be very easy to understand what exactly is happening on UI. If it could be achieved by javascript, jquery, ajax or some other programming, please let me know. If there is any link for a sample project or example please let me know. Sorry for such a stupid question actually I am learning asp.net by self and I have nobody to ask.
|
|
|
|
|
Whats the sql query for this table
the fields are : table name=Emp ,date_join current systemdate,
sal,city,state
pabitra behera
|
|
|
|
|
Let me Google that for you[^]
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|