Kevin,
This is a control that writes the html for a couple of links, no child
controls. I am simply using an anchor tag with
Page.GetPostBackClientHyperlink(this, linkID) as the href attribute when
rendering the control. linkID is just an internal ID so that the control can
tell wich link was clicked: 0,1,2,3 and so on...
The problem is that when RaisePostBackEvent is called the eventArgumet
parameter does not contain my internal ID that I pass with each link as
shown below. __EVENTARGUMENT is there just as it should be but dotnet never
hands it to my implementation of the RaisePostBackEvent. I can get it to
work if I just grab __EVENTARGUMENT from the Request object but that seems
like a rediculus hack.
public void RaisePostBackEvent(string eventArgument)
{
// this writes the correct value
this.Context.Trace.Write("eventArgument=" +
this.Page.Request["__EVENTARGUMENT"]);
// this does NOT write the correct value, it is empty
this.Context.Trace.Write("eventArgument=" + eventArgument);
}
Thanks,
Mike
Kevin Spencer said:
Hi Mike,
The LoadPostData method is the one where you get the value from the
drop-down list box. You would then loop through your data source to figure
out the selected index.
I have an article/tutorial that does just that (using VB.Net as the
language). See:
http://www.takempis.com/aspnet_anatomy3.asp
--
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
The sun never sets on
the Kingdom of Heaven
Mike said:
I did read that you may need to implement IPostBackDataHandler, would sure
like to know why?
I did try it with the same results and the code is below:
public bool LoadPostData(String postDataKey, NameValueCollection values)
{
return false;
}
public void RaisePostDataChangedEvent()
{
}
Kevin Spencer said:
What does your LoadPostData method look like?
--
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
The sun never sets on
the Kingdom of Heaven
See Event Below:
public void RaisePostBackEvent(string eventArgument)
{
// this writes the correct value
this.Context.Trace.Write("eventArgument=" +
this.Page.Request["__EVENTARGUMENT"]);
// this does NOT write the correct value, it is empty
this.Context.Trace.Write("eventArgument=" + eventArgument);
this.SelectedID = Convert.ToInt32(eventArgument);
}
Did you assign the UniqueID to the name attribute of the custom Control?
--
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
The sun never sets on
the Kingdom of Heaven
I have done this many times but for some reason it's not working, the
raise
postback event fires but the eventArgument passed to it is empty. This
is
a
simple custom control that implements
IPostBackEventHandler
and I get the href for the a tag using
string href = this.Page.GetPostBackClientHyperlink(this,
tab.TabID.ToString());
In the trace for the postback the argumts is listed but it never
arrives
at
public void RaisePostBackEvent(string eventArgument)
{
this.Context.Trace.Write("SelectedID=" + eventArgument);
this.SelectedID = Convert.ToInt32(eventArgument);
}
This has got to be another one of the many wier asp.net behaviors, any
ideas...Thanks...