Category Archives: DropDownList

[RESOLVED] Database value save

<div style="margin-top: 10.08pt; margin-bottom: 0pt; margin-left: 0.38in; text-indent: -0.38in; text-align: left; direction: ltr; unicode-bidi: embed; vertical-align: baseline;">enrolls (sid, coursecodesemester, year)</div><div style="margin-top: 10.08pt; margin-bottom: 0pt; margin-left: 0.38in; text-indent: -0.38in; text-align: left; direction: ltr; unicode-bidi: embed; vertical-align: baseline;">suppose Student enroll 5 or 6 courses(coursecode) of semester 1. how i can save in my table like this
</div>

sid

Course code

Semester

Year

b1

Csc100

1

2010

b1

Csc101

1

2010

b1

Csc102

1

2010

b1

Csc103

1

2010

b1

Csc104

1

2010

1)sid=sessionid

2)Dropdownlist select semester ==>> selected semester courses in a listbox

3)Year select


insert into enroll(sid,Semester,coursecode,year) values (@sid,@semester,@coursecode,@year) .

<div style="margin-top: 10.08pt; margin-bottom: 0pt; margin-left: 0.38in; text-indent: -0.38in; text-align: left; direction: ltr; unicode-bidi: embed; vertical-align: baseline;">
</div><div style="margin-top: 10.08pt; margin-bottom: 0pt; margin-left: 0.38in; text-indent: -0.38in; text-align: left; direction: ltr; unicode-bidi: embed; vertical-align: baseline;">
</div><div style="margin-top: 10.08pt; margin-bottom: 0pt; margin-left: 0.38in; text-indent: -0.38in; text-align: left; direction: ltr; unicode-bidi: embed; vertical-align: baseline;">
</div>

Hi,

This table is not enough.It is Bad Design.see how you will design tabes for it.

This gif is from 

Entity-Relationship (ER) Diagrams



Next You can Create View and Insert in that view otherwise you can use

Insert statement for Multiple tables.


Regards


I have to save Listbox  values in to my table (listbox multiply values i.e 6 vales)

listbox=coursecode


foreach (ListItem listitem in ListBox1.Items)

selected vales save table



Hi,

Ok if you don't bother about database design It is big prob from tomm.Anyways just see how you can write sql query to insert multiple records in table


Tutorial 3 - Adding Multiple Records to a Child Table Using Stored ...

[Solved] How to Insert multiple values from a listbox or ...

DotNet Asp: Inserting multiple values from a listbox into a ...


You can See this thread where someone has already resolved this issue

Insert Multiple Selected Items of a List box into table - ASP.NET ...

Regards

shabir

[RESOLVED] Asp.net html server control

Hello every one! I am very new in this forum. As my first post starts with a question. I want to know: what are the basic differences between html server controls and web server control. As I have gone though lots of surfing but couldn't find the exact answer. Plz focus on some of basic use of html server control. hlp will highly appreciated friends.

Thanks in advance...

if you like this answer mark it as answer


the server control can have viewed by the server load and write in this type of controls, also the server controls can maintain the values when the page is send to the server and returns their values are the same, this is an advantage over the html controls.

The web or html controls can not be viewed by server, we can't write in a html control, (not without a runat server) not maintain their values, if a page is send to server and returns, the value is always null or ""

other diference is, the html controls are limited and the web server controls can morph (example: a datagrid is transformed in a table)

other diference is, the server controls create a variable _viewstate and need more bandwith. this is an advantage for the html controls.

I recomend to use HTML controls, except when you need a dropdownlist or somthing like that

hello

html server controls are there for backward comatibility. they are useful when you want to upgrade an ASP classic website to ASP.NET website so you'll add runat="server" to html controls and then they are part of ASP.NET run-time engine(now they called html server controls). one of the results is that html server controls will get validated while html controls not.

if you're creating a new website you should use ASP.NET controls which have a lot of features like viewstate !

nkabir11

what are the basic differences between html server controls and web server control.

Basically nothing....except lots of properties and events for WebServer Controls...

