|
I'm creating a customer "comments", multiline textbox and it works fine however when I store these comments in the database, they don't retain any of the formatting the user performed within their comments, such as line breaks.
For example, the following comment...:
"Hello,
How are you?"
...would be stored in the database like this:
"Hello, How are you?"
How can I correct this?
Thanks.
-Goalie35
|
|
|
|
|
The line break is there - if you load it back into a multi-line text box you'll see it just the same as entered in the first place - but to displayt it on a web-page you need to replace all the line breaks with <br> tags... in VB this would be:
supposing your databse field is returned to a string s:
s.Replace(vbCrLf, "<br>")
Can't help you with the C# equivalent, but the carriage-return line-feed characters are Chr(13) adn Chr(10) respectively...
|
|
|
|
|
Hi,
my question is this:
Is it possible to know if my site is running on IIS or on Web Development Server at runtime from code behind?
The only solution that I found is to check the process name, but...
Thanks
|
|
|
|
|
You can check the Response.headers to see if it sis running on IIS or not.and of course its version as well.
In ASP.Net this is available through Response.Headers variable
|
|
|
|
|
var gridViewCtlId = '<%=gridview1.ClientID%>';
var gridViewCtl = null;
var curSelRow = null;
var curRowIdx = -1;
function getGridViewControl()
{
if (null == gridViewCtl)
{
gridViewCtl = document.getElementById(gridViewCtlId);
}
}
function onGridViewRowSelected(rowIdx)
{
var selRow = getSelectedRow(rowIdx);
if (null != selRow)
{
curSelRow = selRow;
var cellValue = getCellValue(rowIdx, 0);
alert(cellValue);
}
}
function getSelectedRow(rowIdx)
{
return getGridRow(rowIdx);
}
function getGridRow(rowIdx)
{
getGridViewControl();
if (null != gridViewCtl)
{
return gridViewCtl.rows[rowIdx];
}
return null;
}
function getGridColumn(rowIdx, colIdx)
{
var gridRow = getGridRow(rowIdx);
if (null != gridRow)
{
return gridRow.cells[colIdx];
}
return null;
}
function getCellValue(rowIdx, colIdx)
{
var gridCell = getGridColumn(rowIdx, colIdx);
if (null != gridCell)
{
alert(gridViewCtlId)
return gridCell.innerText;
}
return null;
}
I i call it as:
For Each row As GridViewRow In GridView1.Rows
CType(row.FindControl("Textbox1"), TextBox).Attributes("onclick") = "javascript: return getCellValue(0,1)"
it works...
But how to pass dynamic value in place of 0 and 1
<div class="ForumSig">sanjay kumar samantaray</div>
|
|
|
|
|
What dynamic values do you want to pass instead of 0 and 1? Please be more specific when phrasing a question.
If the first argument to your javascript function needs to change with each iteration of the loop, get the index of the current row by referencing the RowIndex property of your row object and insert it into your attribute string. For instance:
CType(row.FindControl("Textbox1"), TextBox).Attributes("onclick") = "javascript: return getCellValue(" + row.RowIndex.ToString() + ",1)"
Do something similar if you need to change the column index dynamically.
Paul
|
|
|
|
|
Thanx for your reply.
Now i am getting only the column heading of 2nd column.
how could i display each cell's value of 2nd column.
Dialog box appears without any text.
Thanx .
-- modified at 2:05 Saturday 1st September, 2007
sanjay kumar samantaray
|
|
|
|
|
Have a look at the HTML generated by your page. Are the javascript event handlers being generated correctly?
Paul
|
|
|
|
|
Hi,
I want to retreive the user id of the person who visits the page created by me. Till now I was using the System.Identity.Name method to retreive user id of the person. But this gives me the user id of the person who is logged in the system.It didnt give me any worries since I was using VS in my machine. Now when I try to run the page from IE of other machine it is giving error which says Input string was not in a correct format. I am including the codeline where it is giving error.
txtid.Text = Right(User.Identity.Name, 6)
Dim sconnection As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Mypath\DW\DW.mdb;User ID=Admin; Password="
Dim dbcon As New OleDbConnection(sconnection)
Dim myCommand = New OleDbCommand("Select associate_id from dwbi", dbcon)
Dim dr As OleDbDataReader
dbcon.Open()
dr = myCommand.ExecuteReader()
While (dr.Read())
MsgBox("textid.text")
If dr("associate_id") = txtid.Text Then 'This is where error is pointing
Response.Redirect("Update.aspx")
End If
End While
dr.Close()
dbcon.Close()
End If
End Sub
It is gving the error which says "Input string was not in a correct format"
|
|
|
|
|
I used treeview from Microsoft.Web.UI.WebControls. i used this for displaying groups and subgrousps. By selecting group i need to get the all subnode text in that group in javascript.
please help me
Anand
|
|
|
|
|
Iterate through the child nodes of the selected node.
Paul
|
|
|
|
|
i just used a sample code
var selNode = tree.getTreeNode(tree.selectedNodeIndex);
for(var nodeCount = 0; nodeCount < selNode.getChildren().length; nodeCount++)
{
var chldNode = selNode.getChildren(String(nodeCount));
alert(chldNode[nodeCount].getAttribute('ID'));
alert(chldNode[nodeCount].getAttribute('Text'));
}
in this, alert(chldNode[nodeCount].getAttribute('ID')); is working but alert(chldNode[nodeCount].getAttribute('Text')); is not working. is there any error?..
Anand
|
|
|
|
|
The attribute names are case-sensitive. Try 'text' instead of 'Text'.
Paul
|
|
|
|
|
Hi,
i am newly entered in Datagrid concept...so pls tel how to create the Add,Update,Delete and also with sorting and paging ...so pls i need coding also....so pls make it....
regards
Sundar
|
|
|
|
|
We don`t do spoon feeding here. Why don`t you first read some books.Don`t try to just copy the code, understanding is all that matters.
When you fail to plan, you are planning to fail.
|
|
|
|
|
|
As a starting point you can take a look at my article about sorting: ASP.NET GridView Sort Indicator Component
To add Add, Update, Delete you can extend this sample, the base concepts with GridView - ObjectDataSource stays the same.
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
Hi friends
i want to create a web application which should look like windows application.
Plz let me know what shoul i do?
D.Willington
|
|
|
|
|
What do you mean by "look like windows application"?
Because:
- not all types of usercontrols that are possible within a windows forms application are possible on a web application (FileOpen dialog, FileSave dialog, hierarchical GridViews, multicolumn DropDownLists, ...)
- you will always have the browser window as a host window
- HTML is very limiting in layouting compared to a windows forms/WPF application.
Silverlight might though be an alternative in the near future.
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
A very rich look is achieved through developing an ActiveX Control and bringing it on the webpage. Otherwise, there is a distinct line of demarcation between the web platform and the windows desktop.
|
|
|
|
|
Hi i am displaying in my grid some datas...,
In that i am using button type column...,
Using that pushbutton i am doing update process on that grid...,
Now my question is:
In that grid click edit button its displaying the datas in textbox...,
And i like to show some dats in dropdown so i given this fformat...,
Its not showing the dropdownbox,itsshowing only textbox...,
Plz whats the probs in this one?,
I have attached my code here:
Private Sub dgrdview_UpdateCommand(ByVal source As System.Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgrdview.UpdateCommand
Dim names As System.Web.UI.WebControls.TextBox
names = e.Item.Cells(2).Controls(0)
Dim SkillType As System.Web.UI.WebControls.DropDownList 'mag inserted
SkillType = e.Item.Cells(3).Controls(0)
sqldad = New SqlDataAdapter("SELECT skilltypeid as ids,Skilltype as Name FROM tblmasterSkilltype", sqlconn)
dst = New DataSet
sqldad.Fill(dst, "tblmasterSkilltype")
If dst.Tables(0).Rows.Count > 0 Then
SkillType.DataSource = dst
SkillType.DataTextField = "Name"
SkillType.DataValueField = "IDS"
SkillType.DataBind()
SkillType.Items.Insert(0, "Select One")
Else
SkillType.Items.Insert(0, "Select One")
End If
dst.Dispose()
sqldad.Dispose()
Dim sqlquery As String = "-"
sqlquery = "select count(TempEmpID) from tblMasterTempEmployee where TempEmpID <>" & Val(dgrdview.DataKeys(CInt(e.Item.ItemIndex))) & " and Empname= '" & singletodouble(names.Text) & "' and SkillType='" & Val(SkillType.SelectedItem.Value) & "'"
sqlcmd = New SqlCommand(sqlquery, sqlconn)
sqlcmd.Connection.Open()
If sqlcmd.ExecuteScalar() > 0 Then
lblMessage.Text = "<b>" & singletodouble(names.Text) & " is already exist</b><br>"
sqlcmd.Connection.Close()
sqlcmd.Dispose()
Exit Sub
End If
sqlcmd.Connection.Close()
sqlcmd.Dispose()
sqlquery = "update tblMasterTempEmployee set EmpName= '" & singletodouble(names.Text) & "', SkillType='" & Val(SkillType.SelectedItem.Value) & "' where TempEmpID=" & dgrdview.DataKeys(CInt(e.Item.ItemIndex))
If sqlquery <> "-" Then
sqlcmd = New SqlCommand(sqlquery, sqlconn)
sqlcmd.Connection.Open()
sqlcmd.ExecuteNonQuery()
lblMessage.Text = "<b>Data has been updated Successfully</b><br>"
dgrdview.EditItemIndex = -1
sqlcmd.Connection.Close()
sqlcmd.Dispose()
Gridview()
Else
End If
End Sub
Regards,
Magi
|
|
|
|
|
code is ok.
plz mention u r problem & requirement clearly.
GV Ramana
|
|
|
|
|
See in my grid i am displaying datas..,
And i have push button column in that grid...,
In that while click edit button,i am getting my datas in textbox...,
Instead of textbox display i like to show some field datas in dropdowwnlist...,
So i have created one dropdown box in runtime in update command:
Dim SkillType As System.Web.UI.WebControls.DropDownList
And i fill the dats in that...,
But its not showing there...,
Did u got my probs?,
Regards,
Magi
|
|
|
|
|
check weather column3 type column4 type are same (templatecolumn ) or not. otherwise change the type.
tell me one more thing, when clicking on edit button, u r showing textbox(with data) in 3rd column & dropdownlist(with populated data from Db) in 4th column
is it right?
GV Ramana
|
|
|
|
|
See i have totaly 3 columns only...,
All are boundcolumn...,
First (0)th column only push botton...,
ya while click the edit bitton i am showing the datas in textbox...,
no see in that code i have fill the dropdown list box in code time itself only from the db(select query)...,
Regards,
Magi
|
|
|
|