|
HI. well my problem is my screen reader is not reading me that welcome message and the name of the user, and it does relate to asp dot net, because that was one of the exercises in the web programming chapter of the vb programming book. now, wondering, if it being hidden by some type of thing, and wonder if i need to use a separate text box or status bar. cheers Marvin.
|
|
|
|
|
this is my code
public decimal OrderTotal;
SqlParameter parameterOrderTotal = new SqlParameter("@OrderTotal", qlDbType.Money);
parameterOrderTotal.Direction = ParameterDirection.Output;
myCommand.SelectCommand.Parameters.Add(parameterOrderTotal);
retreive this value by
myOrderDetails.OrderTotal = (decimal)parameterOrderTotal.Value;
some times ite work fine but sometime its show errror Specified cast is not valid.
Tahnx
|
|
|
|
|
You need to check for a null value (or DBNull.Value) before casting it.
|
|
|
|
|
I am using Grid View control in asp.net (3.5). I am passing Grid View value from one page to another. In another page i want to edit that value. I am facing a problem while editing as it's retaining old value in Update command.
Pls. help
modified on Sunday, March 15, 2009 4:23 AM
|
|
|
|
|
OK, so you expected to post this in the VB forum and get help ? Wow. Even now, I don't see how we can help you. What value are you passing ? How are you passing it ? Why are you editing the value in the new page ? What do you mean, it's retaining the old value ? You haven't given anything like an explanation that gives us info we need to try to understand and help you.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
maybe a little bit of code and value parameters will help you more
|
|
|
|
|
hello sir/madam
i have following code for updating database via datagrid control,,but it produces an error..can anybody tell me how to deal with this kind of error..
]]>
]]>
SqlConnection connector = new SqlConnection(@"Server=localhost;Integrated Security=SSPI;Database=cms");
String strsql;
void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
BindDataGrid();
}
void BindDataGrid()
{
SqlCommand cmdsql = new SqlCommand("Select * from studentmarksentry", connector);
connector.Open();
unittest1marksentry_datagrid.DataSource = cmdsql.ExecuteReader();
unittest1marksentry_datagrid.DataBind();
connector.Close();
}
void CancelCommand(Object sender, DataGridCommandEventArgs e)
{
unittest1marksentry_datagrid.EditItemIndex = -1;
BindDataGrid();
}
void EditCommand(Object sender, DataGridCommandEventArgs e)
{
unittest1marksentry_datagrid.EditItemIndex = e.Item.ItemIndex;
BindDataGrid();
}
void UpdateCommand(Object sender, DataGridCommandEventArgs e)
{
int regd_num;
String txtvalueholder;
if (IsValid)
{
regd_num=(int)unittest1marksentry_datagrid.DataKeys[e.Item.ItemIndex];
TextBox txtmarksentry = (TextBox)e.Item.FindControl("txtmarksentry");
txtvalueholder = txtmarksentry.Text;
strsql = "update studentmarksentry set MarksObtained=@marksentry where Regdno=@register";
SqlCommand cmdsql = new SqlCommand(strsql, connector);
cmdsql.Parameters.Add("@marksentry", txtvalueholder);
cmdsql.Parameters.Add("@register", regd_num);
connector.Open();
cmdsql.ExecuteNonQuery();
connector.Close();
unittest1marksentry_datagrid.EditItemIndex = -1;
BindDataGrid();
}
}
<title>Unit-Test 1 marks Entry form
<asp:datagrid id="unittest1marksentry_datagrid" autogeneratecolumns="false" oncancelcommand="CancelCommand" oneditcommand="EditCommand" xmlns:asp="#unknown">
OnUpdateCommand="UpdateCommand" runat="server">
<columns> <asp:boundcolumn headertext="Register No" datafield="Regdno" readonly="true">
<asp:boundcolumn headertext="First Name" datafield="First name" readonly="true">
<asp:boundcolumn headertext="Middle Name" datafield="Middle name" readonly="true">
<asp:boundcolumn headertext="Last Name" datafield="Last name" readonly="true">
<asp:templatecolumn>
<headertemplate>
Marks Obtained
<itemtemplate>
<%#DataBinder.Eval(Container.DataItem,"MarksObtained") %>
<edititemtemplate>
<asp:textbox id="txtmarksentry" text="<%#DataBinder.Eval(Container.DataItem," marksobtained")="" %>"="">
runat="server">
<asp:comparevalidator id="unittest1marksentry_comparevalidator" controltovalidate="txtmarksentry">
Display="Dynamic" Text="must be a number" Operator="DataTypeCheck" Type="Integer"
runat="Server">
<asp:editcommandcolumn edittext="Edit" updatetext="Update" canceltext="Cancel">
here my database name is cms and try to update the marks obatined column but i get following error
:Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
ok
waiting for the reply.
|
|
|
|
|
Buy a basic programming book and read it. Don't post so much code that no-one will bother reading it.
rosae619 wrote: :Index was out of range. Must be non-negative and less than the size of the collection.
It means what it says. Look at the code where the debugger breaks. Is index < 0, or greater than the collection ? Never access a collection without first making sure the index you're about to use is valid. Read error messages, and then think about what they say. They mean what they say.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
this is my question i want to put the functionality of onblur method of textbox is not in javascript but in c# but i am unable to find any similar or working functionality.
-------------------xxx-----Have any ideas----------------xxxxxxxxxxx-------------------
thanks.
|
|
|
|
|
There's a reason for this. The reason is that it would be idiotic for this to exist. You need to understand how web applications work, and you plainly do not. A web page that reloaded itself every time a textbox lost focus, would really, really suck. You can use C# code by making an AJAX call, assuming you know anything about AJAX.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
can you please more clarify it ..well i have ajax tools and extenders but dont know which one to use and any article for me is more helpful.
|
|
|
|
|
Alok sharma ji wrote: well i have ajax tools and extenders
Put your textbox inside an updatepanel. Set AutoPostBack=true and hook the TextChanged event handler. You can see the event fires on blur.
|
|
|
|
|
See, I would have told him how to write actual code, instead of using a framework that he doesn't understand in any way. But, your reply probably helped him more, I would have just tried to force him to consider becoming a programmer.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Christian Graus wrote: I would have just tried to force him to consider becoming a programmer.
Agree 100%. I would have done that. OP said, he already started AJAX framework and I thought obvious answer would be helping on that. I am not sure how much he would have followed if I answer him in a different way.
|
|
|
|
|
Onblur can only be generated if the page is posted back.
In client server architecture, when a response is sent to the client, there is no connection between the client and the server. Thus when the page is posted back, that means another request is been made to the server with some postback info.
You can create an HTTPHandler to generate server side event, but to post back your page automatically when onBlur event of a textbox occurs, you need to do it through javascript.
Just do a postback of the page to your handler..
Hope you understand!!!!
|
|
|
|
|
thanks now i get it clearly. thanks again
|
|
|
|
|
I don't know why all the LinkButton in my C#.net website cann't work,
It means that if i clicked the button just like i have nothing to do with it.
Can someone help me?waiting online
the browser has not any problem.
Now i know what cause this problem,but i don't know how to solve.
my website reference a outside javascript file,the file content is:
var imgObj;
function showImage(imgsrc)
{
if(imgObj!=null) {
document.body.removeChild(imgObj);
}
imgObj=document.createElement("div");
imgObj.setAttribute("id","imgDiv");
imgObj.setAttribute("align","center");
imgObj.style.border="0";
imgObj.style.position="absolute";
var X=event.x;
if(X<=screen.width*41/100)
X=X+100;
else if(X>=screen.width*59/100)
X=X-200-350;
else
X=screen.width*59/100;
imgObj.style.left=X;
imgObj.style.top="30%";
imgObj.style.marginTop=-75+document.documentElement.scrollTop+"px";
imgObj.style.zIndex="1000";
imgObj.innerHTML="<img src='"+imgsrc+"' onerror='return true' height=400 width=350 />";
document.body.appendChild(imgObj);
}
function hideImage()
{
document.body.removeChild(imgObj);
imgObj=null;
}
this script is to show the bigger image onmouseover,but i don't know why it can cause this problem.
modified on Saturday, March 14, 2009 10:05 PM
|
|
|
|
|
1 - See the event handlers are hooked correctly.
2 - Take the viewsource of that page and see how it is rendered.
3 - Make sure you have JS enabled browser.
|
|
|
|
|
sohighthesky wrote: the browser has not any problem.
No, the odds seem low of the browser being broken. Your code obviously is. So, do some basic error checking, and if you need to ask again, try giving us some detail of what is happening, and show us code. This post is utterly useless. You've said to us 'my code is broken'. Great. How can we help without seeing it, or without you doing some basic work to check what is and is not working as you'd expect ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I want to resize gridview column width dynamically like component art grid.
|
|
|
|
|
I think you need good knowledge of JS to do this. Take a good book and learn. I am not sure, but look at the JQuery library which may have some techniques to do this.
|
|
|
|
|
Hi,
I have two listitems, The items selected in the first combo is moved to another combo at a button click using JScript. when i access the second comobos values in server side,the item count of the second combo seems to be 0. can any one help me in solving in this issue.
|
|
|
|
|
How are you adding items to dropdown? Try to add like
document.getElementById("DropDownId").options[index] = new Option("text", "value");
|
|
|
|
|
Dear friends,
In my asp.net 2.0 website, I added a Report. I am using cultural settings in my site. Is there any way to display the data in the report based on cultural settings.
ie, if the cultureInfo="en-US", the date data in report should display in MM/dd/yyyy format.
if the cultureInfo="en-GB", the date data in report should display in dd/MM/yyyy format.
Please give me a suggestion for this problem
Shivanandan C V
|
|
|
|
|
Shivan Nandan wrote: I added a Report.
What report is it? A crystal report or some other? DateTime.Now.ToString() has got overloads, where you can specify the pattern you want to display the date.
|
|
|
|