I have LinkButton and HiddenField in a list view. I want to get the hidden value from HiddenField, so I can store it in Session and when a LinkButton is clicked it transfer the hidden value ( stored in Session) to another page. But I get this error message "Object reference not set to an instance of an object." Here's the function:
Protected Sub lvTimeSheet_ItemCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewCommandEventArgs) Handles lvTimeSheet.ItemCommand
Dim id As HiddenField = TryCast(e.Item.FindControl("hfTimeSheetId"), HiddenField)
Dim myId As String = id.Value.ToString
Session("myId") = myId
Server.Transfer("Destination.aspx")
End Sub
I'm having troubles remembering how to grab the list view's state, or page, so that when you leave the list, you can return to the list view page you left on. I have a data pager, and I have hyplerlinks for items in the list view that take you to a file upload or file delete page, and then returns to the list view. It returns to the list view's initial state (first page).
I am using hidden fields to save some preset data, but upon postback they appear to disappear.
Here's what my controller actions look like:
[Code]....
The view is coded like this:
[Code]....
But when the POST action receives the object back, some of the fields have become null. The FormCollection, however, contains all values. I realize I could just take everything from the formcollection but it's probably better practice to use the object, right?
I have a grid view with several TemplateFields. A couple of them are set to Visible=False; each template field has an EditItemTemplate, an ItemTemplate and a FooterTemplate.
[Code]....
While in GridView_RowUpdating event, the value bounded to the EditItemTemplate is properly read
[Code]....
so, debugging ttbImp.Text = "4"; But when trying to get the value bounded to the FooterTemplate, the label contains no values.
[Code]....
so, while debugging, lblImp.Text = "";
why that? I believe it has to do with the hidden visibility of the field, but I can't understand why it reads the value inEditItemTemplate, and it doesn't in FooterTemplate.
I have a requirement in my application that, while saving the application, need to get all the value from drop down list and pass it to the view model. But application should not allow the user to select more than one item from drop down list manually, ie, only one value at a time. My view model is like ...
public class ListManagement { public IEnumerable<selectListItem> InactiveProduct { get; set; } public string[] InactiveProductSelected { get; set; } public IEnumerable<selectListItem> ActiveProduct { get; set; } }
Now I want to attach to the click-event of every single li-element, so that if the user clicks on a div-element, detailed product-informationen should be loaded asynchronously into a details-pane. I know how I can use jQuery to invoke an action-method ajax-style and also how to display the json-result which contains the product-details, BUT I have no idea, how I could attach the onclick-event to every single div, so that I can use the productId to load the details.
When I am creating Strongly Typed View I get lots of Classes in View Data Drop down. Classes like Automapper, ninject, Interface..., latebound... Due this its very hard to find my project classes. Is there any way to restrict dropdown to only display my project classes?
i have the following problem concerning the index::
my source code::
[Code]...
the problem is appeared when i have added the pager to my list view ,,i have out of range for index exception ... how to determine the page iam in and specify the right index either i use list view or grid view or other such controls..
I have a parent control that has an instance of a HiddenField child control. I am using CreateChildControls() to add it. Everything works client side including the values being added to the field. However, on postback, the reference to the field is null
here is the code
[code]....
I have tried simply relying on the ViewState ... then also attempted using FindControl(). Neither works, it comes up as a null reference ... any input on what is going here?
I'm trying to display a list of images in the View. I have a list of URLs (List<string>) that I'm passing from the Controller using ViewData["imageURLs"], but nowI have no idea how to generate and display them?
I am working in a MVC application. I want to list html control names of one view in another view.I know it is possible to list out server control names as given in the url http://dotnetguts.blogspot.com/2008/11/finding-all-controls-on-page-in-aspnet.htmlo b0But want to know is it possible to list HTML control names also ?
I am trying to create an MVC List View that can be filtered by the value selected from a drop down list.
Selecting a value should repost the page ... Since there is no concept of view state data I am having some issues with this ... I can get the repost to take place but my drop down resets and I am not able to get the value that was selected.
ASSET CONTROLLER:
[Code]....
[Code]....
I have tried many of the posts that refer to setting up drop down lists but can't set them up in the content because this is a List View.
I have a custom user control which contains a asp hiddenfield object. The value of this hidden field is being set using javascript and I have verified that the value is being set properly. When a postback occurs the new value is not being saved and I cannot access it in my code.
I believe the problem is because the user control is not saved in viewstate and therefore the hidden field value is not saved accross postback. How can I make the hidden field save its value? I tried accessing it from the early page cycles and still no luck.
All works brilliantly the first time around, the basket items are bound to Basket objects and everything is great.
However, when I receive an ItemCommand from my repeater, and update the basket contents (Note: No adding or removing is done here, just updates the quantity) then I rebind to see the latest values, and BOOM! Null reference - no Basket object in the user control Page_Load. This is despite tracing through to see that the BindItems() method is called as usual, and the Baskets are there.
Why would a button inside a Repeater not fire the Repeater's ItemCommand event? Is there a way to force it to do so? ViewState is Enabled. zn the code below, btnApprove and btnDelete are the buttons in question:
I have two submit buttons, 1 on a search control with its own ValidationSummary/Group and another in a Datalist Item.When I submit the search button and validation errors occur, I must hit the "add to cart" button on the DataList item that was generated from a previous successful search twice in order for the ItemCommand event to fire.I have different validation groups specified for the two submit buttons.
I have imagebutton inside datalist.....the problem is that onclick event of serverside not get executed for only IE ..but its work fine for mozzila....i m not getting what wrong in this code.aspx code