What you are doing is simply to count how many times the event handler of the ItemCreated event is called. Basically, this event gets fired when an item (header, item, alternating item, seperator, footer) is created in the control. Meanwhile, the Repeater.Items.Count just gives you the number of the RepeaterItem items in the control, and it does not include the header, footer. This value is equal to size of the datasource which is bound to the repeater control.
Hi to all. I'm having trouble with the following situation:
I have a page where the user inserts some stuff and when he clicks on the submit button a popup window showing that info is launched and the page "A" where he was is redirected to another page, page "B". This page "B" can also be accessed by other means. Can this be done? If so, how?
But what happens is that I get imediatly redirected to the NewPage.aspx. If I'm not wrong, this happens because the current page isn't reloaded after this event is treated. What I am asking is, for the effect I want (both the pop-up and the redirect occurs) what can I do? I have also thought on trying to open the pop-up on the loading of NewPage.aspx, by passing some specific value when I make the redirect (something like Response.Redirect("NewPage.aspx?popup=yes").
for your immediate popup, do like this
Go to page load add
Thanks! I had found that earlier but I had misread it and thought it wad doing something else. However, I'm having a difficult time converting this to VB.Net because of some troubles with the signatures of the event handlers (even with user C# to VB). Have you seen anything like this in VB?
You can create an event handler for the ItemCreated event of the DataGrid, and do a checking on the ItemType of each item, then provide a snippet of code to customize the UI when the item type is the Pager. In the ASP.NET 2.0, you can easily define the template for the pager in the control declaration as you would with the template column.
Alright, here’s what I want to do. I have a GridView with columns say EmployeeID, FirstName, LastName, and Department. Now, I want to add an additional column with the DropDownList. The list has the options of
Delete ( I know how to do this one)
Now, if the user selects “Edit” or “Select”, I want that row to open up in a DetailsView either as read only or in editable mode depending on what the user selected.
I am able to call the select commandname using a linkbutton. However, how do I call it using a dropdownlist? Also, how do I call it directly in editable form in a DetailsView from the dropdownlist?
Thanks for the help. However, I will have to bug you a bit more. Unfortunately, I am unable to figure out on how to get the Employee ID from e. Since the DropDownList is going to be inside the TemplateField in GridView, I can't even see it in my .cs file. Hence, am unable to see what all I can do with e.
Because the SelectedIndexChanged event does not bubble up to the ItemCommand event of the GridView control like the Click event of the LinkButton, so you can create an event handler for the SelectedIndexChanged event of the dropdownlist to get the command name. Depending on what value the user selects, you can open up the DetailsView control either in read-only or editable mode by setting the DefaultMode property to ReadOnly or Edit accordingly. To get the value EmployeeID of the selected row, you might consider the two options below:
+ You can get from the column that the EmployeeID field is bound to.
+ You can save and get this values in the DataKeys collection of the GridView control by specifying the DataKeyNames property.
To access the currently selected row from the event handler of SelectedIndexChanged event, you simply get the naming container of the dropdownlist since it is placed in the template field. The sample looks like this:
protectedvoid DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
DropDownList DropDownList1 = sender as DropDownList;
GridViewRow GridViewRow1 = DropDownList1.NamingContainer as GridViewRow;
Option 1, use buttons or links. You just can add a Select column or just use the smart tag and check the Enable Selection checkbox and the IDE will add the column for you.
Then, your detailsview will have to take the value of EmployeeId from the GridView, to do that you have to add EmployeeId to the DataKeyNames collection of the gridview (so the selected value will be the employeeid).
Now, this IS tricky, because depending on the datasource your are using, the DetailsView will try to get the data, so you either will have to select one row in the GridView when you load the page or set the default value of the SelectParameter in the DetailsView's DataSource so it will return nothing if nothing is selected.
(hope I've been clear)
Then your details view could handle the other operations.
If you must use a dropdown, then you will have to do everything in code, that is detect which selection was made and then get the data for the DetailsView and explicitly bind it.
You will have to do two additionals things. First, you will have the AutoPostBack property of the dropdown to true.
Second, if the user selects "Edit", you will have to add this code
otherwise you will force the user to take another step to enter edit mode.
hope it helps, it takes a little bit to get used to the new controls but once you do they are great.
I am the maintainer on two web applications for work flow management, the first (we'll call it A) has a SQL Server 2000 database, where word documents are uploaded and downloaded from fileblobs in the database. When you click on a download link to get one of teh word documents it opens a dialog box to pick where to save it. Code looks like this:
if(fileData == null)
Response.Write("<script>alert('File is not available yet for download!');</script>");
Response.AppendHeader("Content-Disposition", "attachment; filename=" + existingAssignment.FileName);
Response.ContentType = "application/msword";
existingAssignment is a class and FileBlob is a byte;
Now the second site (call it B) uses Access for its database (ick) with the files saved in the filesystem and just the file's name stored in the database, when a user clicks the download link it opens the file in the browser window (with the Word plugin I presume). It was just a label with the html link mashed together programaticaly:
I created a Web Service and generated the proxy class, however once I use the Web Service method I get this error:
CS0260: Missing partial modifier on declaration of type 'TACCGlobalWebMethods'; another partial declaration of this type exists.
"TACCGlobalWebMethods" being the name of my class. According to MSDN this error is because another file contains the same name for a class. Of course it does! The Wsdl utility tool generated a proxy class that was a partial class with the same class name!! I tried making them both partial classes, and then I'm told that partial classes cannot have different base classes. One inherits from System.Web.Services.WebService and the other from System.Web.Services.Protocols.SoapHttpClientProtocol. Does anyone know what's going on with this?
Yeah that sounds right...partial classes cannot have different base classes. This is because two partial classes are really just a single class...it's just that the class can exist in more than one file.
"Half this game is ninety percent mental."
- Yogi Berra
What is your client application that consumes the web service? How do you generate the proxy class and add reference to the web service or the proxy to the client application? Are you trying using the Add Web References function in the VS?
I want restrict a perticular domain user to my aspx page. my requirement is to check the perticular domain, domain username and if user not belongs to perticular domain page will be displayed & accessible.
If user not belongs to domain page will not be displayed and reports error message.
my code will be exist in page load event, here it will checks all the operations.
Hi there, I am quite new to ASP.NET, and I am stuck in a few things, and I am not quite sure what is wrong, so please forgive me if the questions sound stupid:
I am working on a project, which I will be creating a e-Commerce website, I am using a datagrid to display the contents of the catalog, and the user is able to click on the individual items in the datagrid for a detailed product page. I have decided to use Template Column in the datagrid, and will use session to store the product ID and pass it on to the details page to load further details.
However, when I load the page IE gives me an error: Object reference not set to an instance of an object.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object, the error is for the line of: lblTitle.Text = (string)nbinfo.Tables["notebook"].Rows["title"];
Assuming the database connections and field names are correct, what could be the culprit???
THANKS FOR ANY ADVICE, I REALLY NEED THEM, THANKS!!!
Thanks for the reply, I have managed to fix the database problem, it seems that I have left out the table name in the line objDataAdapter.Fill(nbinfo, "notebook").
However, I have strange problems with the session issue.
If my code is the following: <a href="viewnotebook.aspx"> <%# Session["nbid"]=DataBinder.Eval(Container.DataItem,"nbid").ToString() %> <asp:Label id="titlelabel" runat="server" Width="100%" Text='<%# DataBinder.Eval(Container.DataItem,"title") %>' Font-Bold="true"> </asp:Label></a> <br> <asp:Label id="briefdesc" runat="server" Width="100%" Text='<%# DataBinder.Eval(Container.DataItem,"shortdesc") %>' Font-Size="8"> </asp:Label> </ItemTemplate>
Notice where the session statement is placed, if I placed it above, the field NBID will be stored in the session, but it will also be displayed on the datagrid. (I do not wish to display the field NBID)
If the code is the following: <a href="viewnotebook.aspx"> <asp:Label id="titlelabel" runat="server" Width="100%" Text='<%# DataBinder.Eval(Container.DataItem,"title") %>' Font-Bold="true"> </asp:Label></a> <br> <asp:Label id="briefdesc" runat="server" Width="100%" Text='<%# DataBinder.Eval(Container.DataItem,"shortdesc") %>' Font-Size="8"> </asp:Label> <%# Session["nbid"]=DataBinder.Eval(Container.DataItem,"nbid").ToString() %> </ItemTemplate>
Well, the field NBID will NOT be displayed but nothing is written to the session variable either, any clue what should I do.
Apart from that, it seems there is a MAJOR logic problem. Let's say I have 5 items A, B, C, D, and E in the datagrid. It seems the data stored in session is always the last item displayed on the datagrid, so that means if I am looking at A, B, C, D, and E on the datagrid and I click on A, it will display the contents of E. If I filtered the results, and the items displayed are A, B, C and I clicked on A, it will bring up the details of C. It's always the last item on the datagrid because that's the last variable written into session. What should I do?
Thanks for any advice, you guys are really a great help!!!
I like to know two thing
1st i have created page in asp.net with C# where the user selects the data from the backend using listbox,radiobuttonlist and clicks get button to retrieve the data in the datagrid in the same page now i want the same action to taken place ie when the user selects the data clikcs get button it should go to the next page shows the data in the datagrid . How I can achieve this any idea or good websites for this
2nd in my page i want to have three data using joins from two tables in the radiobuttonlist only one column is used for selecting purpose and rest of the columns gets displayed as it is called like id,name,age along with id name and age is also called and when id is selected the rest two gets selected How i can achieve this any opinion
1.i ve a datagrid with 2 template column and a boound column.The template column contain two textbox as txtdebit and txtcredit and bound column is "type"
if "type" is "C" then display value only to txtcredit else display value only to txtdebit. which event i can use?itemdatabound?
it does not working in itemdatabound event
2. is it possible to display a datagrid inside a dropdown list
What do you mean by "it's not working"? In this case, you either use the data binding expression right in the web page or create event handler for the ItemDataBound to do a checking on the type value from the bound column.
is it possible to display a datagrid inside a dropdown list
I need to use an ActiveX control in my application.
I have tried the following ways..
1)I have registered the ActiveX control successfully
When I tried to specify the name of the dll in new object it is showing the error of 'Cannot create ActiveX object'
2)I have added the Activex dll in my application as reference and tried to run ..
But in both case I couldnot get success...
I appreciate if any body can explain me the detailed steps of how I can use/run an ActiveX control in my application.
Please show me the right way.
Thanks very much.
Can I display pop-up messages to my clients in a LAN environment on their Windows start up with ASP.NET ? Can I send e-mail automatically to my clients at a certain time (i.e. one of my client's birthday), without having my or my client's access to my web application ?
Last Visit: 31-Dec-99 18:00 Last Update: 23-Jul-16 18:11