Showing posts with label column. Show all posts
Showing posts with label column. Show all posts

Monday, March 26, 2012

Text from a Hyperlink column in a datagrid

Does anyone have any idea how to get the text out of a hyperlink column in a
web datagrid?
It's a hyperlink column, not a template column so findcontrol does not work
and there is no apparent name to look for.
myGridItem.cells(0).controls(0) shows no text properties or anything that
points to or contains the text.
It seems quite hidden.
GA Cell(0).Text should work
"GaryB" <gb@.nospam.com> wrote in message
news:eEcN6QHwEHA.2728@.TK2MSFTNGP12.phx.gbl...
> Does anyone have any idea how to get the text out of a hyperlink column in
> a web datagrid?
> It's a hyperlink column, not a template column so findcontrol does not
> work and there is no apparent name to look for.
> myGridItem.cells(0).controls(0) shows no text properties or anything that
> points to or contains the text.
> It seems quite hidden.
> G
>
No, it does not. That's the whole point of the question. When a column is
a hyperlink column, the text is not present in cell(n).text.
G
"George Durzi" <gdurzi@.hotmail.com> wrote in message
news:%23GsshaHwEHA.1524@.TK2MSFTNGP09.phx.gbl...
>A Cell(0).Text should work
>
> "GaryB" <gb@.nospam.com> wrote in message
> news:eEcN6QHwEHA.2728@.TK2MSFTNGP12.phx.gbl...
>
Im my experiment it renders into the second control. You can cast
item.Cells(0).Controls(1) to a HyperLink control to pull the Text and
NavigateUrl properties.
Indexing into the control array always makes me nervous. I don't know
when MS might change how the controls render and that would break some
code. If I need to dig something out I stick to templated columns with
named controls. Know what I mean?
Scott
http://www.OdeToCode.com/blogs/scott/
On Mon, 1 Nov 2004 17:55:20 -0700, "George Durzi" <gdurzi@.hotmail.com>
wrote:

>A Cell(0).Text should work
>
>"GaryB" <gb@.nospam.com> wrote in message
>news:eEcN6QHwEHA.2728@.TK2MSFTNGP12.phx.gbl...
>
Thanks for Scott's informative suggestion.
Hi Gary,
As Scott has mentioned, since the HyperLink columns will contain a
HyperLink control in it's Cell, we need to retrieve the HyperLink control
first , then access its properties. For example:
private void btnSubmit_Click(object sender, System.EventArgs e)
{
foreach(DataGridItem dgi in dgData.Items)
{
HyperLink hl = dgi.Cells[0].Controls[0] as HyperLink;
if(hl!=null)
{
Response.Write("<br>Text: " + hl.Text + " Link: " + hl.NavigateUrl);
}
}
}
thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Thats it! I knew it was in cells(3).controls(0) but I was looking for it
directly there. Of course I have to dimension it as a hyperlink and there
it is.
Thanks.
About what Scott said, do you think this kind of thing might change?
Gary
"Steven Cheng[MSFT]" <v-schang@.online.microsoft.com> wrote in message
news:Mo4ElNLwEHA.768@.cpmsftngxa10.phx.gbl...
> Thanks for Scott's informative suggestion.
> Hi Gary,
> As Scott has mentioned, since the HyperLink columns will contain a
> HyperLink control in it's Cell, we need to retrieve the HyperLink control
> first , then access its properties. For example:
> private void btnSubmit_Click(object sender, System.EventArgs e)
> {
> foreach(DataGridItem dgi in dgData.Items)
> {
> HyperLink hl = dgi.Cells[0].Controls[0] as HyperLink;
> if(hl!=null)
> {
> Response.Write("<br>Text: " + hl.Text + " Link: " + hl.NavigateUrl);
> }
> }
> }
> thanks.
>
> Regards,
> Steven Cheng
> Microsoft Online Support
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
Hi Gary,
Thanks for the followup. Yes, Scott's worry is reasonable since the
internal implemention of the datagrid's Buildin ColumnType may changed in
new versions. So it's better that we use a custom Template Column and put a
HyperLink control which has a specified "id" property so that we can
reference it via "FindControl".
Also, do need to put the following code when accessing sub controls via
index on webform so as not to get "null reference exception.".
HyperLink hl = dgi.Cells[0].Controls[0] as HyperLink;
if(hl!=null)
{
}
Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Text from a Hyperlink column in a datagrid

Does anyone have any idea how to get the text out of a hyperlink column in a
web datagrid?

