I'm looking at an asp.net application, i notice that there are assemblies defined into two places. In web.config there is configuration/system.web/compilation/assemblies/add elements. In the project file there are references setup under the Project/ItemGroup/Reference elements.
I was wondering, what is the difference between assemblies/references added in either location?
For coonverting Linq to DataTable I am using the following Extension Method(Taken from Stackoverflow)
L[code]....
The Extension Method creates XML file.But for null values no element is created in XML file.Say if Commission field is null then commission element is missing in Xml generation.
I want to insert element with empty string for null values (ref type) and (0.00) for decimals and (0) for integers. where do i need to make change?
I am trying to collect the chosen value from a html select element and insert it into an SQL Server 2005 database and I get the following exception caught:
Failed to convert parameter value from a HtmlSelect to a String. (I've been converting everything to String before submission to the DB using ToString();
new to C# question: I am in an iteration of a for loop and if a condition exists I want to jump to the next iteration of the for loop, how do I do this in C#?
I have List (of class). having 1800 of count and each object has 90 properties. When I terate earch with 90 properties taking more and more time. How to resolve this
Dim cellIntStyle As HSSFCellStyle = hssfworkbook.CreateCellStyle cellIntStyle.DataFormat = HSSFDataFormat.GetBuiltinFormat("#") Dim cellDateStyle As HSSFCellStyle = hssfworkbook.CreateCellStyle cellDateStyle.DataFormat = HSSFDataFormat.GetBuiltinFormat(Format ("dd-MMM-yyyy")) For Each mReport As Report In dtExcel row = sheet1.CreateRow(iRow) j = 0 For Each prop As PropertyInfo In props Dim value As Object = prop.GetValue(mReport, Nothing) If IsInt(value) Then CreateRow(row, j, CType(value, Integer), cellIntStyle) ElseIf IsDate(value) Then CreateRow(row, j, String.Format("{0:dd-MMM-yyyy}", value), cellDateStyle) Else CreateRow(row, j, value) End If j = j + 1 Next iRow = iRow + 1 // Coming here taking so long... how to make it fast. Next Private Sub CreateRow(ByRef row As HSSFRow, ByVal colId As Integer, ByVal value As String) row.CreateCell(colId).SetCellValue(value) End Sub Private Sub CreateRow(ByRef row As HSSFRow, ByVal colId As Integer, ByVal value As Integer, ByVal cellStyle As HSSFCellStyle) Dim cell As HSSFCell = row.CreateCell(colId) cell.SetCellValue(value) cell.CellStyle = cellStyle End Sub Private Sub CreateRow(ByRef row As HSSFRow, ByVal colId As Integer, ByVal value As String, ByVal cellStyle As HSSFCellStyle) Dim cell As HSSFCell = row.CreateCell(colId) cell.SetCellValue(value) cell.CellStyle = cellStyle End Sub
I've got a while loop that's doing some stuff, and what I want is for it to create a new array each time.
while(condition){ //do some stuff //create an array x[] //amend values in array //save as new array each time until loop finished }
Actually i need to store the comma separated values of different datatypes in an array using split.And then i hav to sort these values comparing zeroth position element of all rows.
Is it possible to detect or use a different template in the asp.net repeater for the last iteration in the repeater?If not I could just use a for loop but I'm curious if it can be done.
I'm doing some custom code for a SharePoint webpart in C#. Specifically, I'm making a quiz, my main point here addressing the list that holds the question, answer choices, and correct answer.
At the last stage of the quiz I need to check the answers selected by the user against the correct answer in the list. Currently, I'm doing the following to check if each is correct, which I'm assuming isn't very efficient because it iterates through each question. Is there a method, specifically for the SPList foreach loop, that would be more efficient?
// 1. Store questions and answers in class List<submittedAnswers> answeredQuestions = new List<submittedAnswers>(); // 2. From POST pull answered question IDs and answer IDs (which correspond to the question primary key and answer choice number both stored in the list) // INSERT BEAUTFIUL AND EFFICIENT WHILE LOOP HERE // 3. Loop through each question is list, if question was given, test if correct/incorrect using (SPWeb myWeb = mySite.OpenWeb()) { SPList answerList = myWeb.Lists[questionList]; foreach (SPListItem quizEntry in answerList.Items) { int pullAnswerId = int.Parse(quizEntry["Answer"].ToString()); // Pull answer number from list int pullQuestionId = int.Parse(quizEntry["ID"].ToString()); // Pull primary key of question submittedAnswers result = answeredQuestions.Find(delegate(submittedAnswers e) { return e.questionId == int.Parse(quizEntry["ID"].ToString()); }); if (result != null) { if (result.responseId != pullAnswerId) // If the response was different from the answer incorrectAnswers++; else correctAnswers++; } } } // C# quiz grading magic here....
In my app I have a criteria builder section that's built using jquery and is pitched back to the controller in a form post and picked up as IList by the model binder as suggested in Phil's post here: http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx A really simple way that I'm persisting the criteria across posts is re-delivering the IList object to the view. I'm using a DisplayFor() template for this object, but because it's a list I need to know the index # inside of the template.
I have made an asp.net website which is using master page in it.
my programming language is c#. I want to iterate through content page controls but i m not able to do it. I have searched a lot on internet but of no avail.
I think this is something really easy that I am missing. I have a loop that is sending emails. The loop adds an attachement from a FileUpload instance. The first run of the loop is fine but each subsequent run the attachment is empty. I have found mention of reseting contentstream.position to 0 but that doesn't seem to apply to the FileUpload control. I am attaching the code below.
I'm writing an update script that goes through each record and performs various updates, and I want the current record to display while it's processing.
For Each row As DataRow In DS.Tables(0).Rows
'Label Inside Ajax Panel Label_Ajax.Text = row.Item("product_id").ToString 'Label Inside Ajax Update Progress Panel Dim newlabel As Label = UpdateProgress1.FindControl("Label_AjaxProgress") newlabel.Text = row.Item("product_id").ToString ' Tried straight to console, but doesn't work Console.Write(row.Item("product_id").ToString)
Next
I've tried all three methods shown above, but they all end up displaying the last record after the iteration is complete. How can I get the current record to display on the screen during the iteration?
I must to read table in html file. I'm try to read html table to data set and xml but it dosen't work. Anyone have any solution to read table or entity control in html file.
I 'm trying to connect to the database in file settings.web but displayed error. What's wrong?
web.config: [Code]....
An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Parser Error Message: The format of a configSource file must be an element containing the name of the section.
This doesn't happen when I create the site in my local drive. Is there a workaround to this. Even if I add the missing parts, I keep getting the same error.
Let's imagine you have an asp.net page in front of you full of input elements, user controls and panels etc. And you are asked to modify a specific textBox and you do not know where that textBox stands in your project. Most of the time I use FireBug and try to see the Id of that element but it is not the best way all the time. So, What is the fastest way you believe that can be used to locate the source file that houses a specific html element in your web project?
I'm trying to make the conversion to Selenium 2, but I seem to have an issue were if I go to http://website.com, Selenium cant find the elements of my aspx form. I need to have Selenium go directly to http://website.com/form.aspx. This isnt horrible because I can make sure the forms work, but ideally I would like it to complete everything from the users point of view.
I am trying to break a large web.config file into smaller parts. This has been covered a few times on different stack overflow questions (like this or this) which recommend using the configSource or file attributes. The problem is this does not work for the system.webServer section used to configure IIS 7 in integrated mode. This is particularly bad for web.config files that have IIS Rewrite rules which tend to bloat the files.
The httpRuntime element configures ASP.NET HTTP run-time settings that determine how a request for an ASP.NET application is processed.
Is it a good idea to customize this element in the config file.
The user has indicated that the application seems to be kicking her out, even though she is sure that she is submitting a form faster than every 30 minutes.
My Config file has these vales set, am I missing anything?
I would like to select an element that is in the same TR as another element I found with a selector. The selector itself: $("input[name='sMessageValue']","#messageTable") Now I have this element and got its value I would like to find a checkbox located in the same TR, i tried this as starting point : $(this).(':parent').val(). But seems not the right thing to do.
You're making a website with ASP.NET 4.0/C#, although xml alone is suitable for this example. The site will have a site map and a default page with a menu control, as follows:Web.sitemap