While in constructor i am gettine error, Aobj(0).type is not initialized, it says that Object reference not set to an instance of an object. how to initialize my objects?
I have a Button that creates a new product object. Then I add this button product to a list via list.add(product) and than I initialize the DataSource property of the GridView with that list via gridView.DataSource = list.
Here is the example code that will be exuted if the user clicks the add button:
[Code]....
It works. But if I press the button the second time, I overwrite the previous entry from the list / grid. How can I solve this problem? They idear is, to save all created objects in the list to save the whole list later. The grid view is necessary to show the users the added objects. All components are inside an update panel.
Anyone know of a way to read out in a list all of the UpdatePanel Client ID's I have on a page? Basically I need to loop through all controls in the page with a type of UpdatePanel, and display the ClientID for each..
I have four update panels on this page and I am using this
private string LoopUpdatePanel(ControlCollection controlCollection) { StringBuilder sb = new StringBuilder(); foreach (Control control in controlCollection) {
Iam getting an array of list from database to client side(javascript array). Now my aim to place those values in a div one by one and that div should attach to the textbox similar to Autocomplete extender.
I have a webform that gives the user the option to submit 5 referrals. Currently I only have 1 checklistbox that gives the user a choice to select products of interest for all the referrals. I would like to add a checklistbox under each referral input field in case there are different product interest for each referral? So when the referral gets a confirmation email it contains the product of interest that is specific to that referral.
I need to pull a list of supplies from a db table and list them along with two textboxes (one for quantity, and another for manufacturer)
so the list would look something like this.
checkbox for supply 1 | Quantity | Manufacturer checkbox for supply 2 | Quantity | Manufacturer ..
I also need to store all of the checked items in a db table. I'm not sure how i should go about doing this. I've heard some talk about a repeater control being useful but i've not come across any examples that do this type of thing.
I need to initialize an object from the start up of an page and use the objects through out the particular page how can i do it. //Block to be initialized
XTContext.UserContext UContext = new XTContext.UserContext(); XTContext.Context ctxt = new XTContext.Context(); XTErrorCollection.ErrorCollection eContext = new XTErrorCollection.ErrorCollection(); ctxt = (XTContext.Context)Cache["sessionfContext"]; ctxt.eContext = eContext; ctxt.uContext = UContext;
now i want to use the ctxt inside the page and control events. I tried to initialize it in page load but i cant access ctxt.
I have a Webform with a large number of user controls on it, they were auto generated as part of a formview.
I would like a way (Add in etc) to print a list of all of the names of the controls for me to use for the code, rather than having to go through and write them all down.
does anyone know of an add in or an easy way to do this in VS2010..?
I want some drag and drop stuff on my website. I found some javascript that works when using it with a simple html page, but when I tried to put it in my asp site it doesn't.
In site.master (between the head tags):
Code: <script type="text/javascript" src="~/Scripts/Javscriptfile.js"></script> and then: Code: <body onload="redips.drag.init()">
And the error is:
Microsoft JScript runtime error: 'redips' is undefined
I am designing a program that will let me enter the name of an item to swap and adds the swap to an array list when a button Add is pressed. Once the item is added to the array list a Sub Procedure should be called which displays the contents of the array list in a list box.
The system will also allow me to remove items from the array list using a Remove button
followed by updating array list.
I have done some part which puts item into the listbox1 which i named lstSwapList.I would need some assistance on the Sub Procedure to display the Value or Description on the other listbox2 which i have also named lstContent,if a value is selected from the listbox1.
I would also want to know how to update the Listbox content,However i hv added a sample of the way i guess it may be.
Any complete solution from anybody on the Sub Procedure and the Update Swap procedure will be greately appreciated.
The script below is what i have done so far.
Partial Class _Default Inherits System.Web.UI.Page Protected Sub lstContent_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstContent.SelectedIndexChanged End Sub Protected Sub lstSwapList_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstSwapList.SelectedIndexChanged End Sub Protected Sub btnAddSwap_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAddSwap.Click Dim SwapValue As String = "Sixty Pounds" Dim Counter As Integer = 8 Dim SwapN0 As Integer lstSwapList.Items.Add(SwapValue) lstSwapList.Items.Add(Counter) lstSwapList.Items.Add(New ListItem("300", "1")) lstSwapList.Items.Add(New ListItem("ASP.Net", "2")) lstSwapList.Items.Add(New ListItem("Programming", "3")) SwapN0 = lstSwapList.SelectedValue For Counter = 0 To -1 SwapN0 = lstContent.Items.Count Next End Sub Protected Sub btnDeleteSwap_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDeleteSwap.Click lstSwapList.Items.Remove(lstSwapList.SelectedValue) End Sub Protected Sub btnUpdateSwap_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpdateSwap.Click End Sub End Class
======================================= Sub UpdateSwap(ByVal valueA As String, ByVal ValueBAs String, ByVal ValueC As Integer, ByVal ValueD As Date)
Can I call Initialize Culture of every page from the Global.asax?
Every page looks at the query string of "?lang=##" and sets the language accordingly. Since all pages do this, is there a place where I can implement it once and all pages will load it?
My site has around 200 pages and I dont want to implement the code in everypage. Would take too long for maintenance and to implement. It would be more convinient if I could simply put it in a function that all pages call when loading.
When I am tryng to pass the gridview cell values to an array everything is perfect but the array is empty after executing the code. When I see through debug mode the index of selected row also is fine, i.e. when I select two rows using checkbox among 1000 the count shows exactly 2 in the array but the data is empty. I'm not able to get the cell value from the gridview.
public List<Customer> GetCustomers() { PR1Entities dc = new PR1Entities(); var q = (from x in dc.Customers select x).ToList(); return q; } (customer is a entity object)
Then I generate the proxy when I add the service.. and in the reference.cd it say
public wcf1.ServiceReference1.Customer[] GetCustomers() { return base.Channel.GetCustomers(); }
What would be the most efficient way of storing a set of values in a session? I'm guessing it's either a List/Array or Dictionary. Basically, when a user selects an item from a DropDownList, a value (between 1 and N where N <= 20) is sent back to the server. I'd then like this value to be used as an index (if using arrays) or key (if using a dictionary) within the session. I don't want the value to be seen by the user, hence why it's not stored in the DDL. From what I gather, dictionaries are designed for key-lookups. However, since the scale is quite small, are there any overheads of using a dictionary that could make it less efficient in this case? Each corresponding value is unique to the user, so I've decided to use sessions.
I have some code I only want to execute the first time I display a form. With this in mind I created a class variable which I initialize the first time I execute page load.
public partial class CLVideoDefinition : System.Web.UI.Page { string videofile; string first; protected void Page_Load(object sender, EventArgs e) { if (first != "N") {
I then select a value from a drop down list , but when it does the auto postback it executes page load but my class varaible has been reinitialized to null and will then execute the code I only want to execute on the first run. why my class variable has been reinitialized.
i have an string data array which contains data like this
5~kiran 2~ram 1~arun 6~rohan
now a method returns an value like string [] data public string [] names()
{ return data.Toarray() } public class Person { public string Name { get; set; } public int Age { get; set; } ) List<Person> persons = new List<Person>(); string [] names =names();
now i need to copy all the data from an string array to an list<person> and finally bind to grid view
i want to insert checkbox text only if they are checked. .. how to do that ..
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load TextBox1.Text = Request.QueryString("txt") Dim splitted As String() = TextBox1.Text.Split(",") For Each id As String In splitted Dim ctrl As Control = Page.FindControl("checkbox" & id) If Not ctrl Is Nothing Then Dim chkbox As CheckBox = DirectCast(ctrl, CheckBox) chkbox.Enabled = False Dim arrList As New ArrayList() 'populate the list with some temp values arrList.Add(CheckBox1.Text) arrList.Add(CheckBox2.Text) 'databind the list to our repeater Repeater1.DataSource = arrList Repeater1.DataBind() End If Next End Sub
This code will add all checkboxes whether it is checked or not !
so that only checked checkboxes would be added in array list