C# - Creating UI Controls In Mvc?
Jan 23, 2010i am new to mvc and i am presently facing problem to create my own textbox, button etc and use it to store my data to database.
View 2 Repliesi am new to mvc and i am presently facing problem to create my own textbox, button etc and use it to store my data to database.
View 2 Repliesi created a chart in Excel, but now I am having the time of my life to create the same chart in a control.
If you can see on the bottom I have converted the labels to percentages.
In excel I am using a series of data cells to create the bottom labels (0-8 with a .5 increment).
The Y-axis is done with a fixed maximum value of 2 and the labels are percentages as well. How do I get those same axes on the chart control?
I have a need to create controls such as textbox, dropdown, etc in code (c#). The number and data for them is all contained in a database.
What is the best way for me to create and add these to the page (need to be underneath the next one as in a table layout) and then how do I refer back to these in code on postback?
I have been searching a lot about how to create custom server control also creating controls like some third party controlsbut i cant find any resource regarding that, most of the links explained only basic things with custom label,hypher link like that but i wish to learn bit advanced including fundamental concepts.so can any one show me the link/ebook about concepts behind building a re-usable control (properties and property grid integration in VS/VWD, event handlers, rendering, design-time UI, default tag-prefix and naming, toolbox icon, etc)
View 2 RepliesI'm having some issues trying to create and setup a database to use for a project. I have SQLExpress running in the background, but I figure that's from my old Visual Web Developer 2008 Express. I have MS SQL Server 2008, but it doesn't look like it's installed. I'm guessing I need to manually install it before trying to add databases/tables.
View 1 Repliesis it possible to render the same controls with different ID property ?
<%for (int i = 0; i < 15; i++)
{%>
<asp:Label ID='Label<%=i.ToString() %>' runat="server"/>
<%}%>
here is an error: 'Label<%=i.ToString() %>' is not a valid identifier.
I've got this web control that I've been dynamically adding controls to but now the requirement is to add an ordered list around the controls.
To render the controls I add the controls to ControlsCollection
[code]...
How do I position the controls in the list items?
Do I need to approach the problem differently?
Can I dynamically create controls in Silverlight without a postback to the server (even an asynchronous one). Does silverlight drag-n-drop requires postback?
I'm asking this because I've an asp.net application where I dynamically create/delete lots of controls. So after the postback I'm getting error with view state stating that the control tree doesn't match the view state tree.
Can I avoid such problems in Silverlight?
I have an xml feed that contains a list of form fields that I need to create and then submit to the server once a user has filled it out. Below is a snippet of the xml I am working with. how I should go about creating these controls and retrieving their values on postback?
[Code]....
I have a GridView with a column of checkboxes. I also have a panel pnlSubmitOffer which serves as a modal dialog with ajaxToolkit:ModalPopupExtender:
[Code]....
I need a set of controls (text boxes and datetimepickers) to appear on the modal dialog based on how many checkboxes in the GridView are checked, i.e. a set for each checked record. Thus the controls should be added to the panel dynamically. But I don't know how to do it, as btnSubmitOffer click is not handled, because the modal dialog appears first. I was told that the controls can be added dynamically using javascript, but my knowledge of it is not enough.
I've created a website in Visual Studio 2008 with a database and want to create a series search options that someone could use to search for specific things in the database. I've so far got one search parameter sucessfully working but I'm failing to figure out how to have multiple search options. How it works at the moment is there is a gridview linked to a SqlDataSource which is set up to work with a list box. The list box is linked to one column in the table. Each time someone picks a option from the list box it refreshes the page and returns the items with the the option selected in the gridview.
I hope the above makes sense. Now what I want to do is add further list boxes and text boxes offering a series of search options linked to a search button that then refreshes the page and returns the results to the GridView. How would I go about doing this? I'm relatively new to Visual Studio and still learning.
I have a requirement in which i want to create an aspx form in which I want to define the name of the controls in the xml file and on the basis of the xml file i want to create the aspx form. if in the xml form there are 10 controls then dynamically 10 controls will be created i have following type of xml
[Code]....
I am creating and configuring multiple TreeView controls programmatically:
foreach (DataRow dr in ds.Tables[0].Rows) {
TreeView TV = new TreeView();
TreeNode newNode = new TreeNode();
[code]...
I have a dropdown list on my homepage which users select a category. After selecting the category, user will fill a form which has related controls to that category in it.
As I have many categories, I just want to have single ascx page and adding controls to it dynamically according to the user choice.
For example: One chose Telephone category, he will face a form having drop down lists asking, what brand? what color? And one chose, book category, he will face drop down lists asking which type? howmany pages?
So 1 ascx must do my work at runtime done as I have alot of categories.
I am going to take these criterias from a database table which has CategoryID and Criteria colomns.
And if I can do that, will it be possible to add field validators to these dynamically created controls.
Never really worked with the asp tables but for this project it makes more sense, I am having trouble addding rows dynamically from the sql datatable i am pulling. In hte datatable it has 12 rows with 14 columns, I need to make this into a table, with a dtagrid I would be done but I have to pull other data that they could add columns, so a table I am told is easier.
This gets my data and I can see it
mydataTable = new DataTable
mydataTable = GetData(sql)
mydataTable.add.row(myDataTable.rows(0)(0))
I get nothing but errors trying to do this, what is the correct way to add rows to an asp.net table
Can I add this all to a datagrid and then add the extra columns I need if they are there with out using a table.
i already followed steps in msdn and created a new
using Right Click on Security and New Login
I am trying to Create a Sql Sever Authentication User
which i selected and filled both password and confirm password and then OK
now when i am trying to Login this User its giving me this error
New User-mojo
password-mojo1
[IMG]http://i50.tinypic.com/33lo9lk.jpg[/IMG]
While Login Giving Error
[IMG]http://i49.tinypic.com/68zk3o.jpg[/IMG]
It seems when I try to dynamically create multiple instances of a User Control, I get an Object Reference Not Set To An Instance Of An Object error on any ASP control that I'm using in that User Control
Here's the class where I'm creating them.
[Code]....
Am I able to successfully refer to a panel on the page that I'm calling this routine from simply by ByVal ... As Panel, or should I use HttpContext?
I have a dataset with 3 tables that are inner joined. Thsi dataset is connected to an object datasource which is connected to a gridview. So at runtime it displays data from the database. The problem is when I click on a save button to add information to the database it throughs me an error saying Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints. But if i have two tables in my dataset it works 100%. But the problem i need that 3 tables in order to pull the required information. And if i populate the gridview using code to select the information from the database and insert information it also works 100%.
View 3 RepliesI want to create a map control which will be a server side control.I want to have it as a tool in the toolbox. The above control will contain providers that will fetch maps from the following sources:
1) WMS
2) Oracle Spatial DB
3) Google
4) MS Virtual earth.
How to create the providers for the different map sources? Then I hav to create different screens which will take the parameters and send them to the map preoviders. The map providers will send the generated map to a map control (could be a active X control) or something else. The map control should also be capable of performing standard functions like pan,zoom etc. Pls give some idea as well as source code on how to start with it.
I am creating a dynamic <asp:Table> based on a user's selection from a DropDownList. The number of columns and rows in the table depends on the user's choice from the DropDown.
The final two columns in each row needs to contain an Edit and Delete button. I am able to create these buttons programmatically. However, I am unable to get the click event to fire.
After researching this, it appears to be the case that my dynamic Web controls need to be created in the page Init method.
However, I am unable to do this as I do not know how many table rows, columns and buttons to create, until after the user has made a selection from a DropdownList.
I would be be very grateful for some tips on the correct way to create and enable the events for my dynamic buttons, in this scenario.
Here is a brief outline of how the program currently works (this is just a brief outline I quickly sketched, small details may be wrong!):
[Code]....
[Code]....
can i declare and define a datacolumn alltogether at runtime?? I need to add a column(this column is supposed to be displayed at last in gridview) containing a control(which control should i use? :P) which i would use for redirecting to a different page and it will display data related to that particular column in a gridview.
For eg: last column in gridview1 on page 1 will have text "details" after clicking it an event will be fired which will fetch details of that particular row from database. My major problem is to ctreate this last column with some event firing thing in it :-)
I've got a master page and a content page. How can I add controls to the master page's content placeholders programattically?
View 2 RepliesI have a Datatable which is binded to a Datagrid of the following format
[Code]....
I would like to have images in place of values.That is if 1 is present i would like to have 1.jpg, if 2 is present 2.jpg and so on.
Is there any possibility of doing this in OnItemDataBound event checking each item values.
I want to create DateGrid dynamically pepending on the data comming from database.
View 4 RepliesI have a some complex requirements, which doesn't seem to be meet by any of standard asp.net grids.
So I am planning to create my own grid control from scratch(generating own html). Any pointers on how/from where to start?