|
I am using Template Fields in which i had taken ImageButton for edit ,Update adn Cancel. when i am clicking the edit imagebutton it goes through
if (e.Row.RowState == DataControlRowState.Edit)
{
ImageButton imageditformtype = (ImageButton)e.Row.FindControl("imgEditFormType");
imageditformtype.Visible = false;
ImageButton imageupdateformtype = (ImageButton)e.Row.FindControl("imgUpdateFormType");
imageupdateformtype.Visible = true;
ImageButton imageditcancelformtype = (ImageButton)e.Row.FindControl("imgEditCancelFormType");
imageditcancelformtype.Visible = true;
}
so the images changes to update and cancel.
But for Alternate rows the rowstate is Alternate and not goes to edit therefore the ImageButtons are not changed
pls help me out with this .
|
|
|
|
|
I am doing simple application in that i am displaying data and Button also there inside the gridview.I want to delete row of gridview when particular button click in the gridview.But i have done this in 2003 but i didn't understand how to modify this below code in 2005.Pls help me
I am getting error in e.Item.ItemIndex in the second line
Protected Sub DelCmd(sender As [Object], e As DataGridCommandEventArgs)
DeleteRow(Me.DataGrid1.DataKeys(e.Item.ItemIndex).ToString())
BindData()
End Sub 'DelCmd
Thanks
|
|
|
|
|
Standard question #2:
What error message do you get?
---
single minded; short sighted; long gone;
|
|
|
|
|
I have one website in that some products are there
like 1000.Then I want to parse that all that items from that site and places one tab file.how to parse the website.plz send me any solutions for this.
|
|
|
|
|
siddisagar wrote: how to parse the website
You mean fetching information from webpage ? I think it's not easy to do this. Try searching with webclient class
|
|
|
|
|
I am trying to create an Excel file with the XMLTextWriter class. I am successfully able to write the excel file with data from dataset in it. But the problem is that the string data being written in Excel is not visible fully in the cells.
I tried the option of AutoFitWidth="1", But it does not comes into effect for String data. I also got some clue for using System.Drawing.Graphics.MeasureString method. But I am not able to use it in Web project.
Can anyone guide me as to how can I fit the width of the string text in excel cell programatically.
If my mind can conceive it, and my heart can believe it, I know I can achieve it.
If my mind can conceive it, and my heart can believe it, I know I can achieve it.
|
|
|
|
|
Hi,
I am facing this problem which I am not sure why this is happening, so here is what happened.
I have this stored procedure
CREATE PROCEDURE dbo.IsValidLogin
(
@username varchar(50) ,
@password varchar(12) ,
@userid int=0 OUTPUT,
@userfullname varchar(50) OUTPUT
)
AS
SELECT @userid=userid, @userfullname=userfullname
FROM tb_user
WHERE useremail=@username
AND userpassword=@password
GO
Then in my ASP.NET C# code, I do this,
//Call stored procedure from database to check validity of username and password
myCommand = new SqlCommand("IsValidLogin", myConnection);
myCommand.CommandType = CommandType.StoredProcedure;
//Declare parameter for input and output of stored procedure
SqlParameter objParam1, objParam2, objParam3, objParam4;
objParam1 = myCommand.Parameters.AddWithValue("@username", SqlDbType.VarChar);
objParam2 = myCommand.Parameters.AddWithValue("@password", SqlDbType.VarChar);
objParam3 = myCommand.Parameters.AddWithValue("@userid", SqlDbType.Int);
objParam4 = myCommand.Parameters.AddWithValue("@userfullname", SqlDbType.VarChar);
objParam1.Direction = ParameterDirection.Input;
objParam2.Direction = ParameterDirection.Input;
objParam3.Direction = ParameterDirection.Output;
objParam4.Direction = ParameterDirection.Output;
objParam1.Value = uname;
objParam2.Value = upwd;
myCommand.ExecuteNonQuery();
if (objParam4.Value == System.DBNull.Value)
{
this.userid = 0;
this.userfullname = "";
}
else
{
this.userid = (int)objParam3.Value;
this.userfullname = (string)objParam4.Value;
}
This is actually a login page which I wanted to retrieve the user id and user full name, but when I login, I got this error message "System.Data.SqlClient.SqlException: Error converting data type varchar to int." It seems that it is the problem of this
"objParam4 = myCommand.Parameters.AddWithValue("@userfullname", SqlDbType.VarChar);" which is converting it to int, I did not make it to change to int but just don't understand why it wanted to convert.
Hope someone experience this before and do let me know why this is happening.
Thanks
J Liang
|
|
|
|
|
Are you sure that your userid field can contain only integer values ? What is the datatype of that field ?
|
|
|
|
|
Hi,
Actually the userid is just an auto-increment value,so it is all interger.
Btw, I got the solution, by changing AddWithValue to Add only.
J Liang
|
|
|
|
|
Hi
See the difference below statements
exec IsValidLogin 'username','123456','sdf'
:If you run the above statement it is throwing error 'Error converting data type varchar to int':
exec IsValidLogin @username='harini',@password='123456',@userfullname='sdf'
:No error in executing this statement:
Solution 1:
Change the order of output parameters as
@username varchar(50) ,<br />
@password varchar(12) , <br />
@userfullname varchar(50) OUTPUT,<br />
@userid int=0 OUTPUT
Solution 2:
Pass maximum value for parameter @userid from code-behind without changing the order of output parameters.
Try any of the above solutions and let me know.
Hope you got it.
Harini
|
|
|
|
|
Harini Krishnaswamy wrote:
exec IsValidLogin 'username','123456','sdf'
:If you run the above statement it is throwing error 'Error converting data type varchar to int':
Yes, that is a different way of getting the same error message, but I don't see the relevance?
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi,
Thanks for the reply, I think this might work too.
I got an earlier post which I switch from AddWithValue to Add as using AddWithValue cause it to add the value and it become me adding 4 integer value.
J Liang
|
|
|
|
|
This is not strange at all.
When you use the AddWithValue method to create parameters, the second argument is not the data type, but the value. Therefore you are creating four parameters with the type int (as int would be the type used to send the enum values to the database).
Use the Add method instead to specify the data type, and also specify the size of the varchar fields:
objParam1 = myCommand.Parameters.Add("@username", SqlDbType.VarChar, 50);<br />
objParam2 = myCommand.Parameters.Add("@password", SqlDbType.VarChar, 12);<br />
objParam3 = myCommand.Parameters.Add("@userid", SqlDbType.Int);<br />
objParam4 = myCommand.Parameters.Add("@userfullname", SqlDbType.VarChar, 50);
---
single minded; short sighted; long gone;
|
|
|
|
|
Hey,
Thanks, this way works well, didnt really understood the difference of Add and AddWithValue until now.
J Liang
|
|
|
|
|
|
Hello, first let me say that I am a newbie to .Net, so please be gentle. I've been registered on this site for a while, but I recently started by first .Net developer job, so I'll probably be posting here frequently now!
I am developing a custom server control to be used for a Web Part. All of the controls are created dynamically (not using the designer). I am gathering several user input fields via a DetailsView control. I need to validate the user input, but all of the examples I can find use a Template added to the HTML. Since I am not using the designer, I don't have the HTML, except for what I render myself.
So my question is, how do I render the HTML in such a way as to be able to add user input validation?
Thanks for your help!
|
|
|
|
|
I am trying cascadingdropdown with ajax control. On my form i add 1
combobox and the cascadingdropdown control. When I run the page the
combobox displays the Select... and no options except for
[Method Error 500]
Please help me.
Here is my web service code.
using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Collections.Generic;
using AjaxControlToolkit;
using System.Data;
using System.Data.SqlClient;
///
/// Summary description for FoodService
///
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class FoodService : System.Web.Services.WebService
{
public FoodService()
{
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
// public CascadingDropDownNameValue[] GetItemsByCategoryID(string
KnownCategoryValues, string category)
// {
// string[] _categoryValues = KnownCategoryValues.Split(':',
';');
// int _foodID = Convert.ToInt32(_categoryValues[1]);
// List<cascadingdropdownnamevalue> _foodItems = new
List<cascadingdropdownnamevalue>();
// dsFoodTableAdapters.tbparentTableAdapter _foodAdapter =
//new dsFoodTableAdapters.tbparentTableAdapter();
// foreach (DataRow _row in _foodAdapter.GetFoodData())
// {
// _foodItems.Add(new
CascadingDropDownNameValue(_row["category"].ToString(),
_row["categoryID"].ToString()));
// }
// // convert to array and return the vlaues
// return _foodItems.ToArray();
// }
public CascadingDropDownNameValue[] GetItemsByCategoryID(string
KnownCategoryValues)
{
string[] _categoryValues = KnownCategoryValues.Split(':',
';');
int _foodID = Convert.ToInt32(_categoryValues[1]);
List<cascadingdropdownnamevalue> _foodItems = new
List<cascadingdropdownnamevalue>();
// dsFoodTableAdapters.tbparentTableAdapter _foodAdapter =
//new dsFoodTableAdapters.tbparentTableAdapter();
dsFoodItemsTableAdapters.tbChildTableAdapter _foodAdapter =
new dsFoodItemsTableAdapters.tbChildTableAdapter();
foreach (DataRow _row in _foodAdapter.GetData(_foodID))
{
_foodItems.Add(new
CascadingDropDownNameValue(_row["subcategory"].ToString(),
_row["subcategoryID"].ToString()));
}
// convert to array and return the vlaues
return _foodItems.ToArray();
}
}
#######################################
Below is the code for aspx page
<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Default3.aspx.cs" Inherits="Default3" %>
<%@ Register Assembly="AjaxControlToolkit"
Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<title>Untitled Page
<asp:scriptmanager id="ScriptManager1" runat="server">
<asp:dropdownlist id="DropDownList1" runat="server"
datasourceid="ObjectDataSource1"
="" datatextfield="category" datavaluefield="categoryID">
<asp:objectdatasource
id="ObjectDataSource1" runat="server"
oldvaluesparameterformatstring="original_{0}"
="" selectmethod="GetFoodData"
typename="dsFoodTableAdapters.tbparentTableAdapter">
<asp:dropdownlist id="DropDownList2" runat="server">
<cc1:cascadingdropdown id="CascadingDropDown1" runat="server"
category="tbChild" loadingtext="please wait"
parentcontrolid="DropDownList1" prompttext="please subcategory"
servicemethod="GetItemsByCategoryID" targetcontrolid="DropDownList2">
seema
|
|
|
|
|
seemamltn wrote: tempuri
This is not a reference to fried food coating ( that's tempura ). It means temp uri, and should never appear in a production web service, you're supposed to change it.
This is not the problem, I just thought I'd mention it.
What happens if you set breakpoints in your code and step through the AJAX call ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hello
Why my date time picker, work normally in aspx form, and don't work in ascx form?
Is anybody know?
thank you
|
|
|
|
|
Well, how could we possibly ? We don't even know which control you're using, let alone what the code looks like.
An ascx gets rolled into the aspx, so there's a reason that's specific to your code.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
if (Request.QueryString["textbox"] != "")
{
string strScript = "window.opener.document.forms(0)." + Request.QueryString["textbox"].ToString() + ".value = '";
strScript += Calendar.SelectedDate.ToString("dd/MM/yyyy");
strScript += "';self.close()";
strScript += "</" + "script>";
RegisterClientScriptBlock("Calendar_ChangeDate", strScript);
}
|
|
|
|
|
Hi All,
I have some ASP.Net web pages that use C# as code behind. On those ASPX pages, there r some datagrids that I want to print.
I have seen help about printing datagrids on standalone applications but dont know how to do it on WebBased applications such as mine.
Any help/ideas/urls wud be greatly appreciated
Thanx
Umashanker.k
|
|
|
|
|
Try the below mentioned code:-
<script language=javascript>
function CallPrint(strid)
{
var prtContent = document.getElementById(strid);
var WinPrint = window.open('','','letf=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status=0');
WinPrint.document.write(prtContent.innerHTML);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
prtContent.innerHTML=strOldOne;
}
</script>
<div id="divPrint">
<asp:datagrid>
.....
.....
.....
</asp:datagrid>
</div>
<asp:button ID="btnPrint" onClick="javascript:CallPrint('divPrint');" Runat=Server />
|
|
|
|
|
Hi, I am using a wizard control, and I notice that when it places the "next" button, it puts this in a table, then in a td with align=right specified as a style.
Now I want to remove this style. I thought the best way to do this is to override the control, however if i do that, I cannot find what the rendered html looks like to overwrite. Does anyone know how you can overwrite this before the control gets generated?
|
|
|
|
|
hello all l am student of computer engineer and l was given a project at that point l need help about problem that is l want to create a ftp user acount and l want to make relatoin between that user account and virtual directory for example;
l creat a user acount:
user name:jack
pasword:*****
let say our vitual directory directory is www.mst.edu
now question is what l want to learn is how can l illustrate that vitual directory with username ?
when l typed at the adressbar www.mst.edu/jack l want to see account of jack
please help me...l already thaks who keep knowledge exchange!
by the way l use asp.net 2005 whit framework 2.0 and please tell me how should l open new project in viual studio.net step by step for this problem
Engineerusa
|
|
|
|