Showing posts with label template. Show all posts
Showing posts with label template. Show all posts

Wednesday, March 28, 2012

text document into html template

hi,
can any one help me to convert a normal text document into a html template. I have around 50docs need to convert them into html templates and use those templates to generate html reports.
Thanks in advance,,chandras17--
Regarding this...

chandras17 wrote:

...can any one help me to convert a normal text document into a html template...


...it is not quite clear to me what you mean by "html template", but...
...one quick and simple way to display a text document in a browser is to surround the text by pre tags and give the document an "htm" extension...
...for example, suppose the file "Test.txt" contains the following...


This some sample text.
It is in a file.
The file is a plain text file.


...then, to view that file in a browser, one can simply copy the file, rename the copy to "Test.txt.htm", and change the contents to the following...


<pre>
This some sample text.
It is in a file.
The file is a plain text file.
</pre>


...and then load "Test.txt.htm" into a browser.
That is a simple way.
The case shown is simple; you do need to handle special characters. You can see some sample code in my "dirt-simple" code-viewer, (but you will have to download the code and pull it apart because it doesn't exactly fit your requirement), found at...
http://www.WebLogicArts.com/DemoList.aspx
HTH.

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.. :(

Tuesday, March 13, 2012

TextBox and DropDownList in Datagrid Edit mode

Hi,

I am very new to ASP.NET and web programming in general. I have one issue. I have a Datagrid object with Edit template. In one Datagrid row, I have 1 DropdownList, 1 textbox and 1 readonly textbox in Edit mode. I have written OnTextChanged event handler for text box and OnSelectionIndexChanged event handler for dropdownlist. Whenever a text is changed in writable textbox or a selection is changed in DropDownList, I perform calculations and put the result in readonly textbox. I have to tab/click out of TextBox For the OnTextChanged event to be fired. So, when I click on the "dropdown arrow" or DropDownList while editing the TextBox contents, my window goes totally blank. I am calling this DataGrid form from another .aspx page in an IFrame. Can anyone please tell me why my window goes blank ?

Thanks a bunch in advance.I noticed your post went unanswered. Have you resolved this issue?

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"NewToDotNet" <anonymous@.discussions.microsoft.com> wrote in message
news:05F41E15-F336-4F6B-8637-1A18961F61E9@.microsoft.com...
> Hi,
> I am very new to ASP.NET and web programming in general. I have one issue.
I have a Datagrid object with Edit template. In one Datagrid row, I have 1
DropdownList, 1 textbox and 1 readonly textbox in Edit mode. I have written
OnTextChanged event handler for text box and OnSelectionIndexChanged event
handler for dropdownlist. Whenever a text is changed in writable textbox or
a selection is changed in DropDownList, I perform calculations and put the
result in readonly textbox. I have to tab/click out of TextBox For the
OnTextChanged event to be fired. So, when I click on the "dropdown arrow" or
DropDownList while editing the TextBox contents, my window goes totally
blank. I am calling this DataGrid form from another .aspx page in an IFrame.
Can anyone please tell me why my window goes blank ?
> Thanks a bunch in advance.
Hi

Thanks for looking. No, this issue is not resolved. This definitely seems to be a bug in ASP.NET as it happens only if Datagrid page is within a frame. Otherwise it works just fine. Currently I have done a temporary solution of calling the ASP.NET page from asp as window.open instead of in a frame in a Modal dialog box. Let me know if I am missing something

Thank