That's really helpful guys thank!

Can you tell me what is the use of attribute property of html server control?

first of all I have to tell you there is a big difference between HtmlControl  and WebControl when you were not set the runat="server" , and that is the performance of rendering control.Although server control has a wide range of properties and server side functionalities which gives you tomany benefits but unfortuantly they are heavier than HtmlControls because they should pass their life cycle on the server side.in other world if you dont need to use control in the server side (code behind) and you only want to manage page layought or you are using the control in the client scripts then use the html control rather than WebControl

 

and about your second question you can see full information in this link

http://msdn.microsoft.com/en-us/library/system.web.ui.htmlcontrols.htmlcontrol.attributes(v=vs.71).aspx

[RESOLVED] Clear Text in Ajax ComboBox or DropDownList

When the WebPage loads i would like for the Text to be cleared in Ajax ComboBox and/or DropDownList. However Setting the text to nothing or null doesn't seem to work. So I did some searching and found this...

Private Sub SampleLoad()


  For i as integer = 1 to 10
    ComboBox1.Items.Add("Item" & i)
  Next


  'Add a null item to clear the text
  ComboBox1.Items.Insert(0, "")
  ComboBox1.SelectedIndex = 0


End Sub

Is there another way to clear the text other then adding a null item to the list? I don't really want the user to have a selection of "null", this seems like a hack job.

 

Just a thought, does it need to be visible? Can you simply hide it?

comboBox1.SelectValue = ""

In your load event?

or

 How about converting to an Ajax Object in code after page loads.

 

And, if you try like this?

ComboBox1.Items.Add("");


For i = o To i <= 10 Then
ComboBox1.Items.Add("item" + i);
Next


It worked?

Just so I understand, you just want nothing selected by default? If that is the case, for a dropdownlist, you will need a blank row.  I usualy just add one with text of "SELECT NAME" or whatever, then validate later that something has been selected. For a listbox, you can set the selectedindex to -1 (again, you will still need to validate selection later.

hello

i don't think there is any other way except adding a null or some default text like "select here" and later you have to validate it to see if user changed the default value or not.  

hj

hello

i don't think there is any other way except adding a null or some default text like "select here" and later you have to validate it to see if user changed the default value or not.  

 

Thats what I thought. I spent a couple hours googling an answer to this problem and came up with the original post. I just don't want them to be able to select "" from the items list. But I guess it is what it is and just use some validation.

I guess a person could write there own user control to this maybe using TextBox and DropDownExtender and JavaScript. Seems like to much work for something so simple though.

that happens when you try to do something that is not suppose to be done with a certain control.

if you don't want anything to be selected then you should change your design and use ListBox instead of ddl while if you want something to be always selected by default then ddl would be your primary choice.  

set the combobox's selectedIndex to the -1 and it will be select nothing at all 

[RESOLVED] Master page and content page communication in asp.net

<div>

suppose i have one dowpdown in master page and i want that when user select any item from that dropdown then a postback will occur and the selected item text will be dispalyed in the label of content page. please help me with sample code.

thanks

</div>

on the content page load event ...write the following code

Label1.Text = (DropDownList)this.Master.FindControl("ddlSomeid").SelectedValue.ToString();

[RESOLVED] How to access content page controls from master page in asp.net

it is very easy to access master page control from content page like

    protected void Page_Load(object sender, EventArgs e)
    {
        // content page load event
        DropDownList thisDropDown = this.Master.FindControl("someDropDown") as DropDownList;
        userLabel.Text = thisDropDown.SelectedValue;
    }

but how could i access controls of content page from master page. suppose a textbox there in content page and one button is there in master page. i want that when i will click on master page button then i want to show the text of textbox in the content page in the label of master page. how to achieve it. please help me with code sample. thanks.

you need to call FindControl from the contentplaceholder in the masterpage

this.ContentPlaceholder1.FindControl("SomeControlOnContentPage")

keep in mind that since many content pages can use that masterpage, they might not all have the control you are looking for.  so be sure to check the FindControl result for null before you try to do anything else with it.