Handle Last Iteration Of Repeater Differently?
Jan 18, 2011
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.
View 2 Replies
Similar Messages:
Mar 28, 2011
I have an Application_Error handler in my Global.asax file. However, I load many pages using an XHR request and would rather these "sub pages" return javascript or a real 500 code for my main app to process, rather than an error page.
Is it possible to handle errors on certain pages in a different way? Can a master page handle its own errors in a page extending it without bubbling it up to Global.asax?
View 4 Replies
Oct 12, 2010
Are there any differences between coding row-specific stuff inline within the repeater's template and doing so in the codebehind file in ItemDataBound?
EDIT: Re: differences - I think we're all agreed it makes for markup that's nasty to read/maintain :) I was thinking of performance benefits.
View 2 Replies
Sep 29, 2010
using c#.net/asp.net
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#?
View 1 Replies
Jan 24, 2016
[URL] how to handle item command event in above example?
View 1 Replies
Oct 13, 2010
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
View 4 Replies
Jul 21, 2010
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.
View 3 Replies
Nov 19, 2010
i want to insert iteration elements(Signal) according my requirement like below xml output.
<?xml version="1.0" encoding="UTF-8"?>
<WIUConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> [code]...
how i can achive this iteration concepts using C#.net LINQ to XML.Here is my Code:
XDocument xdco = new XDocument(
new XDeclaration("1.0", "utf-8", "Yes"),
new XComment("WIU Configurations"),[code]...
from above code how to insert iterate element with XML file?
View 2 Replies
Mar 8, 2011
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....
View 4 Replies
Jan 15, 2010
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.
View 1 Replies
Mar 22, 2010
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.
View 1 Replies
Oct 5, 2010
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.
[Code]....
View 2 Replies
Jan 13, 2010
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?
View 1 Replies
Feb 12, 2010
Why IsNothing() is behave differently between RDL and RDLC? I was trying to create a report (RDLC) in VS 2008 and using the IsNothing() function to check to NULL value, however, it keeps return #ERROR when I tried to execute this expression:IIF(IsNothing(Fields!dbField.Value),"emtpy",Fields!dbField.Value)However, I tried the same expression with Reporting Services report (RDL), it works and return "empty" string.
View 3 Replies
Dec 18, 2010
I have encountered a weird thing. I did a quick prototype in plain HTML to show a client an idea for a web page. Then I proceeded to implement the page in MVC 2. The border that I'm utilizing (border-style is ridge) is being displayed differently when rendered as a MVC app versus a HTML page in IE 8 (I haven't checked any other version of IE).
<div style="background-color: black; color: white; width: 100%; border-style: ridge; border-width: 5px;">
<table style="padding: 0; margin: 0; width: 100%;">
<div style="color: white; font-family: Arial; font-size: 32pt; font-weight: bold;">
[code]...
View 9 Replies
Feb 10, 2010
For the past few days Ive been searching for a way to highlight the active tab. If I have say 5 tabs, tab1 (when active) would have the background color red, tab2 green (when active), tab 3 blue (when active) etc. Is there a way to do it?
View 4 Replies
Dec 20, 2010
I have the following in my data table and I want to display it differently as in the second example below in a datagrid.
UserID Questions Answers
1 What is your dog's name belle
1 Tell us why you should win. Because I need to win
2 What is your dog's name Leigh
2 Tell us why you should win. I've never won before
I'd like the get the result displayed like this below in a grid view.
UserID Question: What is your dog's name Question: Tell us why you should win.
1 Answer: belle Answer: Because I need to win
2 Answer: Leigh Answer: I've never won before
View 2 Replies
Apr 15, 2010
Using vb.net/asp.net 2005 with a Master page.
I developed a page where the formatting looks great in Internet Explorer 8 but when I open the same page in Mozilla Firefox 3.6.3 it does not center the div horizontally (left to right) but instead has the div and content inside on the left side of the page.
View 4 Replies
Apr 17, 2010
Help me replace this code, both me and Resharper don't like it:
<table width="100%">
<% for (int row = 0; row < 10; ++row) {%>
<%= "<tr" + ((row % 2 == 0) ? " class='even'" : "") + ">" %>
...
</tr>
<%}%>
</table>
View 4 Replies
Apr 30, 2010
I have an ASP.NET (framework 2.0) web app running under IIS7.hen I run the app on the server, using IE8, localhost the app runs the way it is supposed to.When I run the app in Visual Studio 2008 (framework 2.0) it runs the way it is supposed to.But when I try to run the app from another computer it renders incorrectly.Same versions of IE8.What would cause the serving of an ASP.NET application to render correctly on the server, but incorrectly when serving to another computer, when the Internet Explorer versions are the same?
View 1 Replies
Feb 22, 2011
If have the following web.config:
<configuration>
<system.web>
<authentication mode="Forms">
<forms name="MembershipCookie"
loginUrl="Login.aspx"
protection="All"
[code]...
View 1 Replies
Jun 30, 2010
I am new to this MVC and have a basic question related to validation. I have a create view for customer and based on the customer entity partial class metadata, I am validating the user input and its working fine as expected when the user clicks the create button.I also have a search button in the same create view, which is used for auto generation of some of the field values. When the user clicks the search button the action method create (post) is called with the corresponding button value as argument.the issue here is when the user clicks the search button most of the user input fields will be blank and the validation fails because of that.
View 4 Replies
Oct 19, 2010
i have a page where i have some text boxes and some dropdowns at the top and a Gridview(in the other page) in a Iframe at the bottom.the problem is that when i see this page in IE 8 and Mozilla 3 i can see them nicely formatted.but when i see it in IE 8 with compatibility mode on then the boxes are sqaushed and the columns of the gridview are also squashed and the whole page looks bit clunky.
View 4 Replies
Dec 9, 2010
I've got a details view control, default set to Insert which I've added file upload controls. I've used a button to begin the upload process and add the other data to the database. The weird thing is that if I use FireFox to enter the data and upload the files, everything works fine but it works slightly differently in IE8. The difference is that when I browse for a file in FireFox, upload it and store the file name, it returns just the file name e.g. myPic.jpg. However, when I upload with IE8 it stores the entire route to the file e.g. C:/Users/Users/Site/myPic.jpg Why would a browser treat these things differently? And, is there a way to fix it to work on both browsers?
View 2 Replies
Oct 19, 2010
I have a strange problem that I am trying to find a solution to or even only know why does this happen. I built a website using ASP.NET, when I run the website locally it looks very normal (I am speaking Style and CSS wise) on all the browsers (including IE8). And when I deploy this website to the test server which has Windows Server 2003 and IIS 6, the applications looks normal too on all the browsers except IE8. I did not try other versions of IE but I have a requirement to have this website working on IE8. Some tweaking on the CSS solves some of the problems but I do not want to go through each and every tiny detail and rework my whole CSS. There are even some problem which cannot be resolved.I have no clue why is this happening. It should be something either with the OS or the application server because those are the only differences between my machine and the server. On my machine I have Windows 7 Enterprise and I was test the website on the ASP.NET development server.
View 3 Replies