|
if i keep all code as it is and just change framework to 3.5 from 2.0 then this current code is working...so there is no issue with url ...i guess there is some issue in web.config setting for http handler..if you know this then please check...just to remind you that my webmethod is on my .aspx(code behind page itself)
Please check Default.aspx code behind code for reference
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Web.Services;
using System.Configuration;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
[WebMethod]
public string Mydata(string username)
{
return "Returned String";
}
}
|
|
|
|
|
Himen23 wrote: f i keep all code as it is and just change framework to 3.5 from 2.0 then this current code is working...so there is no issue with url .. I understand what you're saying but the error you are getting is that the url is not found. How are you changing the .net framework?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Open solution Explorer>> Right click on Application>>Second last option "Property Pages" or "Shift+F4" >>Build tab change Target framework then...
|
|
|
|
|
I've never seen changing the target framework affect how a relative url works.
However, I have looked back at your posts and your original post has the url "../WebService.asmx/Mydata" but a couple of posts ago you said it was in Default.aspx.
You need to fix the url.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
i m sorry.. it was because i was trying different ways...but please cosider it as
"../Default.aspx/Mydata"
|
|
|
|
|
The error is what it is. It can't find the url. I've never seen changing the framework do that but perhaps you need to research the issue with relative urls and the framework.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
|
|
Very simple,
1 open the web source code,
2 copy from the embed script the source link of url,
where the video is linked to the page.
3 copy that link and past it in new page link bar.
enjoy
|
|
|
|
|
anyone please tell me how to make a contact form using asp.net c#. I have many time to try make a contact form but given error.
|
|
|
|
|
Post the code you've tried and the error you're getting.
|
|
|
|
|
There are an infinite number of ways to make a contact form. It all depends on what you want. You may just need to add some input controls and then use the SMTP[^] class in the System.Net namespace to send the email, if you want email.
It all depends on what you want.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I have try to server page redirect using button. but I want to try using href link then its not server redirect. anyone help me how to server page redirect using visual studio 2013.4 in href link.
|
|
|
|
|
|
Member 11659740 wrote: ut I want to try using href link I don't understand where you are stuck? It sounds like you are asking how to do a hyperlink. What really is your question?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hello...
Im implementing interface concept in asp.net web application to insert city details to database table. Im getting error as "Internal Compiler Error: stage 'DEFINE'" i couldn't able to access the interface and the class which has been implemented by that interface in asp webform...!
aspx.cs code:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Interface_Project.Presenter.PresenterAdmin;
using Interface_Project.Model.ModelAdmin;
namespace Interface_Project
{
public partial class ManageCity : System.Web.UI.Page
{
ModelCityDetails modelObjCity = null;
protected void Page_Load(object sender, EventArgs e)
{
modelObjCity = new ModelCityDetails(this);
}
protected void btnAdd_Click(object sender, EventArgs e)
{
if(modelObjCity.insertCityDetails())
{
ClientScript.RegisterStartupScript(this.GetType(),"alert","<script>alert('City details inserted successfully.')</script>");
}
else
ClientScript.RegisterStartupScript(this.GetType(),"alert","<script>alert('Error in inserting city details.')</script>");
}
}
public partial class ManageCity : Interface_Project.Presenter.PresenterAdmin.ManageCity.IManageCity
{
public int cityid
{
get
{
return 0;
}
set
{
}
}
public string cityname
{
get
{
return txtCity.Text;
}
set
{
txtCity.Text = value;
}
}
}
}
Any help appreciated...! Thank you...!
|
|
|
|
|
What line gives the error and what is the exact line? If the problem is where you call the code then you'll need to paste that code too.
|
|
|
|
|
How to insert textboxes dynamically in gridview and than insert the textbox data in the database?
Using VS2013 framework 4.5
ASP.NET C#
|
|
|
|
|
Add a textbox in a GridView control.
Usually, you will attach a GridView to a database table. Let's assume, you have a column called XYZ in the table. You can add an editable textbox to the GridView as shown below.
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false"
ShowFooter="true">
<Columns>
<asp:TemplateField HeaderText="XYZ">
<ItemTemplate> <%#Eval("XYZ")%> </ItemTemplate>
<FooterTemplate><asp:TextBox ID="tbXYZ" Width="200px" runat="server" /></FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
You will find the entire code here in in this article[^]
Hope this helps.
Hi,
This is arun
|
|
|
|
|
step 1: i took a web site application
step 2: i took a master page (.master) and 2 content pages (.aspx), of that are inherited from master page.
Step 3: i took both master page and content pages of same hierarchy in solution explorer of my application.
Step 4: when i run the application it works fine in my local system.
Step 5: when i run the application, it throws an error related to parsing kind of stuff.
as i thought:
1) either my application is not compiled properly
2) or my application thinks that the site master is located in different folder.
3) i did tried with master page virtual and type name properties, but no progress in this error.
any help would be appreciated.
|
|
|
|
|
Given the information you have supplied the only response I can think of is; "You're not using master pages correctly or not building your site correctly". You mentioned you get an error message so if you at least say what that message is and post the relevant code\markup it might give us something to go on.
|
|
|
|
|
We would love to help but without the error we can only guess which of the 1,234,744 possible errors it is.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I want to use:
using (StreamReader reader = new StreamReader(NRFileUpload.FileContent))
instead of
using (StreamReader reader = File.OpenText(@"c:\Users\pzd74f\Downloads\FinalLabor2015.csv"))
However when I try to insert this code:
protected void ImportButton_Click(object sender, EventArgs e)
{
if (this.FileUpload.HasFile)
{
var extension = Path.GetExtension(FileUpload.FileName);
if (extension == ".csv")
{
using StreamReader reader = new StreamReader(FileUpload.FileContent))
}
}
}
It just imports the file and the rest of my code is not executed.
Here is my code:
using System;
using System.Configuration;
using System.Data;
using System.IO;
using System.Data.Common;
using System.Data.SqlClient;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Globalization;
namespace StaffingWebParts.VisualWebPart1
{
public partial class VisualWebPart1UserControl : UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
gvNewResource.DataSource = QueryStaff();
gvNewResource.DataBind();
}
}
private static char[] Colon = new char[] { ',' };
private DataTable QueryStaff()
{
const int nameColumnIndex = 1;
const int hoursColumnIndex = 9;
using (var conn = new SqlConnection(ConfigurationManager.ConnectionStrings["SQLStaffingConn"].ConnectionString))
using (var cmd = new SqlCommand("", conn))
using (var dataAdapter = new SqlDataAdapter(cmd))
using (var cmdBuilder = new SqlCommandBuilder(dataAdapter))
{
conn.Open();
cmd.CommandText = "CREATE TABLE #TempTable(Name nvarchar(100) NOT NULL, Hours decimal(6, 2) NOT NULL);";
cmd.ExecuteNonQuery();
DataTable dataTable = new DataTable();
cmd.CommandText = "SELECT * FROM #TempTable;";
dataAdapter.Fill(dataTable);
dataTable.BeginLoadData();
using (StreamReader reader = File.OpenText(@"c:\Users\pzd74f\Downloads\FinalLabor2015.csv"))
{
string line;
if (reader.ReadLine() != null)
{
while ((line = reader.ReadLine()) != null)
{
string[] columns = line.Split(Colon, StringSplitOptions.None);
DataRow row = dataTable.NewRow();
row["Name"] = columns[nameColumnIndex];
row["Hours"] = Decimal.Parse(columns[hoursColumnIndex], NumberFormatInfo.InvariantInfo);
dataTable.Rows.Add(row);
}
}
}
dataTable.EndLoadData();
dataAdapter.Update(dataTable);
dataTable.Clear();
cmd.CommandText = "SELECT Tmp.Name, SUM(Tmp.Hours) as Hours FROM #TempTable AS Tmp WHERE NOT EXISTS (SELECT * FROM StaffTracking AS ST WHERE Tmp.Name = ST.ResourceName)GROUP BY Tmp.Name;";
dataAdapter.Fill(dataTable);
return dataTable;
}
}
}
}
|
|
|
|
|
|
Hi,
Thanks for the information. I was able to get the correct code but where do I put this in my code?
protected void UploadButton_Click(object sender, EventArgs e)
{
if (NRFileUploadControl.HasFile)
{
try
{
string filename = Path.GetFileName(NRFileUploadControl.FileName);
NRFileUploadControl.SaveAs(Server.MapPath("~/") + filename);
StatusLabel.Text = "Upload status: File uploaded!";
}
catch (Exception ex)
{
StatusLabel.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message;
}
}
}
It just runs this part and don't execute the rest of my code.
Thanks,
Norris
|
|
|
|