Actually im getting error when the below code is executed from unit test project... where import is an xml file in the below code.. XmlTextReader importReader= new XmlTextReader(System.Web.Hosting.HostingEnvironment.MapPath("~/Content/Importcontent/import")); the above code is present in one of the methods in different project(class library) which is used in test method in the unit test project where as the above path is present in web project. and the value of the System.Web.Hosting.HostingEnvironment.MapPath("~/Content/Importcontent/import") is null..ie unable to get the complete path of the file i guess bcos the hostingenvironment is not running(web project) The above code is working fine when running from the webproject ie it returns the exact path. whereas returning null value when running from test project. please let me know how to fetch the file path(where file is present in web project) when running from test project.
I have some objects I should add to ASP.NET application state. Of course, I can add the object as a whole. The class that object belongs to have some properties and all of them will be added with the object to the application state.
But, is there a way to mark some properties of the class to not be included in adding object to the application state? I've thought about writing attribute, but am not sure if it will work.
i would like to do (ASP.NET-AJAX with C# )an autocomplete search textbox(like Google search) that give the user to choose more than one value to research in DataGrid as follows :
1 | 2 | 3
when the user insert the first value can have also the possibilities to insert the second value value and so on ... then the datagrid can show all result requested and preferably i should do it in C# .
You can use this control(Multiselect Dropdown for Web Applications[^]) coupled with AJAX calls to make it as an autocomplete list. Based on the text entered, filter the datasource of the checkboxlist and once the values are selected, use the selected values as a folter for your grid.
it is a good example but i can not filter the checklist box meantime i am inserting the value in the textbox...anyway i am trying to repair this error if you have any suggestion i will be so gratefel.
not error in the project on codeproject but in my project that meantime i insert the value in the textbox i want the checkboxlist work likes the Autocomplete but it doesn't that so ai m trying to complete this issue.
Thanks so much for your help .
I am very confused to choose among many ways to do a task efficiently. Please suggest me the best way to do the following..
All I want is to "search a sql-database and show up the result in a grid". Note that each row would have an image, a link and some text.
My main check points are
1) Ajax-style grid: On pressing next-page, only the grid should be updated not the whole page
2) Client side pagination: Since the search result might be huge, on each time pressing the next-page, I want to get only the specified rows from the server. NOT THE WHOLE SEARCH RESULT- WHICH WOULD SLO DOWN MY INITIAL GRID SHOWING
I am new to web-programming. While browsing through I got the following points...But i am not able to put them all together and somehow i am not confident about it..very much confused what to use and what not to... please help!!!
1) asp.net ajax toolkit
2) use a simple way to create a table with many rows in client side using java script, and get the data form server using AJAX writing the all code of myself. But in this case i need to have a way of pagination if myself
3) etc (may be many other solutions exist)
Practically, there may be many pros and cons which I am unaware of. I am looking for something efficient and easy to use. May be less code.
technology: vs2008/2010, Ajax/Jquerry/JS, sql-db... since havent started teh project I am open to any technology which gives the best solution.
I am looking for something efficient and easy to use. May be less code.
Based on the following parameters, my suggestions would be:
1. Use a DataGrid and not a simple table to avoid extra code
2. Implement server side pagination such that each page is fetched on-demand
3. Use client side techniques to update the grid - jQuery AJAX, ASP.NET AJAX, Callback, WebMethods, etc.
One mistake in your question: "Client-side pagination" => that means whole data in one go and on page change no data fetched from server. That would not be needed.
From the microsoft site, I can see you can use the log property of the datacontext object for debugging linq to sql in a visual studio.net 2010 web form application. From what I have seen on the internet, you can do a console.out to any instance of a textwriter. This would be for a windows application.
How would you accomplish this task for a web form 2010 C# application?
Create a class
Public Class atuosender
Dim timer As System.Timers.Timer
Dim filepath As String
Public Sub New(ByVal st As String)
Dim timer As New System.Timers.Timer(8640000)
filepath = st
AddHandler timer.Elapsed, AddressOf timer_Elapsed
timer.Enabled = True
Private Sub timer_Elapsed(sender As Object, e As ElapsedEventArgs)
File.AppendAllText(filepath + "\TextFile1.txt", "Heloo")
End Namespace add global.asax
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
Dim ats As New clsatuosender.atuosender(Server.MapPath("files").ToString())
' Fires when the application is started
how to use array in asp.net textbox
when I press the save button the value of text which i fill will be write on response.write??
However, I got this error after I sent it to the server:
Server Error in '/' Application.
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
I have a requirement to implement user privilege elevation in an MVC3 web app, for both Forms and Windows authentication. This is for a higher privileged user to give assistance to a lower privileged user, e.g. when the lower user is performing a task and requires an admin task to be completed before they continue, the admin user should be able to elevate the same session to their privilege level, perform the admin task, and restore the lower privilege to the session.
Is this even possible, and if so, how can I achieve this? I have no idea where to even begin looking.
Im a Software Developer currently working in NCPL.. Here i've a problem regarding Editing of templates at different positions..
We have a ASP.net software where in we sent emails to clients on various occasions. For those events we select templates and edit the data or image in it and send it to our clients.. The problem over here is that i've took a radeditor component and tried to insert a template in it. But unable to edit it at different positions programmatically
.. So i request you to kindly clear my issue as soon as possible..
Thanks for replying to my mail. The main idea is there is a fixed template with text,images,headings etc. User selects this template(text/image in the template) and Edits the text as his wish depending on his requirement. For this editing he uses a editor(HTML editor/RAD editor). This editors will have design and html tabs. Wherein Design will consist of original template and html consists of dynamically genrated html code. So if a user edits image automatically html code changes. Atlast when his reqt satisfied he sends the template to his client via Email.
I have a C#. net 2010 web form application that I am going to maintenance and add linq to sql statements in the existing application. This application communicates with a sql server 2008 r2 professional edition database.
My problem is acutally wanting to know who to debug (step through) the code. I can get the general idea of what the code does. Howeever, I would like to know how to step through the code. Can you give me some help in this area?
Highlight the first line of code where you want to start debugging and press the F9 key. Press F5 to start the application and it will come to a stop on the line with the breakpoint set. Press F10 to go to the next line or F11 to debug into a method. You can hiver over varibles ot see the current value, add a watch to a variable so that yu can see the value changing or right click and quick watch to see all of the properties of a variable or whatver at that moment in time. That is a small part of what you can do - you shoul dtry reading up on the subject before starting.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum
I have to host a website on LAN using IIS, I want that all LAN users would be able to access only home page of my website, after sign in or register they will be allowed to navigate to other pages.
How can I do this?
My website is developed in classic asp..
By default, IIS has few defined startup pages like default.asp, index.asp, etc. Either make your login page by any of these name or add the login page as the start up page in IIS for your website. In IIS, see in 'Documents' or 'Default Document' tab for it.
//It is for Upto Windows XP and Server 2003.
Right click on your project in iis--> Propertis --> Documents Tab --> Click on Add Button --> Write Your Start up page name with extention. --> Make it as first item in the list by clicking on up arrow. --> Click on OK.
// Windows 7 and above
Select your project, you will find some options in the middle pane. You will identify the DefaultDocument option. Double click on that, it will open a dialog then write your Start up page name with extention. Autometically it will shows the page in first position.
I would like to use your color trackbar in a vb.net app. Will I've done a fair amount of coding with vb.net I have not tried to incorporate a C resource such as your color trackbar. Can you or another reader help me?
I am new in ASP.NET c# web application development. I am creating a simple Account Management application. I am experiencing an error when using QueryString to pass value to a form. I have a main form named WebForm1.aspx. When I click a button named View List, it will pop-up a separate window with a gridview displaying all the account from a SQL database. The new window is called frmList.aspx, the gridview has a button on each row, and when I click the button it should transfer the data from the row to several textbox in the first page, WebForm1.aspx. But after I click the button it gives me an error. Below is the code behind for frmList.aspx
protectedvoid Page_Load(object sender, EventArgs e)
if (ClassProj.GetDBconn() == true)
String SQLstr = "SELECT a.ID, a.NAME AS Name,b.NAME AS Industry,a.subindustry as SubIndustry,a.geo AS Geo,c.NAME AS LocType FROM mpsacct AS a,industry AS b,location AS c WHERE a.industry=b.id AND a.loctype=c.id";
MySqlCommand cmd = new MySqlCommand(SQLstr, ClassProj.mycon);
MySqlDataReader reader = cmd.ExecuteReader();
//Bind the grid view
grdAll.DataSource = reader;
publicvoid MPS_Selected(Object sender, GridViewCommandEventArgs e)
if (e.CommandName == "Select")
// Convert the row index stored in the CommandArgument
// property to an Integer.
int index = Convert.ToInt32(e.CommandArgument);
//Populate textbox with selected values
//String s = Request.QueryString["grdAll.Rows[index].Cells.Text.ToString();"];
string name = grdAll.Rows[index].Cells.Text.ToString();
string Industry = grdAll.Rows[index].Cells.Text.ToString();
string SubInd = grdAll.Rows[index].Cells.Text.ToString();
string geo = grdAll.Rows[index].Cells.Text.ToString();
string location = grdAll.Rows[index].Cells.Text.ToString();
Page.Response.Redirect("WebForm1.aspx?name=" + name + "&industry=" + Industry + "&subind=" + SubInd + "&geo=" + geo + "&location=" + location);
I see a lot of issues but I am not sure if any are the actual error.
1. You likely need to check for Page.IsPostBack() in your Page_Load event and only DataBind when it is not a postback.
2. When you Respone.Redirect go to the root. So, do Response.Redirect("~/WebForm1.aspx") or whatever the path is. 404 means the page cannot be found.
3. URLEncode your parameters in case they have spaces or other special characters.
There are only 10 types of people in the world, those who understand binary and those who don't.