It's a hyperlink column, not a template column so findcontrol does not work
and there is no apparent name to look for.

myGridItem.cells(0).controls(0) shows no text properties or anything that
points to or contains the text.

It seems quite hidden.

GA Cell(0).Text should work

"GaryB" <gb@.nospam.com> wrote in message
news:eEcN6QHwEHA.2728@.TK2MSFTNGP12.phx.gbl...
> Does anyone have any idea how to get the text out of a hyperlink column in
> a web datagrid?
> It's a hyperlink column, not a template column so findcontrol does not
> work and there is no apparent name to look for.
> myGridItem.cells(0).controls(0) shows no text properties or anything that
> points to or contains the text.
> It seems quite hidden.
> G
No, it does not. That's the whole point of the question. When a column is
a hyperlink column, the text is not present in cell(n).text.
G

"George Durzi" <gdurzi@.hotmail.com> wrote in message
news:%23GsshaHwEHA.1524@.TK2MSFTNGP09.phx.gbl...
>A Cell(0).Text should work
>
> "GaryB" <gb@.nospam.com> wrote in message
> news:eEcN6QHwEHA.2728@.TK2MSFTNGP12.phx.gbl...
>> Does anyone have any idea how to get the text out of a hyperlink column
>> in a web datagrid?
>>
>> It's a hyperlink column, not a template column so findcontrol does not
>> work and there is no apparent name to look for.
>>
>> myGridItem.cells(0).controls(0) shows no text properties or anything that
>> points to or contains the text.
>>
>> It seems quite hidden.
>>
>> G
>>
Im my experiment it renders into the second control. You can cast
item.Cells(0).Controls(1) to a HyperLink control to pull the Text and
NavigateUrl properties.

Indexing into the control array always makes me nervous. I don't know
when MS might change how the controls render and that would break some
code. If I need to dig something out I stick to templated columns with
named controls. Know what I mean?

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Mon, 1 Nov 2004 17:55:20 -0700, "George Durzi" <gdurzi@.hotmail.com>
wrote:

>A Cell(0).Text should work
>
>"GaryB" <gb@.nospam.com> wrote in message
>news:eEcN6QHwEHA.2728@.TK2MSFTNGP12.phx.gbl...
>> Does anyone have any idea how to get the text out of a hyperlink column in
>> a web datagrid?
>>
>> It's a hyperlink column, not a template column so findcontrol does not
>> work and there is no apparent name to look for.
>>
>> myGridItem.cells(0).controls(0) shows no text properties or anything that
>> points to or contains the text.
>>
>> It seems quite hidden.
>>
>> G
>
Thanks for Scott's informative suggestion.

Hi Gary,

As Scott has mentioned, since the HyperLink columns will contain a
HyperLink control in it's Cell, we need to retrieve the HyperLink control
first , then access its properties. For example:

private void btnSubmit_Click(object sender, System.EventArgs e)
{
foreach(DataGridItem dgi in dgData.Items)
{
HyperLink hl = dgi.Cells[0].Controls[0] as HyperLink;
if(hl!=null)
{

Response.Write("<br>Text: " + hl.Text + " Link: " + hl.NavigateUrl);
}
}
}

thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Thats it! I knew it was in cells(3).controls(0) but I was looking for it
directly there. Of course I have to dimension it as a hyperlink and there
it is.
Thanks.

About what Scott said, do you think this kind of thing might change?
Gary

"Steven Cheng[MSFT]" <v-schang@.online.microsoft.com> wrote in message
news:Mo4ElNLwEHA.768@.cpmsftngxa10.phx.gbl...
> Thanks for Scott's informative suggestion.
> Hi Gary,
> As Scott has mentioned, since the HyperLink columns will contain a
> HyperLink control in it's Cell, we need to retrieve the HyperLink control
> first , then access its properties. For example:
> private void btnSubmit_Click(object sender, System.EventArgs e)
> {
> foreach(DataGridItem dgi in dgData.Items)
> {
> HyperLink hl = dgi.Cells[0].Controls[0] as HyperLink;
> if(hl!=null)
> {
> Response.Write("<br>Text: " + hl.Text + " Link: " + hl.NavigateUrl);
> }
> }
> }
> thanks.
>
> Regards,
> Steven Cheng
> Microsoft Online Support
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
Hi Gary,

