Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
R. Thomas, aka Xtreme.Net #1
RE: Dynamically create datagrid control
Hi,
You have to to declare it on the aspx side at all. Just do it all in the
code will be much more easier and convenient!
HTHs...
R. Thomas
"Boo Khan Ming" wrote:
> Hi,
>
> Depends on number of records in database, each record should create a unique
> datagrid - I use AccessDataSourceControl of Web Matrix.
>
> My questions is that:
> - The "id" tag of server control, can be put variable name? (This is a way
> for me to create dynamic datagrid during runtime)
>
> E.g.
>
> <%for i=0 to array.count-1%>
> <asp:datagrid id=i runat="server"/>
> <%next%>
>
> Is this allowed?
>
> Or,
>
> E.g.
>
> <asp:placeholder id="PlaceHolder1" runat="server"/>
>
> <% for i=0 to array.count-1%>
> <%
> dim repgrid as new datagrid
> a.selectcommand="...........'" & i.tostring & "'"
> datagrid.id=i
> datagrid.datasource=a
> PlaceHolder1.controls.add(datagrid)
> databind()
> %>
> <%next%>
>
> But this one doesn't work either, because all datagrids appear similar in
> their data contents.
>
> And, for this one too, the controls created in pyramid order.
> 1st record
> - 0 datagrid
> 2nd record
> - 1 datagrid
> 3rd record
> - 2 datagrids
> ...
> ...
>
> Can you recommend a good way to dynamically create datagrid?
> Or, AccessDataSourceControl, other than using datagrid.DataSource to acquire
> the data, can I take the result from data source directly?
>
> Khan Ming
>
>
>R. Thomas, aka Xtreme.Net Guest
-
Dynamically create datagrid columns
I am trying to write a user control that is essentially a DataGrid with some custom functionality. My grid is to be bound to a custom collection.... -
dynamically create datagrid and set its datasource in VB.NET
I try to dynamically add datagrid to my web form in VB.NET. But when I try to setup the datasource, the DATASOURCE is not the property of... -
Dynamically created control in Datagrid problem
I created a datagrid with 4 bound columns and 1 template column. I am using the ITEMDATABOUND event to add a control to the template column, if... -
How can I dynamically add a control to a DataGrid Template column?
I want to do the following: // create the template column ... TemplateColumn tc = new TemplateColumn(); tc.HeaderText = "Location";... -
Dynamically create non-fixed number of TextBoxes in Composite Control
Hi, I have a composite control(TextBoxControl.cs) in my DynamicTextBox.aspx. On the Page_Load of the DynamicTextBox.aspx page, I am calling a...



Reply With Quote

