Click here to Skip to main content
15,899,313 members
Home / Discussions / C#
   

C#

 
GeneralRe: Help me to encrypt text file into an image Pin
Russell Jones7-Mar-08 3:57
Russell Jones7-Mar-08 3:57 
GeneralRe: Help me to encrypt text file into an image Pin
CPallini7-Mar-08 5:17
mveCPallini7-Mar-08 5:17 
QuestionHow to identify bookmarks and hyperlinks in a pdf file Pin
Member 42489617-Mar-08 2:49
Member 42489617-Mar-08 2:49 
GeneralRe: How to identify bookmarks and hyperlinks in a pdf file Pin
Justin Perez7-Mar-08 4:10
Justin Perez7-Mar-08 4:10 
QuestionHaving a file browsing property in a property sheet Pin
Le centriste7-Mar-08 2:36
Le centriste7-Mar-08 2:36 
GeneralRe: Having a file browsing property in a property sheet Pin
stancrm7-Mar-08 2:51
stancrm7-Mar-08 2:51 
GeneralRe: Having a file browsing property in a property sheet Pin
Le centriste7-Mar-08 3:02
Le centriste7-Mar-08 3:02 
QuestionHelp in User Control implemented using Callbacks Pin
Neeraj Kr7-Mar-08 0:49
Neeraj Kr7-Mar-08 0:49 
Hi, I am creating a 5 star rating control using callbacks.

I am not able to send the value to the parent page and then save it. When I try to capture the click event of the image, I guess multiple events occur and then I loose the actual value. The actual value does not persists.

I have used five image controls and One hiddenField named 'hdn' and have written javascript functions for handling the OnMouseOver, OnMouseOut and Click Event. The functions are s follows:

--------Image Click Event----------
function onImgClick(strVal)
{
var countRec;
var imgName;
var message = strVal + ":" + "Click";
var context = "Click";
CallServer(message, context);
}
------------------------------------
----------OnMouseOver--------------
function callSwapImage(strVal)
{
var countRec;
var imgName;
for (countRec = 1; countRec<=parseInt(strVal); countRec++)
{
imgName = "imgStar" + String(countRec);
document.images[imgName].src = "images/starGold.gif";
}
}
---------OnMouseOut------------
function callSwapRedo()
{
var message = document.getElementById("rc1_hdn").value + ":" + "Redo";
var context = "Redo";
CallServer(message, context);
}
-------------------------------

In the code behind file of the user control I have written the following code in the Page_Load Event

protected void Page_Load(object sender, EventArgs e)
{
sCallBackFunctionInvocation = Page.ClientScript.GetCallbackEventReference(this, "message", "ShowSuccess",
"context");
String callbackScript;
callbackScript = "function CallServer(message, context)" +
"{ " + sCallBackFunctionInvocation + ";}";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(),
"CallServer", callbackScript, true);
HiddenField hdn = new HiddenField();
}

For the RaiseCallbackEvent I have written

public void RaiseCallbackEvent(string eventArgument)
{
string[] remCount = new string[2];
if (Rated != null)
{
if (eventArgument != "")
{
remCount = eventArgument.Split(':');
if (remCount[1] == "Click")
{
EventArgs args = new EventArgs();
Rated(this, args);
}
}
if (hdn.Value.ToString() == "" && remCount[0] == "0")
{
returnValue = "0";
totChecked = returnValue;
hdn.Value = returnValue;
}

else
{
returnValue = remCount[0];
hdn.Value = returnValue;
totChecked = returnValue;
}
}
RateVal = returnValue;
}

The below function is written to send the result back to the client end

public string GetCallbackResult()
{
return returnValue;
}

-----------------------------------


My problem comes now that I want to send the value for the image clicked to the parent page so that I can save the rating. For this I have declared the following event before the page load

public event System.EventHandler Rated;

and then I have declared the event handler for the same in my parent page

protected void Page_Load(object sender, EventArgs e)
{
rc1.Rated += new EventHandler(rc_fetchData);
//rc.Rated += new CommandEventHandler(rc_fetchData);
}

private void rc_fetchData(object sender, EventArgs e)
{
lblMsg.Text = ((HiddenField)rc1.FindControl("hdn")).Value.ToString();
//((HiddenField)rc.FindControl("hdn")).Value.ToString();
}

-----Have A Nice Day-----

Questiontwo filters in List class find function Pin
Sonia Gupta6-Mar-08 23:23
Sonia Gupta6-Mar-08 23:23 
GeneralRe: two filters in List class find function Pin
Pete O'Hanlon6-Mar-08 23:32
mvePete O'Hanlon6-Mar-08 23:32 
GeneralRe: two filters in List class find function Pin
Giorgi Dalakishvili6-Mar-08 23:34
mentorGiorgi Dalakishvili6-Mar-08 23:34 
GeneralRe: two filters in List class find function Pin
J4amieC7-Mar-08 2:25
J4amieC7-Mar-08 2:25 
GeneralRe: two filters in List class find function Pin
Pete O'Hanlon7-Mar-08 3:37
mvePete O'Hanlon7-Mar-08 3:37 
GeneralRe: two filters in List class find function Pin
J4amieC7-Mar-08 4:20
J4amieC7-Mar-08 4:20 
GeneralRe: two filters in List class find function Pin
Pete O'Hanlon7-Mar-08 4:42
mvePete O'Hanlon7-Mar-08 4:42 
Generalproblem in setting datasource of a usercontrol Pin
saneng6-Mar-08 23:03
saneng6-Mar-08 23:03 
Questionsorting of a string column Pin
Sonia Gupta6-Mar-08 22:58
Sonia Gupta6-Mar-08 22:58 
GeneralRe: sorting of a string column Pin
Laddie6-Mar-08 23:11
Laddie6-Mar-08 23:11 
GeneralRe: sorting of a string column Pin
Pete O'Hanlon6-Mar-08 23:29
mvePete O'Hanlon6-Mar-08 23:29 
QuestionRe: sorting of a string column Pin
Sonia Gupta6-Mar-08 23:34
Sonia Gupta6-Mar-08 23:34 
GeneralRe: sorting of a string column PinPopular
Pete O'Hanlon6-Mar-08 23:37
mvePete O'Hanlon6-Mar-08 23:37 
QuestionRe: sorting of a string column Pin
Leyu7-Mar-08 0:31
Leyu7-Mar-08 0:31 
GeneralRe: sorting of a string column Pin
Luc Pattyn7-Mar-08 1:28
sitebuilderLuc Pattyn7-Mar-08 1:28 
GeneralRe: sorting of a string column [modified] Pin
PIEBALDconsult7-Mar-08 6:24
mvePIEBALDconsult7-Mar-08 6:24 
GeneralAll Textbox Should be Replace with Zero Pin
M Riaz Bashir6-Mar-08 22:41
M Riaz Bashir6-Mar-08 22:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.