Thanks for the followup. Yes, Scott's worry is reasonable since the
internal implemention of the datagrid's Buildin ColumnType may changed in
new versions. So it's better that we use a custom Template Column and put a
HyperLink control which has a specified "id" property so that we can
reference it via "FindControl".
Also, do need to put the following code when accessing sub controls via
index on webform so as not to get "null reference exception.".
HyperLink hl = dgi.Cells[0].Controls[0] as HyperLink;
if(hl!=null)
{

}

Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Thursday, March 22, 2012

Text Value in a TextBox inside Datagrid

i have a textbox in a template column in a datagrid, it displays the
initial value of the row, but when i change it remains with the
original value (it doesnt get the new value..)
i fill the CartTable programmatically with rows from a database binded
datagrid..
i cant figure out what is wroooong! hehe thanks for helping
here is my code:
TABLE CODE (in the page_load):
If Session("shop_cart") Is Nothing Then
CartTable = New DataTable
CartTable.Columns.Add(New DataColumn("Product", GetType(String)))
CartTable.Columns.Add(New DataColumn("Line", GetType(String)))
CartTable.Columns.Add(New DataColumn("Description", GetType(String)))
CartTable.Columns.Add(New DataColumn("Quantity", GetType(String)))
CartTable.Columns.Add(New DataColumn("Price", GetType(String)))
CartTable.Columns.Add(New DataColumn("Total", GetType(String)))
ession("shop_cart") = CartTable
Else
CartTable = Session("shop_cart")
End If
BindBuy() 'this assign the datasource and execute DataBind()
DATAGRID CODE:
<asp:datagrid id="dgBuy" style="Z-INDEX: 103; LEFT: 80px; POSITION:
absolute; TOP: 576px" runat="server"
BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px"
BackColor="White" CellPadding="3"
Width="712px" AllowPaging="True" Font-Names="Tahoma"
Font-Size="X-Small" AutoGenerateColumns="False">
<SelectedItemStyle Font-Bold="True" ForeColor="White"
BackColor="#669999"></SelectedItemStyle>
<ItemStyle ForeColor="#000066"></ItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="White"
BackColor="#006699"></HeaderStyle>
<FooterStyle ForeColor="#000066" BackColor="White"></FooterStyle>
<Columns>
<asp:ButtonColumn Text="Delete"
CommandName="Delete"></asp:ButtonColumn>
<asp:BoundColumn DataField="Product"
HeaderText="Product"></asp:BoundColumn>
<asp:BoundColumn DataField="Line"
HeaderText="Line"></asp:BoundColumn>
<asp:BoundColumn DataField="Description"
HeaderText="Description"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="Quantity">
<ItemTemplate>
<asp:TextBox id=txtQty runat="server" Width="40px" Text='<%#
DataBinder.Eval(Container.DataItem, "Quantity") %>' >
</asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="Price" HeaderText="Price"
DataFormatString="{0:c}"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="Total">
<ItemTemplate>
<p>
<asp:Label runat="server" Text='<%#
System.String.Format("{0:c}",CalcTotal(Int32.Parse(DataBinder.Eval(Container
.DataItem,
"Quantity")),DataBinder.Eval(Container.DataItem, "Price"))) %>'
ID="Label8"/>
</p>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<PagerStyle HorizontalAlign="Left" ForeColor="#000066"
BackColor="Silver" Mode="NumericPages"></PagerStyle>
</asp:datagrid>
UPDATE BUTTON CODE:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim i As Integer
Dim _item As DataGridItem
Dim dr As DataRow
For i = 0 To dgBuy.Items.Count - 1
_item = dgBuy.Items(i)
Dim qtyTextBox As TextBox = _item.FindControl("txtQty")
dr = CartTable.Rows(i)
dr(3) = qtyTextBox.Text
Next
BindBuy()
End SubMake sure viewstate is on the page. Also, likely you'll only want to
populate the grid when "not page.ispostback", otherwise you'll be overwritin
g
any changes made to the data in the boxes.
"ismaelf@.gmail.com" wrote:

