|
Hi All,
I have a Grid View which displays the product details using an SqlDataSource.I have an associated Details View through which I am inserting and editing Product Details using another SqlDataSource.The problem is whenever I insert a record into products the values are properly inserted and reflected in the grid but immediately after insertion, whenever i refresh the page the same record is getting inserted again.Why is it so?How wud I stop this.
Any small help in this regard wud be appreciated
Thanks
Haasini
|
|
|
|
|
Redirect the same page after inserting record
or
do not store Duplicate data in database using project Title or any other column name
Best Regard
---------------------------------------------------
|
|
|
|
|
Thanks a Ton Imran..
Its working perfectly fine..
Regards
Haasini
|
|
|
|
|
I have made one master page say master.aspx which is in the folder (ub/Forms/Common Forms/master.aspx) and has child form form1.aspx which is in the same folder(Forms/Common Forms/form1.aspx). I have included one image say image1.jpg which is in the folder(ub/images/common image/image1.jpg) in the master.aspx.Now when i run the form1.aspx, all the properties of master page comes except image1.jpg. The image1.jpg doesn't come.But when i take another child form say form2.aspx which is in the folder(/ub/form2.aspx),it shows all the properties of master.aspx including image1.jpg. But i want to show in form1.aspx...It's not working..Why so ??? How to solve it ?
suchitamanandhar@hotmail.com
|
|
|
|
|
maybe. try like that ../common image/image1.jpg (two dots)
OR
Use the full path (http://yoursite.com/ub/images/common image/image1.jpg )
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.
|
|
|
|
|
hey guy
take a contentpanel in ur form then
retreive the masterpage in ur form
images automatically display in ur form
lucky
|
|
|
|
|
Hi.
From Database i m getting data in this format.
CAC PAT A 12/03/07
CAC PAT A 12/04/07
CAC PAT A 12/05/07
CMP CAT B 11/03/07
CMP CAT B 11/06/07
CMP CAT B 11/08/07
CPL AMT C 10/01/07
CPL AMT C 10/04/07
CPL AMT C 10/06/07
I want to display like that
CAC PAT A 12/03/07
12/04/07
12/05/07
CMP CAT B 11/03/07
11/06/07
11/08/07
CPL AMT C 10/01/07
10/04/07
10/06/07
How to do ?
Help me
Thanks
|
|
|
|
|
Use ItemDataBound Event of GridView.
|
|
|
|
|
thanks for reply
can you explain it
thanks
|
|
|
|
|
Try this is the code which i used for it.
private void DG_ItemDataBound(object o, DataGridItemEventArgs e)<br />
{ <br />
if (e.Item.ItemType == ListItemType.Item<br />
|| e.Item.ItemType == ListItemType.AlternatingItem)<br />
{<br />
TableCell cell = (e.Item.Controls[0] as TableCell);<br />
cell.Width = new Unit("120px");<br />
cell.Style["border-right"] = "2px solid #666666";<br />
cell.BackColor = System.Drawing.Color.LightGray;<br />
<br />
for(int i=1; i<e.Item.Controls.Count; i++)<br />
{<br />
cell = (e.Item.Controls[i] as TableCell);<br />
<br />
cell.HorizontalAlign = HorizontalAlign.Right;<br />
cell.Width = new Unit("90px");<br />
<br />
if (i % 2 == 1)<br />
cell.BackColor <br />
= System.Drawing.ColorTranslator.FromHtml("#EFEFEF");<br />
<br />
if (GetCellValue(cell) >= 8000)<br />
{<br />
cell.Font.Bold = true;<br />
cell.BorderWidth = new Unit("1px");<br />
cell.BorderColor = System.Drawing.Color.Gray;<br />
cell.BorderStyle = BorderStyle.Dotted;<br />
cell.BackColor = System.Drawing.Color.Honeydew;<br />
}<br />
<br />
} <br />
<br />
}<br />
<br />
if (e.Item.ItemType == ListItemType.Header)<br />
{<br />
foreach (TableCell cell in e.Item.Controls)<br />
{<br />
cell.Style["border-bottom"] = "2px solid #666666";<br />
cell.BackColor=System.Drawing.Color.LightGray;<br />
}<br />
}<br />
<br />
}
It is an Example only try it with your specs.
SSK.
|
|
|
|
|
Exactly copied from this[^]. Shame on you
|
|
|
|
|
Item Data Bound is the event which is fired before u bind the GridView Control, so either u can fire a query where u will get the ID and Different dates and then match that ID with the e.Row.Cells[0].Text and do something like this:
e.Row.Cells[1].Text= //Put all the different date in a string variable separated by
Before this u will have to write the above code in this if statement:
if (e.Row.RowType == DataControlRowType.DataRow)
{
}
I am not sure about the syntax. But u can get it.
Hope u understood the code.
|
|
|
|
|
hey guy first of all where u want to display the format in crystal or other if in crystal report make a group go to group insert group select the datatable column name it will be work.
byeeeeeeeee
lucky
|
|
|
|
|
Is it possible that i enter a date in other format than Gregorian and upon tab for example change it to its equivillant in Gregorian.
thanks
|
|
|
|
|
|
Can you please tell me how?
Thanks
|
|
|
|
|
Hi ,
i am using the following code in html to play videos in media player. But i want to give the filename based on the value present in radiobuttonlist. But how to do this? I am confused. Any help ?
<object id="mediaplayer" classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" style="width: 216px; height: 168px">
<param name="FileName" value="funny.wmv" />
Chaitra N
|
|
|
|
|
<a href = "http://www.killersites.com/mvnforum/mvnforum/viewthread?thread=3602#18305" rel="nofollow">http://www.killersites.com/mvnforum/mvnforum/viewthread?thread=3602#18305</a>
<pre>
<script type="text/javascript">
function play(media){
document.getElementById('mediaplayer').innerHTML=
'<object classid="clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95"'
+'type="application/x-oleobject" width="320" height="285">'
+'<param name="showControls" value="false">'
+'<param name="fileName" value="'+media+'">'
+'<embed type="application/x-mplayer2" width="320" height="285"'
+'showcontrols="false" src="'+media+'"><\/embed><\/object>'
}
</script>
Add this to the CSS:
#mediaplayer {
width: 320px;
height: 285px;
background: #000;
}
And put this in the html where you want the videos to play and menu:
<div id="mediaplayer"></div>
<ul id="menu">
<li><a onclick="play("<b>mymovie1.wmv</b>");return false" href="">Movie 1</a></li>
<li><a onclick="play("<b>mymovie2.wmv</b>");return false" href="">Movie 2</a></li>
</ul></pre>
<b>Note that OBJECT tag won't work on Firefox. </b>
Edit: Text editor is really bad for posting code..
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.
|
|
|
|
|
Hi Michael,
The code i sent is working fine but i want it to get displayed based on the title present in bulletedlist.
See I am storing the path of the video files in my database. I am using the following code to retrieve the path of the file. What I am finding difficult is to assign that path to the " filename " of the mediaplayer object
Protected Sub Show_Products(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.BulletedListEventArgs) Handles BulletedList1.Click
Dim SQLString As String = "SELECT filepath FROM pictures WHERE title = '" & BulletedList1.Items(e.Index).Text & "'"
Dim dr As Data.SqlClient.SqlDataReader
Dim comm As New Data.SqlClient.SqlCommand(SQLString, dbconn)
If dbconn.State <> ConnectionState.Open Then
dbconn.Open()
End If
Dim str As String
dr = comm.ExecuteReader
While dr.Read
str = dr.Item(0)
End While
dr.Close()
str = str
End Sub
|
|
|
|
|
Hi all,
i need a validation rule for date dd/MM/yyyy that applies rule of leap year.
thanks
|
|
|
|
|
Try with this code
TWO STEPS TO INSTALL VALIDATE DATE:
1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document -->
<br />
<HEAD><br />
<br />
<SCRIPT LANGUAGE="JavaScript"><br />
<br />
<!-- This script and many more are available free online at --><br />
<!-- The JavaScript Source!! http:
<!-- Original: Torsten Frey (tf@tfrey.de) --><br />
<!-- Web Site: http:
<br />
<!-- Begin<br />
function check_date(field){<br />
var checkstr = "0123456789";<br />
var DateField = field;<br />
var Datevalue = "";<br />
var DateTemp = "";<br />
var seperator = ".";<br />
var day;<br />
var month;<br />
var year;<br />
var leap = 0;<br />
var err = 0;<br />
var i;<br />
err = 0;<br />
DateValue = DateField.value;<br />
<br />
for (i = 0; i < DateValue.length; i++) {<br />
if (checkstr.indexOf(DateValue.substr(i,1)) >= 0) {<br />
DateTemp = DateTemp + DateValue.substr(i,1);<br />
}<br />
}<br />
DateValue = DateTemp;<br />
<br />
<br />
if (DateValue.length == 6) {<br />
DateValue = DateValue.substr(0,4) + '20' + DateValue.substr(4,2); }<br />
if (DateValue.length != 8) {<br />
err = 19;}<br />
<br />
year = DateValue.substr(4,4);<br />
if (year == 0) {<br />
err = 20;<br />
}<br />
<br />
month = DateValue.substr(2,2);<br />
if ((month < 1) || (month > 12)) {<br />
err = 21;<br />
}<br />
<br />
day = DateValue.substr(0,2);<br />
if (day < 1) {<br />
err = 22;<br />
}<br />
<br />
if ((year % 4 == 0) || (year % 100 == 0) || (year % 400 == 0)) {<br />
leap = 1;<br />
}<br />
if ((month == 2) && (leap == 1) && (day > 29)) {<br />
err = 23;<br />
}<br />
if ((month == 2) && (leap != 1) && (day > 28)) {<br />
err = 24;<br />
}<br />
<br />
if ((day > 31) && ((month == "01") || (month == "03") || (month == "05") || (month == "07") || (month == "08") || (month == "10") || (month == "12"))) {<br />
err = 25;<br />
}<br />
if ((day > 30) && ((month == "04") || (month == "06") || (month == "09") || (month == "11"))) {<br />
err = 26;<br />
}<br />
<br />
if ((day == 0) && (month == 0) && (year == 00)) {<br />
err = 0; day = ""; month = ""; year = ""; seperator = "";<br />
}<br />
<br />
if (err == 0) {<br />
DateField.value = day + seperator + month + seperator + year;<br />
}<br />
<br />
else {<br />
alert("Date is incorrect!");<br />
DateField.select();<br />
DateField.focus();<br />
}<br />
}<br />
</script><br />
<br />
</HEAD><br />
<br />
<!-- STEP TWO: Copy this code into the BODY of your HTML document --><br />
<br />
<BODY><br />
<br />
<CENTER><br />
<FORM name="datecheck"><br />
<TABLE border="0" width="60%"><br />
<TR><br />
<TD><br />
Enter Date (Use European format shown at right)<P><br />
<INPUT type="text" name=testdat size='10' maxlength="10" onblur="check_date(this)"><br />
<INPUT type= "submit" name="button" value="Press to Validate"><p><br />
(Date is validated after leaving the field.)<br />
</TD><br />
<TD><br />
ddmmyy (171201) or <BR><br />
ddmmyyyy (17122001) or <BR><br />
ddXmmXyy (17-12-01 or 17y12q01 ... ) or <BR><br />
ddXmmXyyyy (17.12.2001 or 17,12,2001 ...) <br><br />
where "X" is any sign not in 0..9, i.e. "-" or "/"<p><br />
</TD><br />
</TR><br />
</TABLE><br />
</FORM><br />
</CENTER><br />
Hope this will help you.
SSK.
|
|
|
|
|
heyyyyy
just apply the condition leap year is in four year
so if a >= 4 then leap year
else not a leap year
byeee
lucky
|
|
|
|
|
I have two listboxes ,one of the listbox data is populate in database. And I have two buttons Add and Remove.
Once I click the add the button , the selected items is populated in another list box by using Javascript.
Similarly Remove also.
Give the javascript code or suitable link for the above scenrio
|
|
|
|
|
Use the Following code:
function f_optionMove(s_from, s_to)
{
var e_from = document.getElementById(s_from), e_to = document.getElementById(s_to);//test_form.elements[s_from],e_to = document.forms['test_form'].elements[s_to];
if (!e_from.name)
return alert ("Error: selectbox with name '" + s_from + "' can't be found.");
if (!e_to.name)
return alert ("Error: selectbox with name '" + s_from + "' can't be found.");
var n_moved = 0;
for (var i = 0; i < e_from.options.length; i++)
{
if (e_from.options[i].selected)
{
var name = e_from.options[i].text;
var ID = e_from.options[i].value;
e_from.options[i] = null;
e_to.options[e_to.options.length] = new Option (name,ID);
n_moved++;
}
}
if (n_moved)
e_from.options.length = e_from.options.length;
else
alert("You haven't selected any options");
}
function f_optionMoveAll(s_from, s_to)
{
var e_from = document.getElementById(s_from), e_to = document.getElementById(s_to);
if (!e_from.name)
return alert ("Error: selectbox with name '" + s_from + "' can't be found.");
if (!e_to.name)
return alert ("Error: selectbox with name '" + s_from + "' can't be found.");
var cntDesc = e_from.options.length;
var cntSource = e_to.options.length;
for (var i = 0; i < cntDesc; i++)
{
var name = e_from.options[i].text;
var ID = e_from.options[i].value;
e_to.options[cntSource] = new Option (name,ID);
cntSource++;
}
e_from.options.length = 0;
}
<
table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
<asp:listbox id="lstsource" runat="server" selectionmode="Multiple">
|
|
|
| <
asp:ListBox ID ="lstdestination" runat="server" SelectionMode ="Multiple">
|
|
|
|
|
|
how can i store the values in the 'lstdestination' listbox. Suppose i select the three values from the lstsource. How can i reterive the three values in server side ie., Code behind.
|
|
|
|