Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Problem with Drop Down List

Reply
Thread Tools

Problem with Drop Down List

 
 
fazee.ent@gmail.com
Guest
Posts: n/a
 
      09-23-2006
i am using a drop down list and have sucessfuly populated it proble is
this i have set
DataValueField = "cat_id" but value for dropdownlist appears a string
"cat_id" instead of numer value of cat_id

plz help me

Faisal Iqbal Ch

 
Reply With Quote
 
 
 
 
David Lozzi
Guest
Posts: n/a
 
      09-24-2006
Can you paste the actual code on here?

Thanks

David


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
>i am using a drop down list and have sucessfuly populated it proble is
> this i have set
> DataValueField = "cat_id" but value for dropdownlist appears a string
> "cat_id" instead of numer value of cat_id
>
> plz help me
>
> Faisal Iqbal Ch
>



 
Reply With Quote
 
 
 
 
fazee.ent@gmail.com
Guest
Posts: n/a
 
      09-24-2006
*****************
Data binding Code
*******************
Const strSQL2 as String ="SELECT * FROM book_cat"
Dim objCmd2 as New SqlCommand(strSQL2, objConn)

objConn.Open() 'Open the connection

cmbcat.DataSource =
objCmd2.ExecuteReader(CommandBehavior. CloseConnection)
cmbcat.DataBind()


****************
Insertion Code
****************

sql="INSERT INTO book_cat_sub
(cat_name,cat_keywords,cat_head)VALUES('" & txtname.Text & "','" &
txtkeywords.Text & "',"& cmbcat.DataValueField & ")"

dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()

dbread.Close()
dbconn.Close()



****************
Drop Down Lis code
****************

<aspropDownList id="cmbcat" runat="server" DataTextField="cat_name"
DataValueField="cat_id" ></aspropDownList>




David Lozzi wrote:
> Can you paste the actual code on here?
>
> Thanks
>
> David
>
>
> <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) oups.com...
> >i am using a drop down list and have sucessfuly populated it proble is
> > this i have set
> > DataValueField = "cat_id" but value for dropdownlist appears a string
> > "cat_id" instead of numer value of cat_id
> >
> > plz help me
> >
> > Faisal Iqbal Ch
> >


 
Reply With Quote
 
fazee.ent@gmail.com
Guest
Posts: n/a
 
      09-24-2006
*****************
Data binding Code
*******************
Const strSQL2 as String ="SELECT * FROM book_cat"
Dim objCmd2 as New SqlCommand(strSQL2, objConn)

objConn.Open() 'Open the connection

cmbcat.DataSource =
objCmd2.ExecuteReader(CommandBehavior. CloseConnection)
cmbcat.DataBind()


****************
Insertion Code
****************

sql="INSERT INTO book_cat_sub
(cat_name,cat_keywords,cat_head)VALUES('" & txtname.Text & "','" &
txtkeywords.Text & "',"& cmbcat.DataValueField & ")"

dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()

dbread.Close()
dbconn.Close()



****************
Drop Down Lis code
****************

<aspropDownList id="cmbcat" runat="server" DataTextField="cat_name"
DataValueField="cat_id" ></aspropDownList>




David Lozzi wrote:
> Can you paste the actual code on here?
>
> Thanks
>
> David
>
>
> <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) oups.com...
> >i am using a drop down list and have sucessfuly populated it proble is
> > this i have set
> > DataValueField = "cat_id" but value for dropdownlist appears a string
> > "cat_id" instead of numer value of cat_id
> >
> > plz help me
> >
> > Faisal Iqbal Ch
> >


 
Reply With Quote
 
David Lozzi
Guest
Posts: n/a
 
      09-25-2006
Can you look at the page source of the returned page and see if the value of
the list items in then drop down box is also cat_id?


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ps.com...
> *****************
> Data binding Code
> *******************
> Const strSQL2 as String ="SELECT * FROM book_cat"
> Dim objCmd2 as New SqlCommand(strSQL2, objConn)
>
> objConn.Open() 'Open the connection
>
> cmbcat.DataSource =
> objCmd2.ExecuteReader(CommandBehavior. CloseConnection)
> cmbcat.DataBind()
>
>
> ****************
> Insertion Code
> ****************
>
> sql="INSERT INTO book_cat_sub
> (cat_name,cat_keywords,cat_head)VALUES('" & txtname.Text & "','" &
> txtkeywords.Text & "',"& cmbcat.DataValueField & ")"
>
> dbcomm=New OleDbCommand(sql,dbconn)
> dbread=dbcomm.ExecuteReader()
>
> dbread.Close()
> dbconn.Close()
>
>
>
> ****************
> Drop Down Lis code
> ****************
>
> <aspropDownList id="cmbcat" runat="server" DataTextField="cat_name"
> DataValueField="cat_id" ></aspropDownList>
>
>
>
>
> David Lozzi wrote:
>> Can you paste the actual code on here?
>>
>> Thanks
>>
>> David
>>
>>
>> <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed) oups.com...
>> >i am using a drop down list and have sucessfuly populated it proble is
>> > this i have set
>> > DataValueField = "cat_id" but value for dropdownlist appears a string
>> > "cat_id" instead of numer value of cat_id
>> >
>> > plz help me
>> >
>> > Faisal Iqbal Ch
>> >

>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Affecting a dynamically created drop down from another dynamically created drop down. msimmons ASP .Net 0 07-16-2009 03:17 PM
retrive preselected value in second drop down list from the first drop down list weiwei ASP .Net 0 01-05-2007 07:29 PM
Multiple select drop down poplulating sub drop down scott@dettcom.com Javascript 3 11-09-2006 07:50 PM
Auto Drop down a Drop Down List xxbmichae1@supergambler.com Javascript 5 11-23-2005 01:35 AM
New to .NET, can I have one drop down box control the data of another drop down box using a database? SirPoonga ASP .Net 2 01-07-2005 10:44 PM



Advertisments