Hello,
Here's the situation (I'll try to be brief as possible)
I am working on the control which is created dynamically based on XML
string. This control consists of a table with number of rows with 3 columns;
TextBox, dropdown and a button ("Delete" button) in each column. Also there's
one button at the bottom of the table that allows users to add more rows. So
more controls will be added programmatically as user adds more rows.
What's the easiest way to associate an event with each Delete button which
will take rowID as a parameter. So when a particular button is clicked
appropriate row will be removed.
Thank you guys for any feedback... 6 1354
Why not use a repeater and simply use the ItemCommand event of the repeater?
The delete button's event will bubble up to the ItemCommand event, which you
can catch, and figure out which row was clicked via a number of ways
(commandARgument, using a hidden field)...
You can check out more about this at: http://openmymind.net/databinding/index.html#8 (might wanna read the whole
thing though).
Karl
--
MY ASP.Net tutorials http://www.openmymind.net/
"WebMatrix" <We*******@discussions.microsoft.com> wrote in message
news:43**********************************@microsof t.com... Hello,
Here's the situation (I'll try to be brief as possible) I am working on the control which is created dynamically based on XML string. This control consists of a table with number of rows with 3
columns; TextBox, dropdown and a button ("Delete" button) in each column. Also
there's one button at the bottom of the table that allows users to add more rows.
So more controls will be added programmatically as user adds more rows. What's the easiest way to associate an event with each Delete button which will take rowID as a parameter. So when a particular button is clicked appropriate row will be removed.
Thank you guys for any feedback...
Thank you for your response.
I guess data Repeater could work, but .....
This control is a little more complicated than simply displaying rows of
data and deleting one row at a time:
1. It's source is a custom XML string (I guess I has to be converted to
dataset to be databound.)
2. Dropdown is driven by data that varies by RowID
3. After user adds new row or removes existing rows each row must be
validated.
I am not sure if Repeater can satisfy these requirements. I'd rather develop
my own logic that parses XML and creates each control programmatically. I
will look into repeater if nothing else works. Thanks.
Any other sugestions?
"Karl Seguin" wrote: Why not use a repeater and simply use the ItemCommand event of the repeater?
The delete button's event will bubble up to the ItemCommand event, which you can catch, and figure out which row was clicked via a number of ways (commandARgument, using a hidden field)...
You can check out more about this at: http://openmymind.net/databinding/index.html#8 (might wanna read the whole thing though).
Karl -- MY ASP.Net tutorials http://www.openmymind.net/
"WebMatrix" <We*******@discussions.microsoft.com> wrote in message news:43**********************************@microsof t.com... Hello,
Here's the situation (I'll try to be brief as possible) I am working on the control which is created dynamically based on XML string. This control consists of a table with number of rows with 3 columns; TextBox, dropdown and a button ("Delete" button) in each column. Also there's one button at the bottom of the table that allows users to add more rows. So more controls will be added programmatically as user adds more rows. What's the easiest way to associate an event with each Delete button which will take rowID as a parameter. So when a particular button is clicked appropriate row will be removed.
Thank you guys for any feedback...
Well, each delete button can be hooked into the same event, and you can
simply set the RowId to the commandArgument so you'll know which row to
delete.
Karl
--
MY ASP.Net tutorials http://www.openmymind.net/
"WebMatrix" <We*******@discussions.microsoft.com> wrote in message
news:9A**********************************@microsof t.com... Thank you for your response.
I guess data Repeater could work, but ..... This control is a little more complicated than simply displaying rows of data and deleting one row at a time: 1. It's source is a custom XML string (I guess I has to be converted to dataset to be databound.) 2. Dropdown is driven by data that varies by RowID 3. After user adds new row or removes existing rows each row must be validated.
I am not sure if Repeater can satisfy these requirements. I'd rather
develop my own logic that parses XML and creates each control programmatically. I will look into repeater if nothing else works. Thanks. Any other sugestions?
"Karl Seguin" wrote:
Why not use a repeater and simply use the ItemCommand event of the
repeater? The delete button's event will bubble up to the ItemCommand event, which
you can catch, and figure out which row was clicked via a number of ways (commandARgument, using a hidden field)...
You can check out more about this at: http://openmymind.net/databinding/index.html#8 (might wanna read the
whole thing though).
Karl -- MY ASP.Net tutorials http://www.openmymind.net/
"WebMatrix" <We*******@discussions.microsoft.com> wrote in message news:43**********************************@microsof t.com... Hello,
Here's the situation (I'll try to be brief as possible) I am working on the control which is created dynamically based on XML string. This control consists of a table with number of rows with 3 columns; TextBox, dropdown and a button ("Delete" button) in each column. Also there's one button at the bottom of the table that allows users to add more
rows. So more controls will be added programmatically as user adds more rows. What's the easiest way to associate an event with each Delete button
which will take rowID as a parameter. So when a particular button is clicked appropriate row will be removed.
Thank you guys for any feedback...
Ok, How can I add a dropdwon control populated by another data source to
ItemTemplate and select one of the dropdown's item based on the value from
database.
All this information is contained within XML. That's why I am look for
custom programming solution, but if Reapeter can handle above requirement,
I'll go with that.
"Karl Seguin" wrote: Well, each delete button can be hooked into the same event, and you can simply set the RowId to the commandArgument so you'll know which row to delete.
Karl
-- MY ASP.Net tutorials http://www.openmymind.net/
"WebMatrix" <We*******@discussions.microsoft.com> wrote in message news:9A**********************************@microsof t.com... Thank you for your response.
I guess data Repeater could work, but ..... This control is a little more complicated than simply displaying rows of data and deleting one row at a time: 1. It's source is a custom XML string (I guess I has to be converted to dataset to be databound.) 2. Dropdown is driven by data that varies by RowID 3. After user adds new row or removes existing rows each row must be validated.
I am not sure if Repeater can satisfy these requirements. I'd rather develop my own logic that parses XML and creates each control programmatically. I will look into repeater if nothing else works. Thanks. Any other sugestions?
"Karl Seguin" wrote:
Why not use a repeater and simply use the ItemCommand event of the repeater? The delete button's event will bubble up to the ItemCommand event, which you can catch, and figure out which row was clicked via a number of ways (commandARgument, using a hidden field)...
You can check out more about this at: http://openmymind.net/databinding/index.html#8 (might wanna read the whole thing though).
Karl -- MY ASP.Net tutorials http://www.openmymind.net/
"WebMatrix" <We*******@discussions.microsoft.com> wrote in message news:43**********************************@microsof t.com... > Hello, > > Here's the situation (I'll try to be brief as possible) > I am working on the control which is created dynamically based on XML > string. This control consists of a table with number of rows with 3 columns; > TextBox, dropdown and a button ("Delete" button) in each column. Also there's > one button at the bottom of the table that allows users to add more rows. So > more controls will be added programmatically as user adds more rows. > What's the easiest way to associate an event with each Delete button which > will take rowID as a parameter. So when a particular button is clicked > appropriate row will be removed. > > Thank you guys for any feedback...
If you are using a Repeater, you can hook into the ItemDataBound event and
easily do that in codebehind (the tutorial I pointed you to has details on
that), something like:
sub ItemDataBound(...)
dim ddl as DropDownList = ctype(e.Item.FindControl("dropdown"),
DropDownList)
ddl.DataSource = yourOtherDataSource;
ddl.DataBind()
ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByValue("TheValue" ))
end sub
Karl
--
MY ASP.Net tutorials http://www.openmymind.net/
"WebMatrix" <We*******@discussions.microsoft.com> wrote in message
news:67**********************************@microsof t.com... Ok, How can I add a dropdwon control populated by another data source to ItemTemplate and select one of the dropdown's item based on the value from database. All this information is contained within XML. That's why I am look for custom programming solution, but if Reapeter can handle above requirement, I'll go with that.
"Karl Seguin" wrote:
Well, each delete button can be hooked into the same event, and you can simply set the RowId to the commandArgument so you'll know which row to delete.
Karl
-- MY ASP.Net tutorials http://www.openmymind.net/
"WebMatrix" <We*******@discussions.microsoft.com> wrote in message news:9A**********************************@microsof t.com... Thank you for your response.
I guess data Repeater could work, but ..... This control is a little more complicated than simply displaying rows
of data and deleting one row at a time: 1. It's source is a custom XML string (I guess I has to be converted
to dataset to be databound.) 2. Dropdown is driven by data that varies by RowID 3. After user adds new row or removes existing rows each row must be validated.
I am not sure if Repeater can satisfy these requirements. I'd rather develop my own logic that parses XML and creates each control
programmatically. I will look into repeater if nothing else works. Thanks. Any other sugestions?
"Karl Seguin" wrote:
> Why not use a repeater and simply use the ItemCommand event of the repeater? > > The delete button's event will bubble up to the ItemCommand event,
which you > can catch, and figure out which row was clicked via a number of ways > (commandARgument, using a hidden field)... > > You can check out more about this at: > http://openmymind.net/databinding/index.html#8 (might wanna read the whole > thing though). > > Karl > -- > MY ASP.Net tutorials > http://www.openmymind.net/ > > > "WebMatrix" <We*******@discussions.microsoft.com> wrote in message > news:43**********************************@microsof t.com... > > Hello, > > > > Here's the situation (I'll try to be brief as possible) > > I am working on the control which is created dynamically based on
XML > > string. This control consists of a table with number of rows with
3 > columns; > > TextBox, dropdown and a button ("Delete" button) in each column.
Also > there's > > one button at the bottom of the table that allows users to add
more rows. > So > > more controls will be added programmatically as user adds more
rows. > > What's the easiest way to associate an event with each Delete
button which > > will take rowID as a parameter. So when a particular button is
clicked > > appropriate row will be removed. > > > > Thank you guys for any feedback... > > >
I just glimpsed over your tutorial... I think it's exactly what I was looking
for!! and it's a great tutorial, very concise and to the point. Thanks.
I can put together dataReapeter with nested databinding, no problems. Now I
need to figure out how to retrieve all the data entered into the repeater's
controls. I think I have some ideas on how do to that, pobably looping
through ItemTemplates and .FindControls for what I need, right? I have a
feeling I'll be posting again.
"Karl Seguin" wrote: If you are using a Repeater, you can hook into the ItemDataBound event and easily do that in codebehind (the tutorial I pointed you to has details on that), something like:
sub ItemDataBound(...) dim ddl as DropDownList = ctype(e.Item.FindControl("dropdown"), DropDownList) ddl.DataSource = yourOtherDataSource; ddl.DataBind() ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByValue("TheValue" )) end sub
Karl
-- MY ASP.Net tutorials http://www.openmymind.net/
"WebMatrix" <We*******@discussions.microsoft.com> wrote in message news:67**********************************@microsof t.com... Ok, How can I add a dropdwon control populated by another data source to ItemTemplate and select one of the dropdown's item based on the value from database. All this information is contained within XML. That's why I am look for custom programming solution, but if Reapeter can handle above requirement, I'll go with that.
"Karl Seguin" wrote:
Well, each delete button can be hooked into the same event, and you can simply set the RowId to the commandArgument so you'll know which row to delete.
Karl
-- MY ASP.Net tutorials http://www.openmymind.net/
"WebMatrix" <We*******@discussions.microsoft.com> wrote in message news:9A**********************************@microsof t.com... > Thank you for your response. > > I guess data Repeater could work, but ..... > This control is a little more complicated than simply displaying rows of > data and deleting one row at a time: > 1. It's source is a custom XML string (I guess I has to be converted to > dataset to be databound.) > 2. Dropdown is driven by data that varies by RowID > 3. After user adds new row or removes existing rows each row must be > validated. > > I am not sure if Repeater can satisfy these requirements. I'd rather develop > my own logic that parses XML and creates each control programmatically. I > will look into repeater if nothing else works. Thanks. > Any other sugestions? > > "Karl Seguin" wrote: > > > Why not use a repeater and simply use the ItemCommand event of the repeater? > > > > The delete button's event will bubble up to the ItemCommand event, which you > > can catch, and figure out which row was clicked via a number of ways > > (commandARgument, using a hidden field)... > > > > You can check out more about this at: > > http://openmymind.net/databinding/index.html#8 (might wanna read the whole > > thing though). > > > > Karl > > -- > > MY ASP.Net tutorials > > http://www.openmymind.net/ > > > > > > "WebMatrix" <We*******@discussions.microsoft.com> wrote in message > > news:43**********************************@microsof t.com... > > > Hello, > > > > > > Here's the situation (I'll try to be brief as possible) > > > I am working on the control which is created dynamically based on XML > > > string. This control consists of a table with number of rows with 3 > > columns; > > > TextBox, dropdown and a button ("Delete" button) in each column. Also > > there's > > > one button at the bottom of the table that allows users to add more rows. > > So > > > more controls will be added programmatically as user adds more rows. > > > What's the easiest way to associate an event with each Delete button which > > > will take rowID as a parameter. So when a particular button is clicked > > > appropriate row will be removed. > > > > > > Thank you guys for any feedback... > > > > > > This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Christopher W. Douglas |
last post by:
I am writing a VB.NET application in Visual Studio 2003. I have written a
method that handles several events, such as closing a form and changing the
visible status of a form. I have some code...
|
by: Donald Xie |
last post by:
Hi,
I noticed an interesting effect when working with controls that are
dynamically loaded. For instance, on a web form with a PlaceHolder control
named ImageHolder, I dynamically add an image...
|
by: |
last post by:
I am wondering what the best method of attaching custom Events to custom
WebUserControls are. I cannot seem to find the proper terminology to expand
my research.
Basicallly I have a custom user...
|
by: JohnR |
last post by:
In it's simplest form, assume that I have created a usercontrol,
WSToolBarButton that contains a button. I would like to eventually create
copies of WSToolBarButton dynamically at run time based...
|
by: james |
last post by:
Hello,
I am having a little trouble creating an event handler for a context menu
toolstripmenuitem.
I've seen various tutorials and so on, but I keep getting a bit stuck!
So far I have a second...
|
by: MaryamSh |
last post by:
Hi,
I am creating a Dynamic Search in my application.
I create a user control and in Page_load event I create a dynamic dropdownlist and 2 dynamic button (Add,Remove)
By pressing Add button...
|
by: MaryamSh |
last post by:
Create Dynamic Dropdownlist Controls and related event
--------------------------------------------------------------------------------
Hi,
I am creating a Dynamic Search in my application.
I...
|
by: euroluxantiques |
last post by:
Hi All,
Using VB.Net with SQL Server. I have a form that I create a number of Picture Boxes on dynamically, based on a stored procedure that retrieves a listing of images available for a...
|
by: tshad |
last post by:
I was looking at a page that showed how to set up a custom event and it
seems to work ok. But I am not sure how I would use it. How would I
subscribe to it. There is actual action (such as...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |