|
hi nav,
yes you are partially right. actually the problem arises when the datareader has null values.Isnt it? Other wise do u think that the following code is incorrect.
txtName.text=reader("Name")
whats ur opinion?
Tirtha
Live life to the fullest
|
|
|
|
|
completley agree with you its ok if we not getting any null values. and we can set a check for null as wel. but if we look at the question its not binding its jus a way to getting and setting a value to textbox.
regards
Nav.
|
|
|
|
|
hi nav,
Ok Ok.agree with u. now its settled.
Tirtha
The best prophet of the future is the past
Live life to the fullest
|
|
|
|
|
thats like a good boy.
take care
Nav.
|
|
|
|
|
I want to use DataViewManager to bind data to a datagrid in Asp.Net. How is this possible?
|
|
|
|
|
first create a datatable
DataTable dt = new DataTable("TestDT");<br />
dt.Columns.Add("ID");<br />
dt.Columns.Add("NAME");<br />
for(int n=1; n<3; n++)<br />
{<br />
DataRow dr = dt.NewRow();<br />
dr["ID"] = n.ToString();<br />
dr["NAME"] = n.ToString() + n.ToString();<br />
dt.Rows.Add(dr);<br />
}
then add datatable to Dataset
DataSet ds = new DataSet("TestDS");<br />
ds.Tables.Add(dt);
Create dataviewmanager
DataViewManager dvm = new DataViewManager(ds);
bind it to datagrid
dataGrid1.DataSource = dvm;
and finish
Nav.
|
|
|
|
|
i tried it old boy.
its not working.
for vb it is ok coz when we give datagrid.setdatabindings it is working.
but for asp it is not working. i mean the datagrid.datasource is not binding it.
love,
lav
|
|
|
|
|
hi,
i m having a javascript function in my aspx.cs file as
// To pop up confirmation box for dissociation
function confirmdissociation ()
{
if (confirm("Are you sure to perform this action?")==true)
return true;
else
return false;
}
In code behind , i have
bool getresult;
Button1.Attributes("script","return confirmdissociation();");
I want to store the result retured from this in a bool variable getresult (declared in code behind)
Please help
sandeep
|
|
|
|
|
You can try something like this:
Javascript Code:
<script language="javascript" type="text/javascript">
function confirmdissociation ()
{
//alert("In Code");
if (confirm("Are you sure to perform this action?")==true)
{
document.getElementById("TextBox1").innerText ="true";
return true;
}
else
{
document.getElementById("TextBox1").innerText ="false";
return false;
}
}
</script>
In Code Behind:
private void Page_Load(object sender, System.EventArgs e)
{
Button1.Attributes.Add("onclick", "confirmdissociation();");
}
--Dimple
|
|
|
|
|
Greetings!
I've got a slight problem with an ObjectDataSource i'd like to get your input on.
I've got an ASP.NET website created with two added references: A data access layer, and a buisness logic layer. The DLL's are both located in the BIN folder of the website.
The BLL classes are outfitted with the [System.ComponentModel.DataObject] and should be visible from the DataObjectSource's datasouce dropdown. However, they're not. I noticed something rather odd: I had only 1 page defined (default.aspx), and when i tried to define a data source for the ObjectDataSource, no classes were available what so ever. I then added a class to the "App_Code" folder and tried again. This time it cought on to all my TableAdapters and their underlying classes in the DAL.
It still refuses to include any of the BLL classes.
Can anyone shed light on the situation?
Thank you in advance.
- Martin Kjeldsen
|
|
|
|
|
Hi there,
Do you see the business classes listed in the combox if you uncheck the checkbox "Show only data components" in the Configuration DataSource dialog box?
|
|
|
|
|
hi
If i check "show only data components" i get a list of the table adapters available from my DAL dll. If i uncheck it, i get a list of all the classes related to my defined DataSet (Table, Row, etc). But there is no sign of the BLL classes, even tho it exists as a reference in the "BIN" folder. It puzzles me.
I even tried to copy one of the classes from my BLL dll directly into the APP_CODE folder, but the ObjectDataSource still won't recognize it, no matter if i check or uncheck "show only.."
Thanks for your input!
- Martin
-- modified at 5:23 Thursday 6th July, 2006
|
|
|
|
|
May I see the signature of one of the BLL classes?
|
|
|
|
|
Hi again, Here's one of the BLL test classes i'm using.
using System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
using DALTest.EmployeesDataSetTableAdapters;<br />
using DALTest;<br />
<br />
namespace BLL<br />
{<br />
[System.ComponentModel.DataObject]<br />
class EmployeesBLL<br />
{<br />
private EmployeesTableAdapter _employeesAdapter = null;<br />
<br />
protected EmployeesTableAdapter Adapter<br />
{<br />
get<br />
{<br />
if (_employeesAdapter == null)<br />
_employeesAdapter = new EmployeesTableAdapter();<br />
<br />
return _employeesAdapter;<br />
}<br />
}<br />
<br />
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select,true)]<br />
public DALTest.EmployeesDataSet.EmployeesDataTable GetEmployee(int employeeId)<br />
{<br />
return Adapter.GetData(employeeId);<br />
}<br />
<br />
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select,false)]<br />
public DALTest.EmployeesDataSet.EmployeesDataTable GetEmployeesByCountry(string country)<br />
{<br />
return Adapter.GetDataByCountry(country);<br />
}<br />
<br />
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Insert, true)]<br />
public bool AddEmployee(string employeeName)<br />
{<br />
DALTest.EmployeesDataSet.EmployeesDataTable employees = new DALTest.EmployeesDataSet.EmployeesDataTable();<br />
DALTest.EmployeesDataSet.EmployeesRow employee = employees.NewEmployeesRow();<br />
employee.FirstName = employeeName;<br />
employee.LastName = employeeName;<br />
employees.AddEmployeesRow(employee);<br />
int rowsAffected = Adapter.Update(employee);<br />
return rowsAffected == 1;<br />
}<br />
<br />
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Delete, true)]<br />
public bool DeleteEmployee(int employeeId)<br />
{<br />
int rowsAffected = Adapter.Delete(employeeId, new DateTime());<br />
return rowsAffected == 1;<br />
}<br />
<br />
}<br />
}
|
|
|
|
|
zrrbite wrote: class EmployeesBLL
Here's the culprit, the class needs to be declared as public .
|
|
|
|
|
Wow, what a horrible mistake. I feel stupid
Thanks alot.
|
|
|
|
|
zrrbite wrote: I feel stupid :
Not at all , it's because of VS as it by default generates the class template with the default access modifier, and I guess you simply use it.
|
|
|
|
|
I want to build a treeview in javascripting. Can anyone please
give me some links or coding for this.
thanks in advance.
|
|
|
|
|
See if this helps
http://www.codeproject.com/jscript/tree_view.asp
|
|
|
|
|
How can i write Client Scripting like JAVASCRIPT in ASP.NET 2.0 Using C#.
|
|
|
|
|
If u ask me there is no need to write in javascript. u just use the code behind.
if u still want to use javascript i think there is some way in the code behind file itself.
u can also include javascript just like u did for normal asp pages. using the <%%> and script tags.
i am not sure abt this. coz i have never used it.
|
|
|
|
|
lavanya_satheesh wrote: If u ask me there is no need to write in javascript. u just use the code behind.
Who's a clever boy then - that's quite a trick....how are you doing AJAX?
lavanya_satheesh wrote: if u still want to use javascript i think there is some way in the code behind file itself.
Kinda - Page.RegisterStartupScript allows you to code the js as text in the codebehind, then squirts it at the page
lavanya_satheesh wrote: u can also include javascript just like u did for normal asp pages. using the <%%> and script tags.
Except that <%%> will cause it to runat server.
To add some client side js, just add :
<br />
<script language="javascript" type="text/javascript"><br />
code goes here<br />
</script><br />
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
how to make chat using asp.net
|
|
|
|
|
you can make a Vypress or MSN like chat easily using Windows based form in ASP.Net. There are some good sites that have some source code for download. Search the google.
|
|
|
|
|
Try any of these 3 code. Probably this may help u resolve ur problem
stringVariable = dataGridView.Rows[index].Cells[index].Value.toString();
stringVariable = dataGridView.Rows[index].Cells["ColumnName"].Value.toString();
stringVariable = dataGridView.CurrentRow.Cells[index].Value.toString();
Vipin
|
|
|
|