|
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
|
|
|
|
|
How can I achieved that?
thanks in advance. Much appreciated.
|
|
|
|
|
in the data grid properties make the column as the template column and then add check box inside...
|
|
|
|
|
How should I add the check box with the datagrid.
thanks in advance. Much appreciated.
|
|
|
|
|
here you will get lot of examples on datagrid.
http://www.datagridgirl.com/articles.aspx
Best Regards,
Apurva Kaushal
|
|
|
|
|
Thanks. I recall knowing that website through this forum. You reminded me. I hope I will find something useful.
thanks in advance. Much appreciated.
|
|
|
|
|
use the code i had mentioned earlier. store that value to a string and the u can use that anywhere u want to.
stringVariable = dataGridView.Rows[index].Cells[index].Value.toString();
Here U give the index of the cell thats is if u want the first cell give as 1 or if u want the second then give it as 2 etc etc.
stringVariable = dataGridView.Rows[index].Cells["ColumnName"].Value.toString();
Here U give the name of the column of the grid
Vipin
|
|
|
|
|
My problem earlier was, "how do I select certain column and its data, then pass or transfer it to another page".
Is this method correct? To tell you the truth, its my six week in learning C#.
dataGridView refers to the dgDisplay is it?
thanks in advance. Much appreciated.
|
|
|
|