Web Forms :: PDF Generation - The Method Returns A Byte Value
Feb 19, 2010
I a method that generates a PDF and the method returns a byte value, but after response.end statement, the shows an error that the "File does not begin with '%PDF-' here is the code:
[Code]....
[Code]....
View 2 Replies
Similar Messages:
Apr 27, 2016
This is the query I am running in DB:
select UM.USER_NAME, RM.ROLE_ID, RM.ROLE_NAME
FROM [MICommonDB].[dbo].[ROLE_USER_MAPPING] as RUM
join [MICommonDB].[dbo].[ROLE_MASTER] as RM ON RM.ROLE_ID=RUM.ROLE_ID
join [MICommonDB].[dbo].[USER_MASTER] UM ON UM.USER_ID = RUM.USER_ID
where UM.USER_NAME='useruser'
which is giving me proper result(i.e., 2 records) when running in SQL server.
Now I have created below method in a class with same query (I am calling this method inside Controller):
public IEnumerable<RoleUserDO> getRoleNameByUserName(string userName)
{
IEnumerable<RoleUserDO> strResult = null;
strResult = (from RUM in oDBContext.ROLE_USER_MAPPING
[CODE]..
but it returns only 1 record instead of 2 records(when compared with DB query)
View 1 Replies
May 8, 2010
I am develping an application that integrates with an RFID kit. The problem is, the kit comes with an .cs class that accepts data stored in a byte array however, each information stored in the array respresents an int. I wanted to store String information in each array but, my research suggest that a String itself can be converted to a byte array and not a byte....here the code from the .cs class:
byte BlockNo = 0;
byte[] BlockData = new byte[16];
byte ReturnCode = 0;
[code]....
Each t_b*.text respresents an int. Is there a way I can stored a String in a single byte block?
View 1 Replies
Jan 16, 2011
I've an EntityCollection< T > which contains an element but the Contains method returns false.
I've overriden T's 'Equals' method but the 'Contains' method does not call it (while it's said so in documentation).
When I do foreach (T x in coll), x.Equals(element) returns true.
code:
contains(object entCol, object val)
{
var coll = (ICollection<GraphicSockets>)entCol;
var socket = val as GraphicSockets;
foreach (GraphicSockets sock in coll)
socket.Equals(sock); //true for first element, GraphicSocket's Equals function called
coll.Contains(socket);//false, Equals function not called}
the code i'd actually like to use is
private static bool contains(object entCol, object val)
{
Type entColType = typeof(EntityCollection<>).MakeGenericType(val.GetType());
MethodInfo contains = entColType.GetMethod("Contains");
return (bool)contains.Invoke(entCol, new object[] { val });
}
this worked once but stopped when i started using wcf, i wonder how this contains method works.....
View 2 Replies
Jan 24, 2010
ArrayList lstEndPoints
0 element "0x01"
1 element "0x82"
byte b = (byte)(lstEndPoints[0]); //Error cannot convert
View 7 Replies
Aug 26, 2010
i have two data tables with the same structure
the first one has one row of the second one
the second one has set of rows
what i want is to get the row which comes next to the row of the first data table in the second data table.
the first data table his name is :: temp
the second data table his name is :: dt
i do the following:
DataTable temp = new DataTable();
temp = dt.Clone();
DataColumn[] keyColumn = new DataColumn[1];
keyColumn[0] = temp.Columns["photoId"];
temp.PrimaryKey = keyColumn;
temp = (DataTable)(Session["currentImage"]);
DataRow[] drr = new DataRow[1];
index = dt.Rows.IndexOf(temp.Rows[0]);
but the index always comes with one value = -1
although the temp.rows[0] its contents changed all the time
when i write dt.Rows.IndexOf(dt.Rows[1]) for examble i get 1
but this is not what i want to do ,, what i want to do exactly is to get the datarow next to the datarow of the first dataTable in the second dataTable
View 2 Replies
Feb 19, 2010
had used ajax.method in my project & its working fine, but now Every Ajax.Method returns null now,
View 1 Replies
Mar 11, 2010
I have a ListView control and under ItemTemplate I have following code:
Code:
<asp:Label ID="Label1" runat="server" Text='<% #MatchCategory(dtCategories.Rows[i]["ID"].ToString().Trim(), Eval("CategoryID").ToString()) %>'></asp:Label>
The MatchCategory method just checks if two values are equal and return true or false. Just below this code I am separately printing dtCategories.Rows[i]["ID"].ToString().Trim() and Eval("CategoryID")
acan see matching values but MatchCategory method always returns false.
View 5 Replies
Apr 17, 2010
I'd like to be able to determine what class will be called given an URL. For instance, I have a page /First.aspx that has a hyperlink to /Second.aspx In the code behind for First.aspx.cs, I'd like to be able to determine what class will execute if someone clicks on the hyperlink that points to /Second.aspx.
EDIT: One of the reponders asked me to outline the problem I'm trying to address. Here it is: The codebase I inherited has a subclass the System.Web.UI.Page that has a public Authorized method that returns a boolean. The Authorized method checks the parameters passed via the query string against the authenticated user, and determines whether that user should be allowed to call that page with the given parameters.
Elsewhere in the site I have hyperlinks that reference those protected pages. In some instances those links are displayed to users who are not authorized to navigate to that page. They can click the link, however they get an error. In other instances, prior developers when through the trouble of inserting logic that hides the hyperlink for those unauthorized users, but the authorization logic is duplicated (In the page itself, and in the linking page). What I would like to do is create a subclass of the hyperlink class, and have the subclass inspect the NavigateUrl, determine the destination page class, and call the Authorized method of that class to determine if the user is authorized to call that page. If the user is not authorize, the link will automatically hide itself.
View 2 Replies
Feb 15, 2011
[Code]....
If I use $get, it does work as the expected functionality for $get. It is only $find that does not work.
Can anyone explain the problem?
View 5 Replies
Jan 29, 2010
I have developed a web application 3 months ago to show facebook users by searching username. To access facebook, I have downloaded facebook dll and got application key, and secret key from facebook. My web application was working fine and displaying records from facebook. yesterday onwards, my application is not working fine. I could not get response when I search by name. I have tested the fql in the facebook testAPI tool online. That time i can get response. but the same fql i used in my appliation but it could not get response from facebook when I search by name. If i search by uid i can get response from facebook. here is my code.
facebook.Components.FacebookService fb = new FacebookService();
fb.ApplicationKey = "bfeefa69afdfe81975f0d6136ace3009";
fb.Secret = "9b672d682e1d8befd06382953fc2615b";
fb.IsDesktopApplication = false;
//the below fql gives response as xml.
//select name, profile_url from user where uid = '1730923544' -I can get response for this fql.
//the below fql does not give response as xml. But it gives empty string.
//the below fql does gives us response as xml when i try in facebook testAPI.
//select name, profile_url from user where name = 'Suresh Rajan' -I couldn't get response for this fql.
string s = fb.fql.query("select name, pic_square, profile_url from user where name = 'Suresh Rajan'");
if (String.IsNullOrEmpty(str1))
Response.Write("Empty Response");
else
Response.Write(str1 + " ");
how to search by name in facebook fql.
View 1 Replies
Mar 31, 2011
I have a simple page containing a GridView control that generates thead and tbody tags after rendering. In my jQuery script, I have a line that reads this way:
$('#GridView1
thead').eq(0).html()
When the page loads for the first time, this script returns an objects and works well. But when I click a button and cause a postback, it returns null. By the way, the button changes the number of the rows returned from the data source (based on the value of a textbox) and updates the grid.
View 1 Replies
Apr 3, 2010
Not sure if this is the correct section to ask this but this is regarding storing datatype problem.im trying to convert an image file retrieve from a folder and convert it to Byte so that i can save into database
In below function i retrieve and convert the image from a folder to byte
[Code]....
Then i set ImageUrl in PageLoad
[Code]....
My image datatype in database is image
View 1 Replies
Jul 1, 2010
I added a new table to my type dataset. When the code tries to execute the new row on that table I get the error message.
(if you can't see the error. "MissingMethodException was caught" "Method not found: 'MyTableDataTable MyNamespace.get_SSCase().")
I've tried the wizard and also click and drag the table from solution explorer to the xsd file. The other tables work, just this one table won't work. What should I check?
View 1 Replies
Nov 29, 2013
I have detailsview control with bound fields...some usingĀ Templatefields. I am trying to access values in those fields but i get nulls....i really dont know why..I am proving all my code....
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Projects.aspx.vb" Inherits="Projects" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Projects Statuses</title>
[code]....
I guess something might be getting messy with the mode changing event... a postback? But if i remove the databinding code, i get an error! why find control returns null??
View 1 Replies
Aug 17, 2010
I have built a WCF Service that is being consumed by a Silverlight app. At first I created one method that was very simple:
public String SfTest()
{
return "SF Test";
}
No poblem. My silverlight app references my service and displays "SF Test" in a textbox. Now I add a method to my wcf service like this:
public List<String> GetTest()
{
List<String> list = new List<string>();
String a = "a";
list.Add(a);
String b = "b";
list.Add(b);
return list;
}
I update the reference to the service in my Silverlight app and the using statement in my xaml cs page throws an error like the service doesn't even exist although it is there. I am assuming the problem has to do with datatypes or serialization or something like that but it is driving me up the wall. Why can't I consume a simple generic list in my Silverlight app through the WCF service.
View 1 Replies
Dec 13, 2010
I would like to check whether a folder exists or not if not create. I'm sure this folder exists, but for some reason I get "false" when I check with "Exists" method.
The only reason I think could be because of the W: drive? I moved this application to production site and even there it returns false.
while I'm type in Windows explorer on my localhost and on the server "W:/Webs/ASPPages/cropper/uploads" it opens this folder. So my localhost and IIS server has W: mapping.
for test I tried to create the folder then it says can't find the path...
userFolderName = @"W:/Webs/ASPPages/cropper/uploads"
//I also tried @"W:WebsASPPagescropperuploads"
//I also tried @"W:WebsASPPagescropperuploads"
//I also tried "W:\Webs\ASPPages\cropper\uploads"
DirectoryInfo dirInfo = new DirectoryInfo(userFolderName);........
View 3 Replies
May 9, 2010
protected void Button19_Click(object sender, EventArgs e)
{
SqlDataSource conn = new SqlDataSource();
conn.ConnectionString = ConfigurationManager.ConnectionStrings["Database2ConnectionString1"].ToString();
conn.SelectCommandType = SqlDataSourceCommandType.Text;
conn.SelectCommand = "SELECT FROM table1 (a, b)VALUES(@a,@b)";
conn.SelectParameters.Add("a",TextBox1.Text);
conn.SelectParameters.Add("b", TextBox2.Text);
int rowsAffected = 0;
try
{
rowsAffected = conn.Selectt();
}
catch (Exception)
{
Label1.Text = "Error";
}
finally {
conn = null;
}
if (rowsAffected != 0)
{
Label1.Text = "Data saved";
}
}
well it returns error no overloading method for select (P.S. same code work fine for insert)
View 5 Replies
Mar 16, 2011
I'm having trouble with something that is (or should be) fairly straight-forward.
I have a recursive method that traverses an XML file, writing out the element tag names and values.
This is a snippet from the XML file:
[code]
<root>
<all_companies>
<company_group company_group_ID_attr="1">
<company_group_name>Cleaning</company_group_name>
<company_group_ID>1</company_group_ID>
<company company_ID_attr="2">
<name>Bloomburg</name>
<company_ID>2</company_ID>
<Address>blah blah blah</Address>
<employee_refs>
<employee_ref>4</employee_ref>
</employee_refs>
</company>
<company company_ID_attr="4">
<name>Morris</name>
<company_ID>4</company_ID>
<Address>blah blah blah</Address>
<employee_refs>
<employee_ref>3</employee_ref>
<employee_ref>1</employee_ref>
</employee_refs>
</company>
<company company_ID_attr="7">
<name>Ajax</name>
<company_ID>7</company_ID>
<Address>blah blah blah</Address>
<employee_refs>
<employee_ref>4</employee_ref>
<employee_ref>2</employee_ref>
</employee_refs>
</company>
</company_group>
</all_companies>
</root>
[/code]
I use the following XPath expression to access the first <company group> tag:
"root[1]/all_companies[1]/company_group[1]"
On the first call to the recursive method ("swrite_for_select_certain_stuff"),I see with the debugger that I reach the <company_group_name> tag. A recursive call at that point takes me to the text node within the tag ("Cleaning"), but it is a text type node (not an element), so it returns without writing anything to the output stream.
On return from that second call, things go wrong. The Iterator within the while loop returns false for the MoveNext method, when it should have moved to the <company_group_ID> tag (or so I think it should).
Am I missing something here?
OS is Win XP, and .NET is version 4.0.
My code is as follows:
[Code]....
View 1 Replies
Sep 29, 2010
I have the following code:
[WebMethod]
[SoapHeader("_webServiceAuth")]
public User GetUser(string username){
try
{
this._validationMethods.Validate(_webServiceAuth);
User user = new User(username);
[code]...
View 1 Replies
Nov 2, 2010
How to generate a sequence like the follwoing
AAA
AAB
AAC
.
.
.
ZZZ
I want to store it in a database as a column.
View 3 Replies
Jun 1, 2010
I've got a piece of code that should generate a menu with subitems from a datasource. The menu is displaying without errors but de submenu items are presented as menuitems. Can't figure out whats wrong:
Dim sqlMenuRdr As SqlDataReader = objDbMenu.GetDbMenuItems.ExecuteReader
Dim sqlSubMenuRdr As SqlDataReader = Nothing
Dim i As Integer = 0
[code]...
View 1 Replies
Apr 23, 2010
I'm writing out lots of checkbox controls dynamically based on a query result. In a subsequent sub, I need to check some of those boxes based on another query.
So, in my first sub I have this in my reader loop:
[Code]....
In my second sub, I get the IDs for those boxes that need to be checked.
How do I reference the dynamically generated checkboxes from here? Something like:
divGrid.Controls.? .checked = true
View 7 Replies
May 21, 2010
can anyone tell me how to solve this issue Assembly generation failed -- Referenced assembly 'Microsoft.Web.UI.WebControls' does not have a strong name
View 1 Replies
Jul 2, 2010
I am trying to add some code that logs to a table the time a page has taken to generate, from the request coming in to the response given back. The easiest way to do this is through our master page as it can add the timings of every page.Where I'm a little unsure, is when to put the start and end timings.Currently, I set the start time in the page.unload and the end time as the last part of the page.load on the master page.The figures coming back seem ok, but I'm not sure if I am picking the earliest and latest possible times to get my timings?
View 2 Replies