How do I add a variable number of buttons to a gridview RRS feed

  • Question

  • User646364117 posted

    I have a 2 column gridview in a classic asp web form.

    column 1 is called categories, column 2 is called templates.

    a category may have a variable number of templates.

    in column 2 I want a button for each template associated with the category in column 1

    How do I go about getting a variable number of buttons into column 2?

    thanks in advance. I prefer vb but can translate c# if I have to.

    Thursday, January 23, 2020 9:23 PM

All replies

  • User-719153870 posted

    Hi sg48asp,

    I have a 2 column gridview in a classic asp web form.

    Is this project coded with vb script and are you trying to convert it to vb .net?

    Best Regard,

    Yang Shen

    Friday, January 24, 2020 2:59 AM
  • User646364117 posted

    It is a vb.net project already.

    Friday, January 24, 2020 1:50 PM
  • User409696431 posted

    You said "classic asp", which is not asp.net, which is what led to Yang Shen's question, although you did mention web forms which is not classic asp.  smile

    You need to show us your code.  How are you getting "multple templates" into the gridview now?  The answer will be to add a button with each template, but not knowing what you are doing now means I can't tell you how.

    Friday, January 24, 2020 3:36 PM
  • User646364117 posted

    Sorry for the confusion. I don’t have code yet. I am trying to determine the approach first. I am using asp.net.
    I confused the issue by using the word “template”. Here I used the word to refer to my 2nd column.

    if you go to my test site “emailgen.co” you will a grid where for the one category in column 1 I need 3 rows to accommodate 3 buttons for different template types.

    what I am trying to do is to eliminate the need for 3 rows. I want to put the 3 buttons in the first row.

    a different category might have 5 different buttons in its row.

    hope this clears things up

    i do have code for my test site, but it is the standard method for adding buttons to a gridview with bound columns. I  can provide it but didn’t think relevant.

    Friday, January 24, 2020 4:08 PM
  • User475983607 posted

    It sounds like you need a different type of data bound control like a FormView or Repeater.

    Friday, January 24, 2020 4:35 PM
  • User-719153870 posted

    Hi sg48asp,

    It's hard to tell what you should do without the code. But mgebhard's suggestion is helpful, in my opinion, you can try the nested repeater which is very flexible and easy to operate.

    You can refer to Implement Nested Repeater (Repeater inside Repeater) with example in ASP.Net using C# and VB.Net for more information.

    Best Regard,

    Yang Shen

    Monday, January 27, 2020 2:05 AM