[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 406
  • Last Modified:

asp.net placeholder

Front End
<asp:TextBox >
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
<asp:button Id="clickme">
Code Behind:
Public Void (x)
Run Database
If TextBox value = 1
Select maxPremium, MinPremium From  TableA where Id = x
 Return  <select>
Fill the data

Elseif TextBox value = 2
  Select Top 1 Maxpremium, MinPremium From TableA where id = x
   Return <input textbox></input> Fill the data

End If
Once code behind done, using Placeholder to show the UI.

Overall, how can I code it in asp.net/ c# in one Void

500 pts for completed working codes.
1 Solution
Swadhin RaySenior Technical Engineer Commented:
if textbox =1?xxx : yyy ..here xxx is result if condition and yyy is else condition
Can u explain what u want to achieve in UI. Ur question isn't very clear. 2ndly stop writing the 500 points for....thing
Webboy2008Author Commented:
Once the textbox has value like 1, 2, or 3.
It will go to db to search UIcolumn.
If UIcolumn return 1 then show inputbox
if Ulcolumn return 2 then show dropdown

Inside of inputbox / dropdown value must be filled and value came from db. like MaxPremium, MinPremium
so, you're dynamically creating and populating controls with contents based upon the control type?
sorry, you'll have to convert to C#, and probably call some methods to load up your controls with their queried values
Protected Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        Select Case TextBox1.Text
            Case "1"
                Dim newtextbox As New TextBox
                newtextbox.Text = "here are my values"
            Case "2"
                Dim newdropdown As New DropDownList
                newdropdown.Items.Add("min value")
                newdropdown.Items.Add("inbetween value")
                newdropdown.Items.Add("max value")
            Case Else
                'do nothing at all
        End Select
    End Sub

Open in new window


Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now