I need to dynamically creates form with textboxes, dropdown list, required validators from database.Anyone has any idea on the best approach to do this? Can you please show me link to example, tutorial?
How can i check a parameter value and add onto or remove conditions from my where statement.Here is what i mean.. i have a stored procedure that is being used for returning small set of fields based on a parameter that it is expecting. Since the only difference between the select statements are the last AND condition, i was wondering if i can check that parameter as im doing now but change that AND condition so that i have only 1 select statement instead of 3 within my procedure.Current Example:
I just read this: http://www.albahari.com/nutshell/predicatebuilder.aspx
I have a couple questions,
1. is that predicateBuilder the only way to do this?
2. will the following code produce 'AND' or 'OR' connecting these? foreach (string sParam in sParams) { query = query.where(item => item.Whatever == sParam); } assume query is an IQueryable<t>. This stucture also dynamically builds the where predicate right?
I have a pretty simple C # page that when the page first loads, a bio is diplayed in that center section based upon sql executed from my code behind. I have 4 link buttons on the page that when clicked, fill that center section with other content based upon which link button they clicked (News, Publications, Contact Info, and Presentations). I was all done, then I thought about using an UpdatePanel to get rid of the annoying "flicker" when the page posts back on the click of the link button.
I have a custom DDL that lives in my Server control library. Currently I add this control to a table by strongly typing the name of the control, the customary way.
Control_Library.Report_NumberDDL newDDL = new Control_Library.Report_NumberDDL();
What I want to be able to do is dynamically create that control by pulling the control name from a table. So I would have the name of the control in my code, in this case "Report_NumberDDL", and I would like to then create the control without having to strongly type it.
Something like this, though I know this doesn't work:
string controlName = "Report_NumberDDL";
Control_Library."controlName" controlNum1 = new Control_Library."controlName"();
Edit:I tried to do this:
Type type = Type.GetType("Control_Library.Report_NumberDDL"); object control = Activator.CreateInstance(type);
But on the CreateInstance(type) I get a null value exception. So the Type isn't getting created correctly.
I have problems building a GridView programmatically. My code is:
[Code]....
This displays the GridView with the following problems:
1. The Html constructed in the Subject column displays on the page as raw Html. The source code shows the Html characters in their ASCII form. The function HTMLEncodeSpecialCharacters is obviously incorrect.
2. The PagerSettings display the page numbers only (1 2 3 4) and not the First and Last text (want to display << 1 2 3 4 >>) despite setting PagerSettings.Mode = PagerButtons.NumericFirstLast.
3. Clicking the page numbers is always one page behind. For example, when the page is opened, page 1 displays. If I click 2, page 1 still displays. Then click 3, page 2 now displays. Click page 4, 3 displays. Click 2, 4 displays etc etc.
4. The column headings are aligned in the centre despite setting HeaderStyle.HorizontalAlign = HorizontalAlign.Left.
I have gridview that I am filling with records from SQL database. However, I want to populate the gridview with records that match text search criteria. In other words, I want to be able to key in a word like "network" in a text box, pick up the text, read records and pick up on the records that match that criteria. I am doing fine with building the gridview but I am a bit new to this and I don't know what I do to do text search.
I'm creating an quiz application which queries the database and extracts the questions and choices. I use dynamically created controls such as a checkbox list and fill the values dynamically. How do I do this? Right now I have these functions:
array_random_init(); this creates a 10 element integer array from 1-20 - extract_question(i): this extracts a question indexed at i in DB, I created the controls and set the appropriate text in this function. - validate_question(i); this is called by button_click and validates the question i according to DB.
I understand I have to recreate the controls in Page_init on postback, but what should it look like? Do I need to add "if IsPostBack" in page_init, or do I create the controls in page_init() and reset their properties in page_load when I use extract_question(i)? Also, I cannot seem to clear the selected boxes on postback, I added page directive "enableviewstate=false" but it doesn't work.
I want to building a website. I don't know step build a new website. I don't know use DataSet or create new class store connection string connection to DB ?
I render HTML returned from an ajax call and currently uses simple html controls and the string that is returned from the ajax call looks like this:
string s = "<tr><td><a href="#">MyLink</a></td></tr>";
Now, on the click on these links I need to do some processing on the server side to determine where I need to navigate to and for other information. My understanding is that I cannot use <asp:linkbutton /> in this html string I am building. How do I make a server side call if i don't want to use ajax.
Is there a better, cleaner way to do this in ASP.NET 2.0?
An ASP.NET 2.0 page displays a datalist of records. Each record can have many dates, so the dates are in a nested gridview (I chose a gridview over a datalist here because we want to be able to delete a date and this is easier done in a gridview). The parent record can never be deleted.
The display works fine: the nested gridview gets its datasource during the parent datalist's OnItemDataBound event.
The problem: the nested gridview's delete function. The date gets deleted without a problem (handled in the OnRowDeleting event), but somehow the redisplay is untying all the other nested gridviews from their datasources. The delete does not appear to cause a page postback, so I don't know how the other nested gridviews are losing their datasources.
Lets say I have a Web Application with a menu of products. When a user clicks a menu item, then create and display a dynamic set of controls in an Update Panel. I am currently doing this however the PostBack and recreation of controls is tedious and resource intensive.
Not sure about this but is it possible to build a webpage with controls on it, then display it in update panel or IFrame? Then on post back you wouldn't have to recreate everything all over again?
I wrote a composite web control that is used in several web applications. If I use sessions variables, for example HttpContext.Current.Session("MyProgramMemberId"), do I run the risk that the host site might have also defined that same session key name?
I have a CheckBoxList that I need to get the values from, concatenate, and pass into a stored procedure in SQL Server 2005 utilizing Visual Basic. Due to the way our data layer is I cannot use a SqlCommand object at this level.
I have no problem getting to the selected values in the CheckBoxList:
Dim selectedValue As New StringBuilder For i = 0 To cblMethods.Items.Count -1 If cblMethods.Items(i).Selected Then selectedValue.Append(cblMethods.Items(i).Text) End If Next
The problem is that I do not know how to list the values in such a way that my stored procedure will pull data:
SET @MethodNames ='GetWords','GetLetters' SELECT * FROM TABLE WHERE method IN ( @MethodNames ) I've tried experimenting with apostraphes but cannot make it work: selectedValue.Append("'''" + cblMethods.Items(i).Text + "''', "
My intention is to give the user a flexible user control on a master page that does the following:
When navigating, a child page will pass the URL (with querystring) and PageTitle to the user control. The user control will take those two parameters and insert them as a "breadcrumb" object at first index of a List<breadcrumb> collection
This part works fine through the use of a Repeater with a LinkButton contained in an ItemTemplate. The user sees each of the pages he has been visiting in descending order, the provided benefit is a quick way to re-open records they have recently modified or created.
The part I'm having trouble handling is what happens when the user clicks the LinkButton, which is that the child page adds a new reference to the URL at the beginning of the List<> collection and I cannot seem to control the behavior of removing the LinkButton before it gets re-created. What I've tried doing is:
While that should work, my CreateBreadCrumb(string url, string title) function gets called by the child page before the UserControl detects the Repeater1_ItemCommand event, so in effect it appears that the wrong ItemIndex is being used for removal.
I'm having trouble with a WAP (web application project). It builds fine within studio (and it uses a number of other assemblies which build before the web application). However, I've always used aspnet_compiler to publish web sites in the past which is then deployed to the server. So I'm building the WAP solution (including assemblies) then publishing just the website folder and not the assemblies within the solution.1) Do I need to run aspnet_compiler.exe after building the WAP. I guess the WAP build causes the bins to be created correctly but the ASPX pages are still uncompiled?
I need to make an asset map for the company. Some squares that contain text should pop-up whenever the user hovers on the predefined points in the map/image itself. upon clicking on the square that pops up, the user should be linked to another page.
I found this on the web, http://www.obout.com/em/ex_imagemap.aspx#top, are there any other ajax or built in controls within asp.net which can do a similar things?
i'm building a form managment system, thats is, the system will contain many forms, will save them, and perform logic on them, I want to do it using the DDD approach.
I want to support easy form layout later on using ASP.NET MVC, so far i see the domain like this:
I'll have a base form entity, which should(for now) have a name, fields(and theire values) and validation logic.
My questions are:
How should i write the field valueobject using generics? i cant seem to figure it out.. Should i encapsulate the validation logic inside the form or do it using the specification pattern?
I am creating a survey page that has a list of questions and answers that can be radiobuttonlists, checkboxlists or textboxes. These controls are added dynamically to a Repeater in its ItemDataBound event using Controls.Add.
I've managed to render the page ok but when I submit the form and iterate over the controls in the repeater to get the selectedvalues of the radiobuttons and textbox values, FindControl returns null. What do I need to do to get get the selected values? I've tried iterating over the RepeaterItems but that returned null too. I've tried different types of FindControl but it never resolves the control types.
It works if I add a declarative DataBinder in the Repeater like this
However, I want want to dynamically add the controls but in doing this i cant get the selectedvalues when submitting. This is tha main structure of my code...
I am storing one file per user on the server file system.
The path for each user is different and looks like this:
"~/resumes/<userName>/<userName>.xxx"
I ma able to get the path correct up to the filename, meaning I can get this to work: "~/resumes/username/" however I am missing the filename.
I am building the path to the users folder without a problem, however the file can be one of 3 types: doc, docx or pdf I need to know how finish my path for my filename. I have no way to know what files as been uploaded, it can be one of the afore mention 3 file types. How do I get the full fuilename to finish my path?
I know this is kind of simple in my head but the logic has been driving me nuts going through it. I'm trying to build a string from 2 list boxes. Once they select an item in the first list box (that's pulling the list items dynamically from a database), then the second list box appears. Once they select the second list box the video player below it displays a flash video that they chose based on which camera and the date/time of that particular camera. The path for the flash video (.flv) is in the database. I get everything to work up to displaying the flv player but it doesn't play the video since the path to the flv isn't there. Here is the code I currently have along with the queries.
My goal is to move as much code from the code behind page to the business logic layer. I'm having trouble with an event handler because the code can't see the method it will call (because the method is on the code behind page and the code in question is in a class in the BLL). CS0103: The name 'ButtonClick' does not exist in the current context (the error) b.Click += new EventHandler(ButtonClick); (the line)
Right now I'm considering to try it by adding the EventHandler from the code behind page after the PlaceHolder has been sent to the code behind page, but I'm wondering if I'm missing a better way. Is there a best practice for how to deal with this? Do I throw in the towel and just let the PlaceHolder be built on the code behind page (where it works fine)?