Howdy,
Something that has bothered me for a long time about how I've worked with grids (Telerik and non-Telerik alike) is when I have to specify things like DataKeyNames. I HATE how I essentially have them specified, MULTIPLE TIMES (both in the aspx and in the .cs when accessing them), with a hand-typed string. Obviously in the code behind I can put this string into a constant and access it that way. A better idea would be to use that same constant in the aspx file as well. Unfortunately, I can't seem to get that to work.
My ideal implementation would be readonly static KeyValuePair<string, string> objects where the key is the UniqueName and the value is the DataField. However, the DataKeyNames property will not take these as best as I can tell. Also, once I get THAT working, I'd also want to use this same technique when configuring my columns. I'm trying it as such:
DataKeyNames='<%=GridColumnID.Key%>, <%=GridColumnQty.Key%>, <%=GridColumnMax.Key%>' |
What is a way for me to do this such that these "magic strings" are only defined once in my constants section rather than being copied/pasted multiple times?
Mucho thanks!!
-Shane