|
how v can get value of chekbox (cheked or unchekd)in a javascript
im using a content page .In dat page i put a chekbox with id=ChKPromoActive;
i hav tried this code but it s returning null value
var chkPromo = document.getElementById("ChKPromoActive");
alert(chkPromo);
|
|
|
|
|
Hi,
You can use Html CheckBox for this purpose:
Hello
function Check()
{
var cc=document.getElementById("chk2");
alert(cc.checked);
}
Naresh Patel
|
|
|
|
|
Hi,
I would like to know how do I able to upload an image and display it again from the web server? Currently I am using "this.filePic.PostedFile.SaveAs(image);" but this one need a rooted file path, it works only for uploading and downloading but the file path stored in my database will give a problem when I need to display the picture.
Thanks in advance.
J Liang
|
|
|
|
|
HI,
Store just the ImageName of saved image. And use Server.MapPath("imagenamesavedfromdatabase") function
THis function return the ImagePath of your FileSystem Where the image stored in the server.
Naresh Patel
|
|
|
|
|
Hi,
Thanks for the suggestion, it works.
J Liang
|
|
|
|
|
Hi,
I was wondering if there is an ASP.net way of doing this.
I have a template of controls, <text field><drop down list><drop down list>
The number of this "template" depends on the user's search criteria. In ASP, I did it using a count variable and if the user adds (by pressing the 'add' button) and doing a while loop to add it.
i.e. if the use adds 3 (1 is default) 4 rows of the above controls will be displayed.
Thanks.
Desmond
|
|
|
|
|
You would want to do this with "asp .net repeater control", a simple but very powerful way of implementing what you're trying to do.
Enjoy.
|
|
|
|
|
Yup, that I understand but how do I actually "tell" it I want it to "repeat" 5 times?
|
|
|
|
|
Hi,
I can't understand what is wrong here, can somebody look it up please.
I get and exception: Cannot insert the value NULL into column 'NID', table 'C:\...'; column does not allow nulls. INSERT fails.
The statement has been terminated.
but during the debugging it shows that it gets the value.
Here is my code:
<asp:SqlDataSource ID="SubmitSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:NConnectionString %>"<br />
InsertCommand="INSERT INTO NTable(NID, Headline, Category, Tags, Username, Date, Rating, CountRating, Enabled) VALUES (@newsID, @headline, @category, @tags, @username, @date, NULL, 0, @enabled)"<br />
OnInserting="SubmitSqlDataSource_Inserting" ><br />
<InsertParameters><br />
<asp:Parameter Name="newsID" /><br />
<asp:Parameter Name="headline" /><br />
<asp:Parameter Name="category" /><br />
<asp:Parameter Name="tags" /><br />
<asp:Parameter Name="username" /><br />
<asp:Parameter Name="date" /><br />
<asp:Parameter Name="enabled" /><br />
</InsertParameters><br />
</asp:SqlDataSource>
Here is my C# code:
protected void SubmitSqlDataSource_Inserting(object sender, SqlDataSourceCommandEventArgs e)<br />
{<br />
newsID = System.Guid.NewGuid();<br />
TextBox HeadlineTextBox = (TextBox)SubmitFormView.FindControl("HeadlineTextBox");<br />
DropDownList CategoriesDDL = (DropDownList)SubmitFormView.FindControl("CategoriesDDL");<br />
TextBox TagsTextBox=(TextBox)SubmitFormView.FindControl("TagsTextBox");<br />
CheckBox EnabledCheckBox = (CheckBox)SubmitFormView.FindControl("EnabledCheckBox");<br />
SubmitSqlDataSource.InsertParameters["newsID"].DefaultValue = Convert.ToString(newsID);<br />
SubmitSqlDataSource.InsertParameters["headline"].DefaultValue = HeadlineTextBox.Text;<br />
SubmitSqlDataSource.InsertParameters["category"].DefaultValue = CategoriesDDL.SelectedValue;<br />
SubmitSqlDataSource.InsertParameters["tags"].DefaultValue = TagsTextBox.Text;<br />
SubmitSqlDataSource.InsertParameters["username"].DefaultValue = Membership.GetUser().UserName.ToString();<br />
SubmitSqlDataSource.InsertParameters["date"].DefaultValue=DateTime.Now.ToString();<br />
SubmitSqlDataSource.InsertParameters["enabled"].DefaultValue = EnabledCheckBox.Checked.ToString();<br />
}
Thx
|
|
|
|
|
I have the following requirement for an assignment. Could u please help me in creating xml document for this. I have images stored in c drive.
. Create an xml document that models the image groups. Each grouping should include the name and location of the images within the group.
• Create a web page that allows the user to select and display a group of images.
• Use the xml file to specify the groups of images the user can select.
• Allow the user to select a group of images.
• Display the group of images when a selection is made.
seema
|
|
|
|
|
It is so sad to say that we are not here for doing your assignment. If you are attending some courses, you should try to do your assignment or homework.
And ask if you have any problem while you are trying.. then, it's good for both sides especially you.
Thanks for understanding.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Dear Seema,
Please try to do your tasks. If you have any doubts then ask.
But without trying if you write your tasks like this is not good.
i think you got it.
Regards,
Niranjan
|
|
|
|
|
First, stop asking the same question over and over in multiple forums. Second, you need to at least TRY to do your own homework. If you get stuck in a bit of code then post it and we'll help. But if you are not willing to even start it yourself I suggest changing majors immediately.
_____________________________________________
Flea Market! It's just like...it's just like...A MINI-MALL!
|
|
|
|
|
hi everyone,
does anyone out there knows any tutorial sites about svg mapping???
my Final Year Project(FYP) is due in october...and i haven't started yet.
i've searched the net , but all i can find are svg tutorials that are hardcoded.
does this mean that i have to hardcode every controls and interfaces..using notepad??
please help...URGENT!!
BTW, i planned on using VWD2005 and not notepad...
please anyone...?? blogs?? master of asp.net ??? svg guru ??
i don't even know if i'm in the right forum...
|
|
|
|
|
hello all,
I have master detail gridview master gridview company and detail gridview is peoplelist, i wanted to implement multiple selection in detail gridview using checkboxes. But i am not sure how to get the datakey (in mycase personid) of all the rows in which the checkbox is selected. I need to do insert operation using these personid's can anyone point me in the right direction.
Cheers, Shilpa.
I am trying to access the child gridview in this method but not able to do so
GridView People = grdCompanyPeople.FindControl("grdPersons")as GridView
for (int i = 0; i < People.Rows.Count; i++)
{
GridViewRow Singlerow = People.Rows[i];
bool isChecked = ((CheckBox)Singlerow.FindControl("chkSelect")).Checked;
if (isChecked == true)
{
str.Append(People.DataKeys[Singlerow.RowIndex]["PersonID"].ToString() + ",");
}
}
// prints out the result
Response.Write(str.ToString());
Thanks in Advance for your help. Best Regards
|
|
|
|
|
I have three image groups. I have to create an XML document that models the image groups.Each grouping should include the name and location of the images within the group.
How can I do that.
seema
|
|
|
|
|
Hi,
I have developed a custom server control for .NET Framework 2.0. The server control has a property named BinaryData of type byte[]. I marked this property to be data bindable. Now, I have varbinary(Max) type of field in my SQL Database and I have used SQLDataSource and bound this varbinary(Max) field with the property BinaryData (byte[]) of my control. It is working fine as long as the data value is not NULL. Now, In my control, I have handled the NULL value so that no Exception is thrown. Still, when I bind this property using the SQLDataSource, I get Error "Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'." I am not sure if I can do anything to stop this erro within my control. If it is not possible from the control, then what is the workaround that I can do in my ASPX page in order to stop this error ?
Thanks a lot in advance.
|
|
|
|
|
What about checking DbNull.Value before binding?
maybe. You can check the SQLDataSource whether any null value included in it or not..
OR, Is there any place where you were trying to cast the type?
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Dear Michael,
Thanks a lot for your reply. Actually I am the control developer and I am supplying my control to my client. Now, within my code, i have the property of byte[] type. And this property is databoundable. Now, where can I place your snippet in the code of my control ? I mean, my code has following definition of the byte[] type property,
<br />
1 private byte[] binData;<br />
2 <br />
3 [Bindable(true)]<br />
4 [Category("Data Input fields")]<br />
5 [Localizable(true)]<br />
6 public byte[] BinData<br />
7 {<br />
8 get<br />
9 {<br />
10 try<br />
11 {<br />
12 <br />
13 }<br />
14 catch<br />
15 {<br />
binData = null;<br />
16 }<br />
17 <br />
18 return binData;<br />
19 }<br />
20 set<br />
21 {<br />
22 try<br />
23 {<br />
24 binData = value;<br />
25 }<br />
26 catch<br />
27 {<br />
28 binData = null;<br />
29 }<br />
30 <br />
37 }<br />
38 }<br />
39
Now, How can I access the datareader of the SQLDataSource or any datasource that has bound this property and override this error message ?
Regards.
|
|
|
|
|
I don't think that it's your responsibility to prevent this error. Let's say one simple one.
Example 1 ~
You are the control developer. So, you create one control that has one property. The type of this property is "int". I'm your client and I'm using your control in my problem. I wanna set one value to the property of your control. then, I wrote like yourcontrol.IntProperty = "Mike";. so, i will be getting the error since I'm setting wrong string data type to int type. In that situration, this is my responsibility for checking the datatype. (your client in your case.)
Do you get what I mean?
Example 2 ~
But let's say there is one function called "SetDataSource(DataTable)" in your control.
You wrote like that in that function of control ~
public void SetDataSource(DataTable dt){<br />
foreach(DataRow dr in dt.Rows){<br />
string str = (string)dr[0]; <br />
}<br />
}
When the user is passing the datatable that contains NULL values, your function will throw the error.
For that case, you have the responsibility for checking whether this value is null or not before casting the type.
So, you decide your case is like example 1 or 2. I think your case is like example 1. so, i don't think you need to do something about it.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Dear Michael,
thanks a lot again for your kind reply.
Actually, I was confused and I thought, may be I could do something within my sourcecode which could check the NULL value for the databound property. Because, when I have a label's Text property bound to a SQL varchar(x) type and if the SQL contains NULL for that varchar(x), we dont get this "Unable to cast....." Exception, rather, the Label shows Empty String. Same thing like CheckBox. If I bind "Checked" property of a checkbox to a SQL bit type field, and if SQL contains NULL value for that bit field, we dont get Exception, rather we see unchecked state of the CheckBox. So, I thought, the control developer made some smart way to handle databound NULL values for the Label and CheckBox. If so, as a developer, I also could do something for my Byte[] property.
If it is really not possible to implement solution within my control, what workaround I can suggest my client to overcome this error ? Because it is very usual that, his or her SQL Database may contain NULL values for the VarBinary(x) field and he/she wont like to get error for that, so he/she would like to know from me about the workaround.
I appreciate your kind help. Thanks a lot.
Regards,
Nishat
|
|
|
|
|
Hi,
Did you ever find a solution to this problem? I'm struggling with the exact same issue.
Many thanks,
Andrew
|
|
|
|
|
Hello All,
Thanks for reading this. Here is my issue. I have a datagrid which needs to show 3 columns from my database stored procedure. Lets say the stored proc returns a dataset with 3 columns A,B,C. In my datagrid I want to show columns A and B and keep column C invisible. No big deal right ? Okay here is the tricky part. If value of the data row for column C="General" then i want to make the entire row color Red(or the text color to turn red preferably) for that record.If the value of column C="Personal" i want the rowtext to remain black..but now i want to show a "Delete" hyperlink there, lets say clicking on it makes it go to another page.The "delete" hyperlink should not appear when the column C value is "General". I know the "Delete" hyperlink we can add as a column which is not visible, but cannot seem to figure the mechanics of it. How do I go about it ? All help is greatly appreciated. Code samples much more appreciated !!!
Regards
RH
|
|
|
|
|
|
Hi,
I have been trying to change the active tab of a Asp.Net AJAX toolkit tab container all day and I haven't been able to do it. I am new to both asp.net and javascript. I have done a couple of searches but nothing.
Here is the javascript that I am calling from my asp.net button OnClientClick handler. OnClientClick="return SwitchTab('TabContainer1');"
function SwitchTab(TabID)
{
var MyTab = document.getElementById(TabID);
// MyTab.style.display = "none"; //this line worked
MyTab.setAttribute('ActiveTabIndex','0');
return false;
}
How can I access the active tab attribute?
Thanks
Ali
AliR.
Visual C++ MVP
|
|
|
|