|
System.Data.DuplicateNameException: A column named 'rating' already belongs to this DataTable. at System.Data.DataColumnCollection.RegisterName(String name, Object obj)
my code iam getting above exception
DataTable dt=new DataTable();
try
{
foreach(DataGridItem dg in DataGrid1.Items)
{
String Name = dg.Cells[0].Text;
DataRow dr;
DataColumn dc;
dc=new DataColumn("rating");
dt.Columns.Add(dc);
dr=dt.NewRow();
dr[0]=Name;
dt.Rows.Add(dr);
DataGrid2.DataSource=dt;
DataGrid2.DataBind();
}
}
catch(Exception ex)
{
Response.Write(ex.ToString());
}
finally
{
conn.Close();
}
|
|
|
|
|
That is because you are trying to add more than one column with the same name.
What is it that you are trying to do?
---
b { font-weight: normal; }
|
|
|
|
|
As Guffy said, a column named 'rating' is already part of your DataTable, and then in your code
dc=new DataColumn("rating");
dt.Columns.Add(dc);
You are adding the same column again to the data table, ofcourse it'll complain.
Good luck
sam
|
|
|
|
|
Hi friends
I have two dropdown list and one check box
both dropdown have same records
when i select item in dropdownlist and then i check checkbox,on checkbox event i want to get same selected item in other dropdowlist.
my code is
DD2.Items(DD2.SelectedIndex).Text = Me.DD1.SelectedItem.Text
Pathan
|
|
|
|
|
<br />
DD2.Items.FindByText(DD1.SelectedItem.Text).Selected = True<br />
|
|
|
|
|
Hi
I want to do it in javascript.
Thanks 4 ur reply
pathan
|
|
|
|
|
try this
var DD1List = document.getElementById('DD1');
var DD2List = document.getElementById('DD2');
var index = DD1.selectedIndex;
DD2.options[index].selected=true;
|
|
|
|
|
Hi rashida
Thanks for ur reply
its work fine
now i want to remove that item when i uncheck checkbox and selected index should be -1 of 2nd dropdownlist.
Pathan
|
|
|
|
|
Hi friends
I want to get value from one textbox to other textbox on oncheckchange event of check box.
i write this script
function getval()
{
if(document.getElementById('CHCK').checked==true)
document.getElementById('TB_2').value=document.getElementById('TB_1').value;
else
document.getElementById('TB_2').value="";
}
CHCK.Attributes.Add("OnCheckedChanged", "return getval();")
But I got no result.
PaTHaN
|
|
|
|
|
replace this
CHCK.Attributes.Add("OnCheckedChanged", "return getval();")
by
CHCK.Attributes.Add("onclick", "return getval();")
Regards
Shajeel
|
|
|
|
|
Dear Concerned,
I want to create a property in my user control which i am creating in Web Control Library. I am using .Net 2003.
My question is that how I can create a property that will contain a dropdown list & will have five values 1,2,3,4,5.
The Programmer will be able to select one of these values at design time in his aspx page.
Please help in the form of code.
Thanks,
Fasih
fasih_is_my_signature
|
|
|
|
|
Not sure what exactly you are looking for, but it sounds like you need to know how to populate a drop down list.
ddl.Items.Insert(0, "--Select--");
ddl.Items.Insert(1, "Value 1 or whatever");
This is how you hard code the values to be displayed, if you want to load 'em dynamically, then use a dataset or something as a datasourse for this drop down list. Look at the code below:
ddl.DataSource = ds;
ddl.DataTextField = "Columns_Name";
ddl.DataValueField = "Column_Name"; // note this won't be diaplayed
ddl.DataBind();
*NOTE : ddl = drop down list
Hope this helps.
sam
Eating, drinking and coding...you can't have it better than that!!
|
|
|
|
|
Hi all i bulding app
i get image but i want it to System.Drawing.Image
System.Drawing.Image b = System.Drawing.Image.FromStream(objstream);
b.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif);
|
|
|
|
|
Ok... did you have a question also?
---
b { font-weight: normal; }
|
|
|
|
|
Yep, You got a image and ...
keep Learning and you never will be out of date...
|
|
|
|
|
I get a Image by WebService
i use method
System.Drawing.Image b = System.Drawing.Image.FromStream(objstream);
b.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif);
but Response.OutputStream show is binray i want get to System.Web.UI.WebControls.Image
|
|
|
|
|
Hi,
I have code that fires a stored procedure, to insert a new location.
I now need to add another insert, that inserts a destination into another table, using a trigger.
I pass the following variable to my location table : @LocationCode
I want to create a trigger, that everytime an INSERT is fired on the Location table, it should add a row to my Destination table.
Here is what I have to create the trigger:
<br />
<br />
CREATE TRIGGER DestInsert ON [Location]<br />
FOR INSERT<br />
AS<br />
<br />
INSERT INTO Destination<br />
(LocationCode, Destination, AreaCode, DeletedFlag)<br />
VALUES (@LocationCode, 'New', '123C', 0) <br />
<br />
Will this create a trigger for me, that adds the same @LocationCode variable I added for the stored Procedure to the trigger?
|
|
|
|
|
use..
Inserted.Locationcode
it will fetch the location code from inserted location
enjoy
Dinesh Sharma
|
|
|
|
|
DineshSharma wrote: Inserted.Locationcode
Thanks, just one more thing.
Is Inserted a DB function, or does it gets the last LocationCode inserted?
|
|
|
|
|
It's a table that contains all the rows that were inserted when the trigger was fired.
|
|
|
|
|
Hey hi,
I want to extract a date from oracle dbase and set the calendar date acording to the date that i got from database. but i m not able to do that.pls help.
There's never a Wronge Time To Do The Right Thing !!
|
|
|
|
|
Use this ....enjoy
MSCal.SelectedDate = YourDate;
Dinesh Sharma
Team Leader (Software Development)
|
|
|
|
|
hi,
Thanks for reply...
i tried that solution already but its not working..
//////////////////
instdate = DateTime.Parse(instdate).Date.ToString("MM/dd/yyyy");
calInstDate.SelectedDate = DateTime.Parse(instdate);
//////////////////
this is the code that i m trying...but not working..
There's never a Wronge Time To Do The Right Thing !!
|
|
|
|
|
replace
calInstDate.SelectedDate = DateTime.Parse(instdate);
by
calInstDate.SelectedDate = DateTime.Parse(instdate).Date;
and also use
calInstDate.VisibleDate = DateTime.Parse(instdate);
to show selected date if required.
Regards
Shajeel
|
|
|
|
|
I need ur help in following two situation, if u any idea then let me know.
1) I want refresh partial web page of ASP.NET application. Ex. I put RSS of NSE/BSE graph in web page which can updated frequently.
2) I want Excel sheet print with their formulas not only data. Ex. I take print of marksheet but also want formula during print which is used for calculating percentage or total.
Is there any possible way then let me know, i wait for ur favourable reply.
Thanks in advance.
|
|
|
|