|
I am getting the data from MySQL like this:
SELECT item_id, item_category, item_code, item_description, quantity_type_id, quantity_type, item_quantity as available_quantity, CONCAT(item_quantity, ' ', quantity_type) as item_instock, is_blocked FROM storebook_items ORDER BY item_description;
where item_quantity is int, quantity_type is varchar and item_instock a combination of both as you can see..
when I run the above on my database server as query then everything is fine
but when I populate the result to a datagrid (XtraGrid) I get System.Byte[] in the item_stock column.
|
|
|
|
|
|
Thanks
|
|
|
|
|
Hello.
I intend to bind my dropdownlist to sqlserver and read the items(CityName)that i have them in DB(Table City)and then list and fill them into the dropdownlist.
for this matter i have written the code below in Page_load that whenever i start to debug all city items to be seen in dropdownlist:
if (!IsPostBack)
{
using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["PersonTest"].ConnectionString))
{
conn.Open();
using (SqlCommand cmd = new SqlCommand("SELECT CityName , id FROM City", conn))
{
DataTable dt = new DataTable();
SqlDataAdapter adpt = new SqlDataAdapter(cmd);
adpt.Fill(dt);
DropCity.DataTextField = "CityName";
DropCity.DataValueField = "CityId";
}
}
}
but after i start to debug there is no item in dropdownlist.
meanwhile i know that i can use ASP.net DataBinding(by wizard)ability, but i want to do it with myself . and also i don't know which one is better to be used in forms? which one do you suggest to use?
what shall do?
|
|
|
|
|
Hi,
Try this:
if (!IsPostBack)
{
using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["PersonTest"].ConnectionString))
{
conn.Open();
using (SqlCommand cmd = new SqlCommand("SELECT CityName , id FROM City", conn))
{
DataTable dt = new DataTable();
SqlDataAdapter adpt = new SqlDataAdapter(cmd);
adpt.Fill(dt);
DropCity.DataTextField = "CityName";
DropCity.DataValueField = "CityId";
DropCity.DataBind();
}
}
}
All the best..
|
|
|
|
|
Hello,
I want to detect when user click back button in android webkit.
I can detect back button event by below code.
But it does not work in android webkit.
Response.Cache.SetNoStore();
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Is there any way to catch back button button?
hi
My english is a little.
anyway, nice to meet you~~
and give me your advice anytime~
|
|
|
|
|
i want to build my own project please help me .......by giving guide...send the guidelines to my account......
|
|
|
|
|
|
it's very simple
(ctr + Shift + b)
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
<pre lang="c#">capture image through Webcam in asp.net 4.0 C#.</pre>
|
|
|
|
|
Is this a statement, command or question? If the latter then typing it into Google will yield many interesting links.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
|
Hi,
Why I am getting the above error for the following code:
sql_connection = new MySqlConnection(ConfigurationManager.ConnectionStrings["SQLdb"].ConnectionString);
sql_connection.Open();
sql_command = new MySqlCommand("sp_upload_resume", sql_connection);
sql_command.CommandType = CommandType.StoredProcedure;
sql_command.Parameters.AddWithValue("param_full_name", txtFullName.Text.Trim()).MySqlDbType = MySqlDbType.VarChar;
sql_command.Parameters.AddWithValue("param_email_address", txtEmail.Text.Trim()).MySqlDbType = MySqlDbType.VarChar;
sql_command.Parameters.AddWithValue("param_gender", cboGender.Value.ToString()).MySqlDbType = MySqlDbType.VarChar;
sql_command.Parameters.AddWithValue("param_nationality", cboNationality.Value.ToString()).MySqlDbType = MySqlDbType.VarChar;
sql_command.Parameters.AddWithValue("param_date_of_birth", cboDateOfbirth.Date).MySqlDbType = MySqlDbType.Date;
sql_command.Parameters.AddWithValue("param_designation", Convert.ToInt32(cboDesignation.Value)).MySqlDbType = MySqlDbType.Int32;
sql_command.Parameters.AddWithValue("param_resume_ext", file_extension).MySqlDbType = MySqlDbType.VarChar;
sql_command.Parameters.AddWithValue("param_resume_format", document_type).MySqlDbType = MySqlDbType.VarChar;
sql_command.Parameters.Add("param_resume_data", MySqlDbType.LongBlob, file_size).Value = document_binary;
if (Request.ServerVariables["REMOTE_ADDR"] != null) sql_command.Parameters.Add("param_ip_address", MySqlDbType.VarChar).Value = HttpContext.Current.Request.UserHostAddress;
else sql_command.Parameters.Add("param_ip_address", MySqlDbType.VarChar).Value = DBNull.Value;
sql_command.Parameters.Add("param_browser_platform", MySqlDbType.VarChar).Value = Request.Browser.Platform;
sql_command.Parameters.Add("param_browser_version", MySqlDbType.VarChar).Value = String.Format("{0} {1}", Request.Browser.Browser, Request.Browser.Version);
sql_command.Parameters.Add("param_gateway_version", MySqlDbType.VarChar).Value = Request.Browser.GatewayVersion;
sql_command.Parameters.Add("param_is_mobile", MySqlDbType.Bit).Value = Request.Browser.IsMobileDevice;
sql_command.Parameters.Add("param_mobile_manufacturer", MySqlDbType.VarChar).Value = Request.Browser.MobileDeviceManufacturer;
sql_command.Parameters.Add("param_mobile_model", MySqlDbType.VarChar).Value = Request.Browser.MobileDeviceModel;
sql_command.Parameters.Add("param_screen_width", MySqlDbType.Int32).Value = Request.Browser.ScreenPixelsWidth;
sql_command.Parameters.Add("param_screen_height", MySqlDbType.Int32).Value = Request.Browser.ScreenPixelsHeight;
sql_command.Parameters.Add("param_browser_type", MySqlDbType.VarChar).Value = Request.Browser.Type;
sql_command.Parameters.Add("param_machine_name", MySqlDbType.VarChar).Value = Environment.MachineName;
sql_command.Parameters.Add("param_os_version", MySqlDbType.VarChar).Value = Environment.OSVersion.VersionString;
sql_command.Parameters.Add("param_user_name", MySqlDbType.VarChar).Value = Environment.UserName;
sql_command.Parameters.AddWithValue("param_record_identity", MySqlDbType.Int32).Direction = ParameterDirection.Output;
sql_command.Parameters.AddWithValue("param_is_exist", MySqlDbType.Bit).Direction = ParameterDirection.Output;
int result_rows = sql_command.ExecuteNonQuery();
|
|
|
|
|
Might be related to connection string. Try increasing/setting the connection timeout in your connection string and see.
Setting connection timeout worked for him here facing same issue.[^]
|
|
|
|
|
Sandeep Mewara wrote: Try increasing/setting the connection timeout
Yes Sandeep.
In most of the cases we can see this error if the connection timeout is less. Nice answer.
|
|
|
|
|
In a C# 2010 web form application, I would like to know how to setup server side validators to check the format of a date in mm/dd/yyy format. Basically this would be like a regular expression, custom validator, compare validator. I basically need to validate the mm/dd/yyyy format includes for month, date, year. I also am required to make certain the user enters the date with the '/'. enter.
Can you tell me how to accomplish this goal?
|
|
|
|
|
Following regex can be used for it for format MM/dd/yyyy:
^(0[1-9]|1[012])[/](0[1-9]|[12][0-9]|3[01])[/](19|20)\d\d$
On server side, you can use Regex.Match to check the string and validate it.
Refer: C# Regex.Match[^]
I would prefer Masked Textbox for input itself: Enhanced Textbox Control[^]
|
|
|
|
|
I use the calendar, it easier on me and the user.
|
|
|
|
|
I have sign in panel and sign up panel in the same default.aspx page.
i have kept a validation setting with required rule in all textbox in both panels.
now the problem, when user try to sign up and click submit button it will ask him to enter data in the sign in textbox, i guess because all are in one but asp.net won't allow multipe forms in the same page.
what can i do?
|
|
|
|
|
Read this[^].
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
I think, you have to set ValidationGroup for Signin and Signup to check for respective submit.
Parwej Ahamad
|
|
|
|
|
I am getting this error with urlrewriter.net:
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Unrecognized configuration section rewriter.
Source Error:
Line 70: <errors callbackErrorRedirectUrl=""/>
Line 71: </devExpress>
Line 72: <rewriter>
Line 73: <rewrite url="/tags/(.+)" to="/tagcloud.aspx?tag=$1" />
Line 74: </rewriter>
Source File: C:\Users\Jassim\documents\visual studio 2010\Projects\rmconline\rmconline\web.config Line: 72
here is my web.config:
="1.0"
<configuration>
<configSections>
<sectionGroup name="devExpress">
<section name="settings" type="DevExpress.Web.ASPxClasses.SettingsConfigurationSection, DevExpress.Web.v11.1, Version=11.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" requirePermission="false"/>
<section name="compression" type="DevExpress.Web.ASPxClasses.CompressionConfigurationSection, DevExpress.Web.v11.1, Version=11.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" requirePermission="false"/>
<section name="themes" type="DevExpress.Web.ASPxClasses.ThemesConfigurationSection, DevExpress.Web.v11.1, Version=11.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" requirePermission="false"/>
<section name="errors" type="DevExpress.Web.ASPxClasses.ErrorsConfigurationSection, DevExpress.Web.v11.1, Version=11.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" requirePermission="false"/>
<section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />
</sectionGroup>
</configSections>
<connectionStrings>
<add name="SQLdb" connectionString="Server=999.999.999.999;Port=3306;Database=rmc;Uid=root;Pwd=xxxxxx;" providerName="MySql.Data.MySqlClient"/>
</connectionStrings>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="DevExpress.Web.v11.1, Version=11.1.4.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="DevExpress.Data.v11.1, Version=11.1.4.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/>
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="DevExpress.Web.ASPxEditors.v11.1, Version=11.1.4.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/>
<add assembly="DevExpress.Web.ASPxScheduler.v11.1, Version=11.1.4.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/>
<add assembly="DevExpress.XtraScheduler.v11.1.Core, Version=11.1.4.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/>
<add assembly="DevExpress.Web.ASPxGridView.v11.1, Version=11.1.4.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A"/></assemblies>
</compilation>
<authentication mode="Forms">
<forms loginUrl="~/Account/Login.aspx" timeout="2880"/>
</authentication>
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
</providers>
</membership>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear/>
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/"/>
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/"/>
</providers>
</roleManager>
<httpModules runAllManagedModulesForAllRequests="true">
<add type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, DevExpress.Web.v11.1, Version=11.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule"/>
<add type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" name="UrlRewriter" />
</httpModules>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add type="DevExpress.Web.ASPxClasses.ASPxHttpHandlerModule, DevExpress.Web.v11.1, Version=11.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule"/>
</modules>
<validation validateIntegratedModeConfiguration="false"/>
</system.webServer>
<devExpress>
<settings rightToLeft="false"/>
<compression enableHtmlCompression="false" enableCallbackCompression="true" enableResourceCompression="true" enableResourceMerging="false"/>
<themes enableThemesAssembly="true"/>
<errors callbackErrorRedirectUrl=""/>
</devExpress>
<rewriter>
<rewrite url="/tags/(.+)" to="/tagcloud.aspx?tag=$1" />
</rewriter>
</configuration>
|
|
|
|
|
Although i have never used URL rewriting but it seems like your Config file have incorrect elements.
your last section
<rewriter>
<rewrite url="/tags/(.+)" to="/tagcloud.aspx?tag=$1" />
</rewriter>
should be like,
<RewriterConfig>
<Rules>
<RewriterRule>
<LookFor>pattern to look for</LookFor>
<SendTo>string to replace pattern with</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>pattern to look for</LookFor>
<SendTo>string to replace pattern with</SendTo>
</RewriterRule>
...
</Rules>
</RewriterConfig>
Please Refer MSDN Article[^]
Hope above like will resolve your issue.
Thanks
-Amit Gajjar
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
Hi,
Try checking here[^].
|
|
|
|
|
Hi There.
I am having a problem in populating html table from database dynamically. What i mean is that i
have a table in database that have let say 10 enteries, I want to display those 10 entries in a
html table using loop. I am new to ASP.NET, I've previously woked in php. I can present the
scenario in php and please help me do the same thing in ASP.NET. In php what i normally do is
search the database, grab the table in fetch array and in html table i create one row and use
while loop so that all of the 10 entries are populated at runtime. Here is a demonstration
code in head:
<pre lang="PHP">= mysql_query(
in body code:
<table>
<tr>
<td>Username</td>
<td>Email</td>
<td>Position</td>
<td>Status</td>
</td>
//start of the loop
<?php while($fetch = mysql_fetch_array($query) { ?>
<tr>
<td><?php echo $fetch["username"]; ?> </td>
<td><?php echo $fetch["email"]; ?> </td>
<td><?php echo $fetch["position"]; ?> </td>
<td><?php echo $fetch["status"]; ?> </td>
</tr><?php } ?>//End of loop
</table>
When i use foreach loop in asp.net to do the same thing the it displays only the last row in the
database table...I am using three tier architecture...
projectsLoad_BLL bo = new projectsLoad_BLL();
DataSet ds = new DataSet();
DataTable dt = ds.Tables[0];
int num = 1;
foreach (DataRow dr in dt.Rows)
{
lblno.Text = num.ToString();
lblusername.Text = dr["username"].ToString();
lblemail.Text = dr["email"].ToString();
lblposition.Text = dr["position"].ToString();
lblstatus.Text = dr["status"].ToString();
dt.NewRow();
num++;
}
In HTML Table:
<table>
<thead>
<tr>
<th>No.</th>
<th>Username</th>
<th>Email</th>
<th>Position</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<tr>
<td><asp:Label ID="lblno" runat="server"
Text="Label"></asp:Label> </td>
<td><asp:Label ID="lblusername" runat="server"
Text="Label"></asp:Label></td>
<td><asp:Label ID="lblemail" runat="server"
Text="Label"></asp:Label></td>
<td><asp:Label ID="lblposition" runat="server"
Text="Label"></asp:Label></td>
<td><asp:Label ID="lblstatus" runat="server"
Text="Label"></asp:Label></td>
</tr>
</tbody>
</table>
I know that this method is wrong...if anyone can point to the right direction...thanks in
advance
|
|
|
|
|