freelanceprogrammers.org Forum Index » ASP

Validate Dropdownlist inside a datagrid


View user's profile Post To page top
sug_u Posted: Fri Jan 13, 2006 11:06 pm


Joined: 13 Jan 2006

Posts: 1
Validate Dropdownlist inside a datagrid
Hai all,
Can anyone help me how to validate a dynamically
created dropdownlist in a datagrid.I’m populating
the dropdownlist from the datasource. My requirement
is My application Should let the user to select the
items in the dropdownlist only once. If the same items
is Selected again in the dropdownlist, I should alert
the users that item is already selected and Select
different option.
I’m trying to use a compare validator. But I’m
getting the error message can’t find the control.
Or
Is there anyway to remove the selected items from the
dropdownlist. Needing all of
U’r valuable suggestions .
Regards,
Sugsen




___________________________________________________________
NEW Yahoo! Cars - sell your car and browse thousands of new and used cars
online! http://uk.cars.yahoo.com/
Reply with quote
Send private message
View user's profile Post To page top
dmartin@... Posted: Fri Jan 13, 2006 11:31 pm


Joined: 12 Jan 2006

Posts: 5
Validate Dropdownlist inside a datagrid
Well, you have several issues to tackle.

What is your validation design: Client-Side or Server-Side?

Whenever you get the error message, "cannot find control", you need
to explicit issue a FindControl() call in your server-side script.

If you are using Visual Studio with Intellisense, you can view the
methods and properties of the datagrid as you develop the code.

In the datagrid, there are several instances where you will see
a "FindControl" attribute. It is found at the highest level of the
datagrid and also at a child control level.

Basically, the code would look something like this:

` declare object to hold instance of a dropdownlist
Dim myDropDownList as DropDownList

` "ADropDownList" is the ID of the control that you declare in
` the datagrid
MyDropDownList = MyDataGrid.FindControl("ADropDownList")

If NOT IsNothing(MyDropDownList) then
Dim strSomeValue as String

strSomeValue = MyDropDownList.SelectedValue
` write you code to handle whatever you need to do

end if


Dallas

























Quoting sug una <sug_u@...>:

> Hai all,
> Can anyone help me how to validate a dynamically
> created dropdownlist in a datagrid.I’m populating
> the dropdownlist from the datasource. My requirement
> is My application Should let the user to select the
> items in the dropdownlist only once. If the same items
> is Selected again in the dropdownlist, I should alert
> the users that item is already selected and Select
> different option.
> I’m trying to use a compare validator. But I’m
> getting the error message can’t find the control.
> Or
> Is there anyway to remove the selected items from the
> dropdownlist. Needing all of
> U’r valuable suggestions .
> Regards,
> Sugsen
>
>
>
>
> ___________________________________________________________
> NEW Yahoo! Cars - sell your car and browse thousands of new and used cars
> online! http://uk.cars.yahoo.com/
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
Reply with quote
Send private message
View user's profile Post To page top
raviss_03 Posted: Sat Jan 14, 2006 5:39 am


Joined: 14 Jan 2006

Posts: 4
Validate Dropdownlist inside a datagrid
Could someone please provide an example of readonly
datagrid columns in VB.net? I have 3 columns in a
datagrid and I wish to make two of them readonly. I
tried to achieve this creating a tablestyle and
gridcolumnstyles, where for two of these columns I
specified .Readonly=True. However, I find that I can
still edit the columns.

Only if I make the whole datagrid readonly, am I able
to not edit the columns. How do I make this happen for
just one column? A sample would be great.

Thanks

Ravi

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Reply with quote
Send private message
View user's profile Post To page top
charlesmarkc... Posted: Sun Jan 15, 2006 12:06 am


Joined: 07 Jan 2006

Posts: 63
Validate Dropdownlist inside a datagrid
http://www.learnasp.com/freebook/learn/datagridedit.aspx

Unofrtunately in 1.1 and dataGrids the only wayf is specifying every column
as bound and marking the one column as ReadOnly as this example does.

2.0 and GridView insstead of Datgrids, it is much much easier.

On 1/13/06, Ravi Swaminathan <raviss_03@...> wrote:
>
> Could someone please provide an example of readonly
> datagrid columns in VB.net? I have 3 columns in a
> datagrid and I wish to make two of them readonly. I
> tried to achieve this creating a tablestyle and
> gridcolumnstyles, where for two of these columns I
> specified .Readonly=True. However, I find that I can
> still edit the columns.
>
> Only if I make the whole datagrid readonly, am I able
> to not edit the columns. How do I make this happen for
> just one column? A sample would be great.
>


[Non-text portions of this message have been removed]
Reply with quote
Send private message
View user's profile Post To page top
raviss_03 Posted: Sun Jan 15, 2006 8:22 pm


Joined: 14 Jan 2006

Posts: 4
Validate Dropdownlist inside a datagrid
Thanks Charles, that was a very good example. I was
not aware of a GridView in 2.0. Thanks again.

Ravi



--- Charles Carroll <911@...> wrote:

>
http://www.learnasp.com/freebook/learn/datagridedit.aspx
>
> Unofrtunately in 1.1 and dataGrids the only wayf is
> specifying every column
> as bound and marking the one column as ReadOnly as
> this example does.
>
> 2.0 and GridView insstead of Datgrids, it is much
> much easier.
>
> On 1/13/06, Ravi Swaminathan <raviss_03@...>
> wrote:
> >
> > Could someone please provide an example of
> readonly
> > datagrid columns in VB.net? I have 3 columns in a
> > datagrid and I wish to make two of them readonly.
> I
> > tried to achieve this creating a tablestyle and
> > gridcolumnstyles, where for two of these columns I
> > specified .Readonly=True. However, I find that I
> can
> > still edit the columns.
> >
> > Only if I make the whole datagrid readonly, am I
> able
> > to not edit the columns. How do I make this happen
> for
> > just one column? A sample would be great.
> >
>
>
> [Non-text portions of this message have been
> removed]
>
>


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Reply with quote
Send private message
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
China Wholesale - Electronics Products
Character Studio - Tutorials and Help