> i have a textbox in a template column in a datagrid, it displays the
> initial value of the row, but when i change it remains with the
> original value (it doesnt get the new value..)
> i fill the CartTable programmatically with rows from a database binded
> datagrid..
> i cant figure out what is wroooong! hehe thanks for helping
> here is my code:
> TABLE CODE (in the page_load):
> If Session("shop_cart") Is Nothing Then
> CartTable = New DataTable
> CartTable.Columns.Add(New DataColumn("Product", GetType(String)))
> CartTable.Columns.Add(New DataColumn("Line", GetType(String)))
> CartTable.Columns.Add(New DataColumn("Description", GetType(String)))
> CartTable.Columns.Add(New DataColumn("Quantity", GetType(String)))
> CartTable.Columns.Add(New DataColumn("Price", GetType(String)))
> CartTable.Columns.Add(New DataColumn("Total", GetType(String)))
> ession("shop_cart") = CartTable
> Else
> CartTable = Session("shop_cart")
> End If
> BindBuy() 'this assign the datasource and execute DataBind()
>
> DATAGRID CODE:
> <asp:datagrid id="dgBuy" style="Z-INDEX: 103; LEFT: 80px; POSITION:
> absolute; TOP: 576px" runat="server"
> BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px"
> BackColor="White" CellPadding="3"
> Width="712px" AllowPaging="True" Font-Names="Tahoma"
> Font-Size="X-Small" AutoGenerateColumns="False">
> <SelectedItemStyle Font-Bold="True" ForeColor="White"
> BackColor="#669999"></SelectedItemStyle>
> <ItemStyle ForeColor="#000066"></ItemStyle>
> <HeaderStyle Font-Bold="True" ForeColor="White"
> BackColor="#006699"></HeaderStyle>
> <FooterStyle ForeColor="#000066" BackColor="White"></FooterStyle>
> <Columns>
> <asp:ButtonColumn Text="Delete"
> CommandName="Delete"></asp:ButtonColumn>
> <asp:BoundColumn DataField="Product"
> HeaderText="Product"></asp:BoundColumn>
> <asp:BoundColumn DataField="Line"
> HeaderText="Line"></asp:BoundColumn>
> <asp:BoundColumn DataField="Description"
> HeaderText="Description"></asp:BoundColumn>
> <asp:TemplateColumn HeaderText="Quantity">
> <ItemTemplate>
> <asp:TextBox id=txtQty runat="server" Width="40px" Text='<%#
> DataBinder.Eval(Container.DataItem, "Quantity") %>' >
> </asp:TextBox>
> </ItemTemplate>
> </asp:TemplateColumn>
> <asp:BoundColumn DataField="Price" HeaderText="Price"
> DataFormatString="{0:c}"></asp:BoundColumn>
> <asp:TemplateColumn HeaderText="Total">
> <ItemTemplate>
> <p>
> <asp:Label runat="server" Text='<%#
> System.String.Format("{0:c}",CalcTotal(Int32.Parse(DataBinder.Eval(Contain
er.DataItem,
> "Quantity")),DataBinder.Eval(Container.DataItem, "Price"))) %>'
> ID="Label8"/>
> </p>
> </ItemTemplate>
> </asp:TemplateColumn>
> </Columns>
> <PagerStyle HorizontalAlign="Left" ForeColor="#000066"
> BackColor="Silver" Mode="NumericPages"></PagerStyle>
> </asp:datagrid>
> UPDATE BUTTON CODE:
> Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button2.Click
> Dim i As Integer
> Dim _item As DataGridItem
> Dim dr As DataRow
> For i = 0 To dgBuy.Items.Count - 1
> _item = dgBuy.Items(i)
> Dim qtyTextBox As TextBox = _item.FindControl("txtQty")
> dr = CartTable.Rows(i)
> dr(3) = qtyTextBox.Text
> Next
> BindBuy()
> End Sub
>
thanks, i populate the table under not page.ispostback now.. and verify
the ViewState also and its enabled.. but i still have the same problem
of the textbox.. :(

Text Value in a TextBox inside Datagrid

i have a textbox in a template column in a datagrid, it displays the
initial value of the row, but when i change it remains with the
original value (it doesnt get the new value..)
i fill the CartTable programmatically with rows from a database binded
datagrid..
i cant figure out what is wroooong! hehe thanks for helping
here is my code:

TABLE CODE (in the page_load):
If Session("shop_cart") Is Nothing Then
CartTable = New DataTable
CartTable.Columns.Add(New DataColumn("Product", GetType(String)))
CartTable.Columns.Add(New DataColumn("Line", GetType(String)))
CartTable.Columns.Add(New DataColumn("Description", GetType(String)))
CartTable.Columns.Add(New DataColumn("Quantity", GetType(String)))
CartTable.Columns.Add(New DataColumn("Price", GetType(String)))
CartTable.Columns.Add(New DataColumn("Total", GetType(String)))
ession("shop_cart") = CartTable
Else
CartTable = Session("shop_cart")
End If
BindBuy() 'this assign the datasource and execute DataBind()

DATAGRID CODE:
<asp:datagrid id="dgBuy" style="Z-INDEX: 103; LEFT: 80px; POSITION:
absolute; TOP: 576px" runat="server"
BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px"
BackColor="White" CellPadding="3"
Width="712px" AllowPaging="True" Font-Names="Tahoma"
Font-Size="X-Small" AutoGenerateColumns="False">
<SelectedItemStyle Font-Bold="True" ForeColor="White"
BackColor="#669999"></SelectedItemStyle>
<ItemStyle ForeColor="#000066"></ItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="White"
BackColor="#006699"></HeaderStyle>
<FooterStyle ForeColor="#000066" BackColor="White"></FooterStyle>
<Columns>
<asp:ButtonColumn Text="Delete"
CommandName="Delete"></asp:ButtonColumn>
<asp:BoundColumn DataField="Product"
HeaderText="Product"></asp:BoundColumn>
<asp:BoundColumn DataField="Line"
HeaderText="Line"></asp:BoundColumn>
<asp:BoundColumn DataField="Description"
HeaderText="Description"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="Quantity">
<ItemTemplate>
<asp:TextBox id=txtQty runat="server" Width="40px" Text='<%#
DataBinder.Eval(Container.DataItem, "Quantity") %>' >
</asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField="Price" HeaderText="Price"
DataFormatString="{0:c}"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="Total">
<ItemTemplate>
<p align="right">
<asp:Label runat="server" Text='<%#
System.String.Format("{0:c}",CalcTotal(Int32.Parse(DataBinder.Eval(Container.D ataItem,
"Quantity")),DataBinder.Eval(Container.DataItem, "Price"))) %>'
ID="Label8"/>
</p>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<PagerStyle HorizontalAlign="Left" ForeColor="#000066"
BackColor="Silver" Mode="NumericPages"></PagerStyle>
</asp:datagrid
UPDATE BUTTON CODE:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Dim i As Integer
Dim _item As DataGridItem
Dim dr As DataRow

For i = 0 To dgBuy.Items.Count - 1

_item = dgBuy.Items(i)
Dim qtyTextBox As TextBox = _item.FindControl("txtQty")
dr = CartTable.Rows(i)
dr(3) = qtyTextBox.Text

Next
BindBuy()

End SubMake sure viewstate is on the page. Also, likely you'll only want to
populate the grid when "not page.ispostback", otherwise you'll be overwriting
any changes made to the data in the boxes.

"ismaelf@.gmail.com" wrote:

> i have a textbox in a template column in a datagrid, it displays the
> initial value of the row, but when i change it remains with the
> original value (it doesnt get the new value..)
> i fill the CartTable programmatically with rows from a database binded
> datagrid..
> i cant figure out what is wroooong! hehe thanks for helping
> here is my code:
> TABLE CODE (in the page_load):
> If Session("shop_cart") Is Nothing Then
> CartTable = New DataTable
> CartTable.Columns.Add(New DataColumn("Product", GetType(String)))
> CartTable.Columns.Add(New DataColumn("Line", GetType(String)))
> CartTable.Columns.Add(New DataColumn("Description", GetType(String)))
> CartTable.Columns.Add(New DataColumn("Quantity", GetType(String)))
> CartTable.Columns.Add(New DataColumn("Price", GetType(String)))
> CartTable.Columns.Add(New DataColumn("Total", GetType(String)))
> ession("shop_cart") = CartTable
> Else
> CartTable = Session("shop_cart")
> End If
> BindBuy() 'this assign the datasource and execute DataBind()
>
> DATAGRID CODE:
> <asp:datagrid id="dgBuy" style="Z-INDEX: 103; LEFT: 80px; POSITION:
> absolute; TOP: 576px" runat="server"
> BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px"
> BackColor="White" CellPadding="3"
> Width="712px" AllowPaging="True" Font-Names="Tahoma"
> Font-Size="X-Small" AutoGenerateColumns="False">
> <SelectedItemStyle Font-Bold="True" ForeColor="White"
> BackColor="#669999"></SelectedItemStyle>
> <ItemStyle ForeColor="#000066"></ItemStyle>
> <HeaderStyle Font-Bold="True" ForeColor="White"
> BackColor="#006699"></HeaderStyle>
> <FooterStyle ForeColor="#000066" BackColor="White"></FooterStyle>
> <Columns>
> <asp:ButtonColumn Text="Delete"
> CommandName="Delete"></asp:ButtonColumn>
> <asp:BoundColumn DataField="Product"
> HeaderText="Product"></asp:BoundColumn>
> <asp:BoundColumn DataField="Line"
> HeaderText="Line"></asp:BoundColumn>
> <asp:BoundColumn DataField="Description"
> HeaderText="Description"></asp:BoundColumn>
> <asp:TemplateColumn HeaderText="Quantity">
> <ItemTemplate>
> <asp:TextBox id=txtQty runat="server" Width="40px" Text='<%#
> DataBinder.Eval(Container.DataItem, "Quantity") %>' >
> </asp:TextBox>
> </ItemTemplate>
> </asp:TemplateColumn>
> <asp:BoundColumn DataField="Price" HeaderText="Price"
> DataFormatString="{0:c}"></asp:BoundColumn>
> <asp:TemplateColumn HeaderText="Total">
> <ItemTemplate>
> <p align="right">
> <asp:Label runat="server" Text='<%#
> System.String.Format("{0:c}",CalcTotal(Int32.Parse(DataBinder.Eval(Container.D ataItem,
> "Quantity")),DataBinder.Eval(Container.DataItem, "Price"))) %>'
> ID="Label8"/>
> </p>
> </ItemTemplate>
> </asp:TemplateColumn>
> </Columns>
> <PagerStyle HorizontalAlign="Left" ForeColor="#000066"
> BackColor="Silver" Mode="NumericPages"></PagerStyle>
> </asp:datagrid>
> UPDATE BUTTON CODE:
> Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button2.Click
> Dim i As Integer
> Dim _item As DataGridItem
> Dim dr As DataRow
> For i = 0 To dgBuy.Items.Count - 1
> _item = dgBuy.Items(i)
> Dim qtyTextBox As TextBox = _item.FindControl("txtQty")
> dr = CartTable.Rows(i)
> dr(3) = qtyTextBox.Text
> Next
> BindBuy()
> End Sub
>
thanks, i populate the table under not page.ispostback now.. and verify
the ViewState also and its enabled.. but i still have the same problem
of the textbox.. :(

Textarea to sql 2000 text datatype

Hi All,
Does anyone have any example of asp.net code for saving a
textarea into a text/ntext column in sql table?

thanks

slyiShouldn't be any different to storing any other type of data.
Are you having problems testing this normally?

Just create a Stored Procedure to do it, and set the parameter.
Worked for me

HTH

My Example:

*****************
Sql
******************

CREATE PROCEDURE [spname]
@.MyNTextParam NTEXT
AS

INSERT INTO MYTABLE VALUES(@.MyNTextParam)

*************
c#
*************

SqlCommand cmd = new SqlCommand([spname], [connectionstring]);
cmd.CommandType = CommandType.StoredProcedure;

cmd.Parameters.add(new SqlParameter("@.MyNTextParam". SqlDbType.NText)).Value
= MyTextArea.Text;

//Open connection and execite cmd

<adrianca@.gmail.com> wrote in message
news:1124282549.563896.53910@.o13g2000cwo.googlegro ups.com...
> Hi All,
> Does anyone have any example of asp.net code for saving a
> textarea into a text/ntext column in sql table?
> thanks
> slyi
Thank you thats perfect.
i just see any examples on the web for this :o(

Textarea to sql 2000 text datatype

Hi All,
Does anyone have any example of asp.net code for saving a
textarea into a text/ntext column in sql table?
thanks
slyiShouldn't be any different to storing any other type of data.
Are you having problems testing this normally?
Just create a Stored Procedure to do it, and set the parameter.
Worked for me
HTH
My Example:
*****************
Sql
******************
CREATE PROCEDURE [spname]
@.MyNTextParam NTEXT
AS
INSERT INTO MYTABLE VALUES(@.MyNTextParam)
*************
c#
*************
SqlCommand cmd = new SqlCommand([spname], [connectionstring]);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.add(new SqlParameter("@.MyNTextParam". SqlDbType.NText)).Value
= MyTextArea.Text;
//Open connection and execite cmd
<adrianca@.gmail.com> wrote in message
news:1124282549.563896.53910@.o13g2000cwo.googlegroups.com...
> Hi All,
> Does anyone have any example of asp.net code for saving a
> textarea into a text/ntext column in sql table?
> thanks
> slyi
>
Thank you thats perfect.
i just see any examples on the web for this :o(