|
how can i do the paging in Datalist control.tel me some useful links .
Chohan
|
|
|
|
|
hi there:
Hope this link a href="http://www.dotnetjohn.com/articles.aspx?articleid=48" target="_blank" title="New Window">datalist paging might help you...
<< >>
|
|
|
|
|
in my project i wan to check whether number was pressed or not if number was not pressed it has to tell enter number only
|
|
|
|
|
([0-9]*)
use this regular expression in validationexpression property of the validator control
Chohan
|
|
|
|
|
i use crystalreport10 in my site.
i want to show a html file content with ole component in my rpt file.
but it does not show that.
or
i make a word document from the html file. and then insert it to my crystal report as ole component. but just the first page of the word file will be shown. i want the whole of the file to be shown.
what should i do. please describe me step by step if its possible.
Thanks
Rastgar
|
|
|
|
|
Hi
I am trying to read event logs of windows thru WMI (By using Select query). And it is working fine on development env. But as i move to production site, it is very slow as like tortoise and reason is "In production i have million of windows events"....
If someone can advice me the best practice pattern to handle this situation....
I am reading all windows events thru WMI and storing them in datareader and then binding datareader to repeater control....
Thnx
Amit
|
|
|
|
|
I am trying to develop an intranet site and using App_Code built in folder to place my Business classes etc. I am getting below issues under below listed scenario:
a) In App_Code folder i have two Folders
1) BL contains class1.vb (having methods say A,B,C)
2) UT contain class2.vb (having methods say D,E,F)
b) In Class1.vb i have written something like
Dim objclass as new class2
objclass.E
Now I am having two problems
Problem 1
1) No intelligence is coming, please note i added below section in web.config file
<compilation debug="true">
<codesubdirectories>
<add directoryname="BL">
<add directoryname="UT">
Problem 2
2) I can't use method of class2 in class1 ??????
Amit Gugnani
|
|
|
|
|
Web config details are as belpw
<compilation debug="true">
<codeSubDirectories>
<add directoryName="BL"/>
<add directoryName="UT"/>
</codeSubDirectories>
</compilation>
Amit Gugnani
|
|
|
|
|
Hi Guys
Please reply.
Thx
Amit
|
|
|
|
|
I wonder no one in this world can help me
|
|
|
|
|
How can i display an underline only, only on a onmouseover event through javascript under a hyperlink. I even tried doing through css but didn't find working.
Helloworld
|
|
|
|
|
hi,
try this code:
step1 : copy and paste the following style script in the head of your page
Step2: For a text link, just include a class="styleName" in the
href tag like this...
a class="Mover" href="http://codeproject.com"> Try Me <end of="" the="" href="" tag="">
note: add the href tag begin " < " and place /a in the end of the href tag
that's it. hope this will work for u.
Thanks,
Rahi
If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Hi,
I have a simple problem. All I need is a simple program that provides only tableName from Northwind Database.
What SQL Query should I write.
In the following code, I get DataSet object by providing sqlSatement and tableName. I need to get a new tableName from
Northwind database at every iteration and pass the tableName to this method.
/****************************************/
private DataSet ReturnDataSet(tableName)
{
DataSet dataSet = null;
string sqlStatement = "select * from " + tableName;
try
{
using (SqlConnection sqlConnection = new SqlConnection(connectionInfo))
using (SqlCommand sqlCommand = new SqlCommand(sqlStatement, sqlConnection))
{
SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand);
dataSet = new DataSet();
sqlDataAdapter.Fill(dataSet, tableName);
}
}
catch
{
//Log the exception.
}
return dataSet;
}//End ReturnDataSet
Sanjeev
|
|
|
|
|
Please don't cross post.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Sanjeev
Please bear with me if i am wrong. As per my understanding after reading your question, you need to know table names from database...
Select name from sysobjects where type='U'
If my understanding is incoorect, please post ur query again....Good luck
Thx
Amit Gugnani
|
|
|
|
|
does anyone knows how can i leave everyother row in a gridview empty and be able to bind a label to it
javierarka
|
|
|
|
|
Hello
I need an answer for my question.
Imagine a html table. When you loop through the last column of the table that column needs to be display in a row alone immediately after the row that shows all the other information for that id is bind.
It is possible to do this in a grid view
If you need something else to clarify this let me know
Thanks
Javierarka
|
|
|
|
|
You need a totals row or something like that ? You need to either add it to yuor data source as a row, or put in a seperate grid to display it.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
OR.....
Add an item bind event handler to the grid, check for a footer row and then do your calculations and add to the footer row as labels
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
I’m developing a web application that uses SQL Server 2005 as its database.
In the SQL database I have two tables that have identical structures. The only difference in them is data contained in them. One holds Company Titles. The other one holds Department names used in the company.
The table schemas are:
tblTitle
TitleID Numeric Identity
Title VarChar(50)
Deleted Bit
tblDepartments
DeptID Numeric Identity
Department VarChar(25)
Deleted Bit
On my web application I have two identical web forms. The form I use for Departments has a SqlDataSource Control on it. The Page Load event is:
Protected Sub Page_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles Me.Load
Dim strSelectSQL = "SELECT [Department], [DeptID] FROM tblDepartments WHERE [Deleted] = 0;"
SqlDataSource.ConnectionString = MRMFunctions.WebConfigConnString
SqlDataSource.SelectCommand = strSelectSQL
ListBox1.DataSourceID = DtaSource.ID.ToString
ListBox1.DataTextField() = "Department"
ListBox1.DataValueField() = "DeptID"
End Sub
The code is pretty straight forward.
1. Assign the SQL string to a variable.
2. Get the connection string from the web.config file.
3. Set the SqlDataSource control to the SQL string.
4. Bind the Listbox control to the SqlDataSource control.
5. Assign the ListBox.DataTextField to the “Department” field in the tblDepartments table.
6. Assign the ListBox.DataValueField to the “DeptID” field in the tblDepartments table.
When I select a Department from the list box and press the edit button it fires the ListBox1_SelectedIndexChanged event. The code is:
Protected Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
strID = ListBox1.SelectedValue
strName = ListBox1.SelectedItem.Text
txtID.Text = strID
txtName.Text = strName
End Sub
This code is straight forward as well. Take the ListBox.SelectedValue and place it in the strID variable. Take the Listbox.SelectedItem.Text and place it in the strName variable. Assign the txtID.Text box to strID and txtName.Text to strName.
When I step through the code the strID will contain the ID number of the selected item and the strName will contain the name of the department.
Now for the problem:
I’m trying to accomplish the same thing, but without having to place the SqlDataSource Control on the web form. This form is for company titles, and its Page_Load event is:
Protected Sub Page_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles Me.Load
Dim dr As SqlDataReader
Dim cn As New SqlConnection
Dim cd As New SqlCommand
cn.ConnectionString = MRMFunctions.WebConfigConnString
cd.Connection = cn
cn.Open()
Dim strSelectSQL = "SELECT [TitleID], [Title] FROM tblTitles WHERE [Deleted] = 0;"
cd.CommandText = strSelectSQL
dr = cd.ExecuteReader
While (dr.Read)
ListBox1.DataTextField = dr("Title")
ListBox1.DataValueField = dr("TitleID")
ListBox1.Items.Add(dr("Title"))
End While
cn.Close()
End Sub
What I’m doing here is declaring a SQL data reader, a SQL Connection and a SQL Command.
1. I set the connection string by reading it from the Web.Config file.
2. I make the connection.
3. I open the connection.
4. I set the variable strSelectSQL equal to the select statement I’m using to return my data with.
5. I set the SqlCommand command text equal to the strSelectSQL variable.
6. I execute the datareader to get the data out of the database.
7. I loop through the data and assign the ListBox.DataTextField to the “Title” field inside the datareader, the Listbox.DataValueField to the “TitleID” field inside the datareader, and add the “Title” to the listbox.
Logically this should be the same as the Page_Load event in the Departments page, but it isn’t.
When I select a Title from the ListBox and press the edit button the ListBox1_SelectedIndexChanged event operates diffently. The code is simular to the ListBox1_SelectedIndexChanged event in the Departments form, but instead of the strID variable returning the ID number of the title selected. I get the Title name. The strName gets assigned the Title name like it should, but there is no ID number for it.
The only explanation I can come up with is the DataTextField and DataValueField behave differently when using a SqlDataSource control compaired to a datareader.
Can someone please tell me what I’m doing wrong?
I have a form that requires five data sources and I would rather only have to hit the database once to populate the controls and the again to update the database.
Thank you,
Quecumber256
|
|
|
|
|
The DataTextField and DataValueField are not used at all when you are not databinding. What you are doing in the code is adding strings to the Items collection. The overload of the Add method that takes a string creates a ListItem object for you with the same string for text and value. That is why you are gettings the title as value.
What you should do is to create a ListItem from the Title and TitleID values and add to the Items collection.
Also, you have forgotten to close the data reader when you are done with it.
Quecumber256 wrote: and assign the ListBox.DataTextField to the “Title” field inside the datareader, the Listbox.DataValueField to the “TitleID” field inside the datareader
No, you are not. You are setting the DataTextField to the value of Title field and setting the DataValueField to the value of the TitleID field. The reason that this does not result in an error, is that the properties are not used at all.
---
Year happy = new Year(2007);
|
|
|
|
|
Guffa wrote: What you should do is to create a ListItem from the Title and TitleID values and add to the Items collection.
Can you show me an example of how to do this? I know I can concatenate the two fields together and place it in the list. However, I would like to just show the names in the list and have the ID number retrieved from something like the DataValueField.
Another Question:
Can I bind the ListBox control to the DataReader?
Example: ListBox1.DataSourceID = dr
Thank you,
Quecumber256
|
|
|
|
|
Quecumber256 wrote: Can you show me an example of how to do this?
Sure.
ListBox1.Items.Add(new ListItem(dr.GetString("Title"), dr.GetString("TitleID")))
---
Year happy = new Year(2007);
|
|
|
|
|
//Try this
Protected Sub Page_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles Me.Load
Dim dr As SqlDataReader
Dim cn As New SqlConnection
Dim cd As New SqlCommand
cn.ConnectionString = MRMFunctions.WebConfigConnString
cd.Connection = cn
Dim strSelectSQL = "SELECT [TitleID], [Title] FROM tblTitles WHERE [Deleted] = 0;"
cd.CommandText = strSelectSQL
ListBox1.DataTextField = dr("Title")
ListBox1.DataValueField = dr("TitleID")
cn.open
dr = cd.ExecuteReader
ListBox1.datasource = dr
ListBox1.databind
cn.Close()
End Sub
|
|
|
|
|
This sounded like a good idea, so I gave it a try. Unfortunately it didn't work. All it put in the list box was 17 "System.Data.Common.DbDataRecord". Exactly the number of titles I have stored in the DB.
I even modified the procedure a bit more like so:
Protected Sub Page_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles Me.Load
Dim dr As SqlDataReader
Dim cn As New SqlConnection
Dim cd As New SqlCommand
cn.ConnectionString = MRMFunctions.WebConfigConnString
cd.Connection = cn
cn.Open()
Dim strSelectSQL = "SELECT [TitleID], [Title] FROM tblTitles WHERE [Deleted] = 0;"
cd.CommandText = strSelectSQL
dr = cd.ExecuteReader
ListBox1.DataSource = dr
ListBox1.DataBind()
ListBox1.DataTextField = "Title"
ListBox1.DataValueField = "TitleID"
cn.Close()
dr.Close()
End Sub
It returned the same results.
Quecumber256
|
|
|
|