Click here to Skip to main content
15,565,709 members

Comments by ganesh.dks (Top 12 by date)

ganesh.dks 13-Aug-15 4:50am View    
Considering these lines:-
Employee employee1 = new Employee();
Person person1 = employee1;
Console.WriteLine("person1 name:{0}",;
Person person2 = new Employee();
// Allowed because person1 is actually an Employee.
Employee employee2 = (Employee)person1;
If I write person.Designation in the WriteLine statement it throws a compile time error. But again when I reassign the person1 to Employee object (employee2) the employee2 can be used to access Designation. Now when I assigned the employee1 to person1 what happens to the Designation field. Because in the first WriteLine I could never access Designation using person1(naturally) because it is person. But then what happens to the Designation field which appears back when I assign employee2 with person1(casted). Hope you understand what I intend to say.

Say I had Data in the employee object which I assigned to person1, will that be persistent when I use person1 in the 5th statement. Will this be a good technique in any manner in software development practice?
ganesh.dks 1-Dec-14 3:47am View    
The final section is creating problems.

FileInfo file = new FileInfo(oXL.ActiveWorkbook.FullName);
oWB.SaveAs(oSheet.Name + ".xls", Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookDefault,
Missing.Value, Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value);
HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=" + oSheet.Name + ".xls");
HttpContext.Current.Response.AddHeader("Content-Type", "application/Excel");
HttpContext.Current.Response.ContentType = "application/";
HttpContext.Current.Response.AddHeader("Content-Length", file.Length.ToString());
ganesh.dks 30-Jun-14 23:27pm View    
I am using a server control to fetch and show data from db, so the Relevant Html contains
<div id="CopyMyGrid">
<div id="PivotGridDiv">
<PivotGrid id="pv" ........ atributes>
Rendered as HTML Table (ctl00_ContentPlaceHolder1_ASPxPivotGrid1_HZST)


Please don't get annoyed as I have not given the complete code but it contains a lot of elements which are rendered as the given HTML table. The only element I cannot show in the html is the "pivotGrid_PagerClick('ctl00_ContentPlaceHolder1_ASPxPivotGrid1', this, 'PBN');" because it is generated dynamically. Its a next button which fetches the next set of records.
So what I am trying to do is click the next button programmatically and then load those records into the new COpMyGrid div on scroll. This is inevitable because the control does some inherent data manipulation and the desired output is only obtained from it.

I need to bind the JQuery events on callbacks or partial postbacks but to the div again. It is not showing any error but nothing happens even when I scroll. One more issue is to know whether I can bind the scroll to a div which has the control behind my current div and get the data from it and load it to the div in front.
ganesh.dks 8-Jun-14 12:56pm View    
I Tried using this,

delete from UserRole where RoleID = @RoleID AND UserID IN (Select UserID from UserRole)
INSERT INTO UserRole(UserID, RoleId) SELECT id, @RoleID FROM dbo.CSVToTable(@UserID)

This once did what I wanted but also threw this error later.

Msg 217, Level 16, State 1, Procedure AssignRoleToUser, Line 7
Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32).

Its a simple procedure and I am unable to get right. I don't know perhaps I have forgotten everything.
ganesh.dks 8-Jun-14 12:47pm View    
Sorry but I am unable to comprehend.
According to the code you gave me it will delete all the users(specified in the list) with the given role. But if we are assigning a new role there isn't any need to delete because there are no such users assigned to the role.

And again if a user has a role already, and I intend to change his role , I am not fetching such an ID from the frontend because there is no support for unchecked event in the treeview I am using. The page would simple iterate and get the selected list only.

With these selected list I generate the ID list from the underlying DataSet. Now in your query the old role will still be there for a user even though the user intends to revoke his role by unchecking the user checkbox. Where as what I want is to delete all users with the given role everytime and insert or assign the role to the specified users list. Which is why I wanted to delete the whole set of users who had this role already. Kindly help me do this. And a lot many thanks for patiently answering my queries.