Problem with custom control

Z

zoneal

I am working on an application that displays a grid with dropdownboxs
in various parts of this grid. Now the entire gird is generated
dynamically based on user interaction, so i have put the code required
to generate this grid in an .ascx file. Here is my problem:

My grid is generating perfectly, but I am stuck on this on part: I
currently have the functionality that is the user changes an item in
any of the dropdowns, the form will postback to itself, however, i am
unable to get the selectedIndex.Text or Value.

first let me share with you how i create the drop downboxes:


hwriter.WriteBeginTag("select")hwriter.WriteAttribute("name",
i.ToString)hwriter.WriteAttribute("OnChange", " " &
Page.GetPostBackEventReference(Me,
Me.UniqueID))hwriter.Write(HtmlTextWriter.TagRightChar)hwriter.WriteBeginTag("option")hwriter.WriteAttribute("value",
"ins~" & intUsers(i).ToString & "~" & intLinkId.ToString & "~" &
dt.Rows(x).Item("roleValue"))hwriter.WriteAttribute("selected",
"selected")hwriter.Write(HtmlTextWriter.TagRightChar)hwriter.Write(dt.Rows(x).Item("name"))hwriter.WriteEndTag("option")

The way the above code is laid out, when a postback occurs, my
eventArgs is the value of: 'Me.UniqueID' which does me no good. I have
looked through my VS.Net help files and there are examples on how to do
this with button and raising the click event, I can not duplicate this
for the onChange event??? Any help as to how I can get the values of
the selected item would be greatly appreciated
 
S

S. Justin Gengo

zoneal,

I have some sample code on my website that shows how to add a checkbox to a
datagrid and then find which checkbox was checked via the checkboxes
autopostback. While the code isn't quite what you're trying to do the
process will be very similar.

If you'd like to take a look at the sample code to see if it leads you in
the right directio go to: http://www.aboutfortunate.com?page=codelibrary and
then use the search box there to search for: "datagrid checkbox".

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top