I have a table with 4 cells and three rows. All rows have a textbox in it. I have a button at the top. I want to add a new row in that table when that button ic clcikded with same formatting as above row. Above row format is like this.
i have a lable a textbox, and two buttons(+ and - button) on my asp.net page.
so when i click on the plus button it should add the the whole collection of controls to the page(i.e. lable, textbox and two buttons). And when i click on minus button it should remove the collection.
This should go on.meaning whenever i click on any plus button the control collection should get added to the page.
I am wondering what will be the best approach to do it.
I have a website built that uses master page templates. In the master page I have a simple menu in a list. This is not dynamic (yet!).
I am trying to put together some code behind to write a simple css class to one of the menu links if the Request.ServerVariables("URL") is equal to the current page URL
I have no code written because everything complains when I try to come up with something. I was thinking of doing it using a switch function but am I over complicating things?Below is the simple menu with the class I am trying to write to the link:
i just came up with the reading, Writing and adding values dynamically in web.Config in asp.net. Have many ideas in mind, but i just wana know what is the best way of adding values in web config dynamically.
I have a custom webpart which i am adding to webpartzone dynamically.., in the custom webpart am loading a usercontrol which has Gridview in it with data. On the page load it is working fine, when i click the paging button of the gridview , then nothing is visible on the page...
I have a web form that insert a City recordinto DB.i need to upload images for each city, beacuse of the relationship between city and image is 1-Many.i want to design a from that user enter city info and below that form be a fileuploadcontrol say fileuploadcontrol1, if user browse the fileuploadcontrol1, another fileuploadcontrol, say fileuploadcontrol1 added to, if user browse fileuploadcontrol1, fileuploadcontrol2 added to from and so on, so user can upload as many as files he want. i want this without postback i mean with AJAX.
I have seen code for adding columns at runtime but here is another scenario for you. I am using a SQLDatasource control for my gridview. And the data returned can have different columns based on the filter meaning one time I may have a column A1, A2, A3 and another time I may have A2, A3, A4. Is there any way I can look at the columns when it is binded at the beginning and add the columns first?
I really need to use the SQLDatasource though because I am connecting to an AS400 and it is using a connection already made in the webconfig and do not know any other way. I do if it was MSSQL server but not this.
I have read in so many articles that all controls get their values from viewstate before load event. Then how my dynamically added controls get their values when i am adding them in OnLoad event ie after LoadPostData event.
I have the following code which adds a label and a gridview to an asp.net page:
GridView grd = CreateGridView(kvp.Key.Text); Label l = new Label(); l.Text = "some text"; l.CssClass = "this has no effect"; placeHolderResults.Controls.Add(l); placeHolderResults.Controls.Add(grd);
Two questions really:As the page will have a multiple and unknow quantity of Label + Grid pairs I'm looping through the above code, is this the best way to add the controls to the page?I cannot style the label? How do you do it? Looking at the HTML which is created, the label turns out to be a SPAN.
I have a simple user control which contains a textbox and a dropdownlist. I need to add this control multiple times to my page then save the details to my db, validating each control. When they re-enter my page I need to load the user control for each record in the db populated with the data they entered. They can then edit the data, delete the row or add new rows.
I'm trying to find the cleanest most efficient way to accomplish this. I realise I would need to re-add the user controls after each postback re-populating the data. Would the best way be to add each row to an arraylist or list of type object, save it to the viewstate and re-add the controls with data on postback, or is there another method which would suit?
I am returning an IList to my model of data about users. I want my end users to be able to select which columns they want to see.
I know I can do this with a huge "if statement" however, I know there must be a better way. I have created an Enum with the column names. I feel if I could take the IListItem.EnumName I would be set. However, I'm not too sure on how to do this.
I am new to ASP.NET And I am have THE hardest time understanding how to work with forms in ASP.NET. Here's what I am doing:
Dynamically add User Controls to a PlaceHolder based on some int value (which currently is passed in a HiddenField).Fire an event if the WebControls inside of the User Control change, then handle that event in the Main Page (i.e. save the input to DB)When the user clicks the "Next/Continue" button, the next controls for the next page are loaded. And I guess maybe I just can't seem to get how things work in ASP.NET, because I am really struggling with the general idea of how ASP.NET flows.
Should I be dynamically loading the controls in Page_Init, or Page_Load? Or should I load the controls when the buttonclick event is fired?Do I have to add the axCtrl.OnDataChange += new EventHandler(HandleAxControlDataChange); line on Page_Load? Or should I put this in When I first load the UserControl, I need to initialize some WebControls within the UserContorl. Is there a way to know if I have loaded new user controls into my placeholder? I can't use Page.IsPostback, because after the first page, every page is a postback from the buttonclick.