Closed Thread Icon

Topic awaiting preservation: ASP.NET multiline boundcolumn? (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12125" title="Pages that link to Topic awaiting preservation: ASP.NET multiline boundcolumn? (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: ASP.NET multiline boundcolumn? <span class="small">(Page 1 of 1)</span>\

 
Lurch
Paranoid (IV) Inmate

From: Behind the Wheel
Insane since: Jan 2002

posted posted 03-19-2002 09:52

quick one for ya...

Is there a way to make a boundcolumn multiline for editing in ASP.NET?

Thanks

--Lurch--

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 03-19-2002 20:03

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 03-19-2002 20:32

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Lurch
Paranoid (IV) Inmate

From: Behind the Wheel
Insane since: Jan 2002

posted posted 03-19-2002 21:13

sorry... what I need is this..

I've got something set up to edit entries in a db by using the boundcolumn... I can press an edit link that allows me to edit any of the boundcolumn columns. The only way I can seem to get it to do it is with a single line textbox kinda like <input type=text... in html... What i want is to have it like <textarea... in html. Sorry, I'm just starting with ASP.NET and not to clear on all the ways of doing this sort of stuff...

I'm having a hard time with ASP.NET because I'm always thinking "arghhh.... PHP lets me do this so much more freely and easily!", but I've gotta learn it and I'm beginning to like it a bit more every day...

--Lurch--

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 03-19-2002 22:02

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 03-19-2002 22:21

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Lurch
Paranoid (IV) Inmate

From: Behind the Wheel
Insane since: Jan 2002

posted posted 03-20-2002 02:54

ok, here is the ENTIRE code... I know its not needed, but will give a better idea of what I'm doing here...

code:
<%@ Page Language="VB" Debug="true" %>
<%@ Import NameSpace="System.Data" %>
<%@ Import NameSpace="System.Data.oledb" %>

<script runat="server">
'declare connection
dim Conn as new OleDbConnection( _
"Provider=Microsoft.jet.OleDb.4.0;" & _
"Data Source=d:\asp\blog\blog.mdb")

sub Page_Load(obj as Object, e as EventArgs)
if Not Page.IsPostBack then
FillDataGrid()
end if
end sub

sub Submit(obj as object, e as EventArgs)
'insert new data
dim i, j as integer
dim params(4) as String
dim strText as string
dim blnGo as boolean = true

j = 0

for i = 0 to AddPanel.Controls.Count - 1
if AddPanel.controls(i).GetType Is _
GetType(TextBox) then
strText = Ctype(AddPanel.Controls(i), _
TextBox).Text
if strText <> "" Then
params(j) = strText
else
blnGo = false
lblMessage.Text = lblMessage.Text & _
"You Forgot to Enter a Value For " & _
AddPanel.controls(i).ID & "<p>"
lblMessage.Style("ForeColor") = "Red"
end if
j = j + 1
end if
next

if not blnGo Then
exit Sub
end if

dim strSQL as String = "INSERT INTO blog " & _
"(Title, Entry, Date, Modified) " & _
"VALUES (" & _
"'" & params(0) & "'," & _
"'" & params(1) & "'," & _
"'" & params(2) & "'," & _
"'" & params(3) & "')"

ExecuteStatement(strSQL)

FillDataGrid()
end sub

sub dgData_Edit(obj as object, e as DataGridCommandEventArgs)
FillDataGrid(e.Item.ItemIndex)
end sub

sub dgData_Delete(obj as object, e as DataGridCommandEventArgs)
dim strSQL as string = "DELETE FROM blog " & _
"WHERE id = " & e.Item.ItemIndex + 1

ExecuteStatement(strSQL)
end sub

sub dgData_Update(obj as object, e as DataGridCommandEventArgs)
if UpdateDataStore(e) then
FillDataGrid(-1)
end if
end sub

sub dgData_Cancel(obj as object, e as DataGridCommandEventArgs)
FillDataGrid(-1)
end sub

sub dgData_PageIndexChanged(obj as object, e as DataGridPageChangedEventArgs)
dgData.DataBind()
end sub

function UpdateDataStore(e as DataGridCommandEventArgs) as boolean

dim i,j as integer
dim params(4) as string
dim strText as string
dim blnGo as boolean = true

j = 0

for i = 1 to e.Item.Cells.Count - 3
strText = Ctype(e.Item.Cells(i).Controls(0), _
Textbox).Text
if strText <> "" Then
params(j) = strText
j = j + 1
else
blnGo = false
lblMessage.Text = lblMessage.Text & _
"You forgot to enter a value<p>"
end if
next

if not blnGo then
Return false
exit function
end if

dim strSQL as string = "UPDATE blog SET " & _
"Title = '" & params(0) & "'," & _
"Entry = '" & params(1) & "'," & _
"Date = '" & params(2) & "'," & _
"Modified = '" & params(3) & "'" & _
" WHERE UserID = " & CType(e.Item.Cells(0). _
Controls(1), Label).text

ExecuteStatement(strSQL)
return blnGo
end function

sub FillDataGrid(Optional EditIndex as integer=-1)
'open connection
dim objCmd as new OleDbCommand _
("select * from blog", Conn)
dim objReader as OleDbDataReader

try
objCmd.Connection.Open()
objReader = objCmd.ExecuteReader()
catch ex as Exception
lblMessage.Text = "Error retrieving from the database"
end try

dgData.DataSource = objReader
if not EditIndex.Equals(Nothing) then
dgData.EditItemIndex = EditIndex
end if

dgData.DataBind()

objReader.Close
objCmd.Connection.Close()

end sub

function ExecuteStatement(strSQL)
dim objCmd as new OleDbCommand(strSQL, Conn)

try
objCmd.Connection.Open()
objCmd.ExecuteNonQuery()
catch ex as Exception
lblMessage.Text = "Error Updating the database"
end try

objCmd.Connection.close()
end function
</script>

<html><body>
<asp:Label id="lblMessage" runat="server" />

<form runat="server">
<asp :DataGrid id="dgData" runat="server"
BorderColor="black" Gridlines="Vertical"
Cellpadding="4" cellspacing="0" width="100%"
AutoGenerateColumns="False"
OnDeleteCommand="dgData_Delete"
OnEditCommand="dgData_Edit"
OnCancelCommand="dgData_Cancel"
OnUpdateCommand="dgData_Update"
OnPageIndexChanged="dgData_PageIndexChanged" >

<columns>
<asp:TemplateColumn Headertext="Title">
<ItemTemplate>
<asp:label id="title" runat="server"
Text='<%# Container.DataItem("title") %>' />
</ItemTemplate>
</asp:templatecolumn>

<asp:boundcolumn headertext="entry" DataField="entry"/>
<asp:boundcolumn headertext="date" DataField="date" />
<asp:boundcolumn headertext="modified" DataField="modified" />

<asp:editcommandcolumn editText="Edit" cancelText="Cancel" UpdateText="Update" HeaderText="Edit" />


<asp:buttoncolumn headertext="" text="Delete" Commandname="Delete" />
</columns>
</asp :DataGrid><p>

<asp :panel id="addPanel" runat="server">
<table>
<tr>
<td width="100" valign="top">
Title:
</td>
<td width="300" valign="top">
<asp:textbox id="tbtitle" runat="server"/>
</td>
</tr>
<tr>
<td width="100" valign="top">
Entry:
</td>
<td width="300" valign="top">
<asp:textbox textmode="multiline" id="tbentry" runat="server"/>
</td>
</tr>
<tr>
<td width="100" valign="top">
Date:
</td>
<td width="300" valign="top">
<asp:textbox id="tbdate" runat="server"/>
</td>
</tr>
<tr>
<td width="100" valign="top">
Modified:
</td>
<td width="300" valign="top">
<asp:textbox id="tbmodified" runat="server"/>
</td>
</tr>
<tr>
<td colspan="2" align="right">
<asp:button id="btSubmit" runat="server" text="Add" onClick="Submit"/>
</td>
</tr>
</table>
</asp :panel>
</form>
</body></html>



so it gives me a nice setup with the db columns and rows, and at the end an edit and delete option for each.. when you hit edit for any row, the text in those rows is now shown in an editable textbox... (<input type=text> in the html)... what I want is for the "entry" field to be in a <textarea> text box when in edit mode for the row... get it?

the boundcolumn automatically sets it to a normal textbox as far as I know (which isn't much! ), and I want to be able to edit the large field "entry" with ease.


--Lurch--

[This message has been edited by Lurch (edited 03-20-2002).]

[This message has been edited by Lurch (edited 03-20-2002).]

« BackwardsOnwards »

Show Forum Drop Down Menu